From 6703d73c7ccba72e81f376348a7a133abe44d1c7 Mon Sep 17 00:00:00 2001 From: wanghao Date: Tue, 10 Sep 2024 19:19:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/api/controller/ApiController.java | 22 ++++++++++--- .../java/com/ruoyi/api/mapper/ApiMapper.java | 4 ++- .../ruoyi/api/service/impl/ApiService.java | 8 +++-- .../src/main/resources/mapper/ApiMapper.xml | 31 +++++++++++++------ 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java b/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java index 06a3f66..4f805af 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/controller/ApiController.java @@ -88,12 +88,24 @@ public class ApiController { @PostMapping("/outStore/submit") public AjaxResult outStoreSubmit(@RequestBody OutStoreDto outStoreDto) { try { - List epcList = outStoreDto.getEpcList(); - int size = epcList.size(); + List epcList = outStoreDto.getEpcList(); + //int i=0; + for (String epc:epcList ) { + String tag = apiService.selectLedgerbyEpcForOutStore(epc); + if (tag!=null){ + apiService.submitInsertRecordOut(outStoreDto,epc); + apiService.updataLedgerFoyOut(outStoreDto,epc); + //i++; + } + + } + + + /* int size = epcList.size(); Iterator iterator = epcList.iterator(); while (iterator.hasNext()) { String epc = iterator.next(); - String tag = apiService.selectLedgerbyEpcForOutStore(epc); + if (tag != null) { iterator.remove(); } @@ -103,9 +115,9 @@ public class ApiController { if (i>0){ apiService.submitInsertRecordOut(outStoreDto); apiService.updataLedger(outStoreDto); - } + }*/ - return success("本次入库成功:" + size1 +"条,屏蔽重复入库:"+ i +"条"); + return success(); }catch (Exception e){ return error(); } diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java b/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java index 887e0ef..8ce98ff 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/mapper/ApiMapper.java @@ -19,7 +19,7 @@ public interface ApiMapper { int submintInsertLedger(@Param("inStore") InStoreDto inStore); - int submitInsertRecordOut(@Param("outStoreDto") OutStoreDto outStoreDto); + int submitInsertRecordOut(@Param("outStoreDto") OutStoreDto outStoreDto,@Param("epc") String epc); int updataLedger(@Param("outStoreDto") OutStoreDto outStoreDto); @@ -51,4 +51,6 @@ public interface ApiMapper { String selectLedgerbyEpcForInStore(String epc); String selectLedgerbyEpcForOutStore(String epc); + + int updataLedgerFoyOut(@Param("outStoreDto") OutStoreDto outStoreDto, @Param("epc") String epc); } diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java index 2bc3836..1c0ad05 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/service/impl/ApiService.java @@ -28,8 +28,8 @@ public class ApiService { return mapper.submintInsertLedger(inStore); } - public int submitInsertRecordOut(OutStoreDto outStoreDto) { - return mapper.submitInsertRecordOut(outStoreDto); + public int submitInsertRecordOut(OutStoreDto outStoreDto,String epc) { + return mapper.submitInsertRecordOut(outStoreDto,epc); } public int updataLedger(OutStoreDto outStoreDto) { @@ -91,4 +91,8 @@ public class ApiService { public String selectLedgerbyEpcForOutStore(String epc) { return mapper.selectLedgerbyEpcForOutStore(epc); } + + public int updataLedgerFoyOut(OutStoreDto outStoreDto,String epc) { + return mapper.updataLedgerFoyOut(outStoreDto,epc); + } } diff --git a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml index aaf40db..f9f944a 100644 --- a/ruoyi-api/src/main/resources/mapper/ApiMapper.xml +++ b/ruoyi-api/src/main/resources/mapper/ApiMapper.xml @@ -14,7 +14,7 @@ select rifd_code from ledger_rfid where rifd_code = #{epc} limit 1 - INSERT ignore into bg_wheel_chocks.record_in (epc_code, batch_code, location_code,manufacturer_id, + INSERT ignore into record_in (epc_code, batch_code, location_code,manufacturer_id, manufacturer_Name, create_by,create_time) VALUES @@ -26,7 +26,7 @@ - INSERT ignore into bg_wheel_chocks.ledger_rfid (manufacturer_id, rifd_code, batch_code, location_code) + INSERT ignore into ledger_rfid (manufacturer_id, rifd_code, batch_code, location_code) VALUES (#{inStore.manufacturerId},#{item},#{inStore.binchCode},#{inStore.selectLocationText}) @@ -36,14 +36,17 @@ - INSERT INTO bg_wheel_chocks.record_out (epc_code, location_code, use_user, create_by) VALUES + INSERT INTO record_out (epc_code, location_code, use_user, create_by) + VALUES - (#{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser}) + ( + #{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser} + ) - UPDATE bg_wheel_chocks.ledger_rfid + UPDATE ledger_rfid SET location_type = '2', location_code = #{outStoreDto.areaCode}, @@ -53,6 +56,14 @@ #{epc} + + UPDATE ledger_rfid + SET + location_type = '2', + location_code = #{outStoreDto.areaCode}, + update_time = now() + WHERE rifd_code =#{epc} + - INSERT INTO bg_wheel_chocks.record_store_check_info (check_id, epc_code, location_code, check_state) + INSERT INTO record_store_check_info (check_id, epc_code, location_code, check_state) VALUES (#{id}, #{item.epcCode},#{item.locationCode},#{item.state}) @@ -98,7 +109,7 @@ where rifd_code = #{epc} - UPDATE bg_wheel_chocks.ledger_rfid + UPDATE ledger_rfid SET is_scrap = #{state}, update_time=now() WHERE rifd_code = #{epc} @@ -114,7 +125,7 @@ from ledger_rfid lf left join sys_dict_data sdd on sdd.dict_value = is_scrap and sdd.dict_type = 'bf_y_n' left join sys_dict_data sdd1 on sdd1.dict_value = location_type and sdd1.dict_type = 'store_tag' - left join bg_wheel_chocks.record_invalidated ri on lf.rifd_code = ri.epc + left join record_invalidated ri on lf.rifd_code = ri.epc where rifd_code = #{epc} limit 1 @@ -153,14 +164,14 @@ - INSERT INTO bg_wheel_chocks.record_waste_out (epc_code, location_code, create_by) VALUES + INSERT INTO record_waste_out (epc_code, location_code, create_by) VALUES ( #{item.epcCode},#{item.locationCode},#{user}) - UPDATE bg_wheel_chocks.ledger_rfid + UPDATE ledger_rfid SET location_type = null, location_code = null, is_scrap = '3',