From 44205ab6cc8c4ea956c14c4ab197f6b8fdcb51c0 Mon Sep 17 00:00:00 2001 From: wanghao Date: Mon, 25 May 2026 09:46:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=BF=9B=E5=87=BA=E6=B8=AF=E4=BA=A4?= =?UTF-8?q?=E6=8E=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webapi/controller/ApiController.java | 73 ++++++++++++++++--- .../src/main/resources/mapper/ApiMapper.xml | 56 +++++++++----- 2 files changed, 100 insertions(+), 29 deletions(-) diff --git a/ruoyi-webapi/src/main/java/com/ruoyi/webapi/controller/ApiController.java b/ruoyi-webapi/src/main/java/com/ruoyi/webapi/controller/ApiController.java index 581b036..6b97bdc 100644 --- a/ruoyi-webapi/src/main/java/com/ruoyi/webapi/controller/ApiController.java +++ b/ruoyi-webapi/src/main/java/com/ruoyi/webapi/controller/ApiController.java @@ -61,6 +61,8 @@ public class ApiController extends BaseController { private IRecordBasketCheckContentService recordBasketCheckContentService;//盘点内容 @Autowired private IBaseAirCodeService baseAirCodeService; + @Autowired + private IRecordDeliveryTaskWaybillService recordDeliveryTaskWaybillService;//进港接货 @PostMapping("/findBindingList") public AjaxResult findBindingList(String epc) { @@ -102,7 +104,6 @@ public class ApiController extends BaseController { return AjaxResult.error("库位没有维护"); } - // 接货查询 @PostMapping("/jion/select") public AjaxResult jionSelect(String user) { @@ -136,7 +137,7 @@ public class ApiController extends BaseController { for (MultipartFile file : files) { try { // 插入图片 - recordDeliveryTaskImgService.insertRecordDeliveryTaskImg( new RecordDeliveryTaskImg(){{ + recordDeliveryTaskImgService.insertRecordDeliveryTaskImg(new RecordDeliveryTaskImg() {{ setTaskCode(taskCode); setImgPath(FileUploadUtils.upload(filePath, file)); }}); @@ -145,7 +146,7 @@ public class ApiController extends BaseController { } } } - if (type.equals("0")){ + if (type.equals("0")) { // 出港 // 插入资产到任务表 List ledgerInstantBindings = JSONArray.parseArray(json, LedgerInstantBinding.class); @@ -154,9 +155,9 @@ public class ApiController extends BaseController { // 更新状态 List ids = ledgerInstantBindings.stream().map(LedgerInstantBinding::getBasketId).collect(Collectors.toList()); ledgerInstantBindingService.updateTaskStatebyBasketID(ids); - }else if (type.equals("1")){ + } else if (type.equals("1")) { List stringList = JSONArray.parseArray(json, String.class); - recordDeliveryTaskBaseketService.insertRecordDeliveryTaskWaybill(taskCode,stringList); + recordDeliveryTaskBaseketService.insertRecordDeliveryTaskWaybill(taskCode, stringList); } return AjaxResult.success(); } @@ -176,7 +177,6 @@ public class ApiController extends BaseController { @PostMapping("/join/shouSubmit") public AjaxResult joinJieSubmit(@RequestBody ReceiptSubmitBeen been) { int i = service.joinShouSubmit(been); - if (i >= been.getList().size()) { return AjaxResult.success(); } @@ -196,8 +196,7 @@ public class ApiController extends BaseController { // 远程接货扫描epc @PostMapping("/receipt/scanEpc") - public AjaxResult ReceiptScanEpc(@RequestParam(name = "epc", required = false, defaultValue = "") String epc, - @RequestParam(name = "waybillNumber", required = false, defaultValue = "") String waybillNumber) { + public AjaxResult ReceiptScanEpc(@RequestParam(name = "epc", required = false, defaultValue = "") String epc, @RequestParam(name = "waybillNumber", required = false, defaultValue = "") String waybillNumber) { Long objId = null; if (epc != null && !epc.equals("")) { @@ -227,8 +226,61 @@ public class ApiController extends BaseController { return AjaxResult.success(map); } + // 进港接货扫描 + @PostMapping("/receipt/selectTaskByWaybillCode") + public AjaxResult ReceiptScanEpc(String waybillNumber) { + List list = recordDeliveryTaskWaybillService.selectTaskWaybillList(waybillNumber); + if (list == null || list.isEmpty()) return AjaxResult.error("集装器/散斗代码查询失败,暂无任务"); + String taskCode = list.get(0).getTaskCode(); + // 查询所有图片 + RecordDeliveryTaskImg recordDeliveryTaskImg = new RecordDeliveryTaskImg(); + recordDeliveryTaskImg.setTaskCode(taskCode); + List imgList = recordDeliveryTaskImgService.selectRecordDeliveryTaskImgList(recordDeliveryTaskImg); + // 封装返回数据 + Map map = new HashMap<>(); + map.put("taskCode", taskCode); + // List baseketList=new ArrayList<>(list.size()); + // list.forEach(t->{ + // baseketList.add(new RecordDeliveryTaskBaseket(){{ + // setTaskCode(taskCode); + // setWaybillNumber(waybillNumber); + // }}); + // }); + map.put("baseketList", list); + map.put("imgList", imgList); + return AjaxResult.success(map); + } - // 远程接货确认 + // 进港接货确认 + @Transactional + @PostMapping("/receiveInTask/submit") + public AjaxResult receiveInTaskSubmit(String json, String gps, String taskCode, String user) { + List list = JSONArray.parseArray(json, LedgerInstantBinding.class); + list.forEach(item -> { + + String cargoFrameEpc = item.getCargoFrameEpc(); + String waybillNumber = item.getWaybillNumber(); + Long basketId = item.getBasketId(); + // 插入资产绑定关系 + int i = service.insertLedgerBinding(cargoFrameEpc, waybillNumber, user, basketId); + + // 插入资产绑定记录 + recordCargoBindingService.insertRecordCargoBinding(new RecordCargoBinding() {{ + setBasketId(basketId); + setCargoFrameEpc(cargoFrameEpc); + setWaybillNumber(waybillNumber); + setCreateBy(user); + setLocationInfo(gps); + }}); + // 插入任务子表 + recordDeliveryTaskWaybillService.updateRecord(taskCode,waybillNumber,cargoFrameEpc,basketId); + }); + + recordDeliveryTaskService.closeTaskByReceipt(taskCode, user, gps);//关闭任务 + return AjaxResult.success(); + } + + // 出港接货 @PostMapping("/receipt/submit") public AjaxResult receiptSubmit(@RequestBody ReceiptSubmitBeen been) { int i = service.joinShouSubmit(been); @@ -348,8 +400,7 @@ public class ApiController extends BaseController { * 提交绑定记录 */ @PostMapping("/submitBindingRecord") - public AjaxResult submitBindingRecord(Long baseBasketId, String basketEpc, String basketEpc2, String localWeight, - String createdBy, List files) { + public AjaxResult submitBindingRecord(Long baseBasketId, String basketEpc, String basketEpc2, String localWeight, String createdBy, List files) { int tagCount = baseBasketInfoService.selectCountBasketByEpc(basketEpc); if (tagCount > 0) { return AjaxResult.error("RFID标签1已绑定"); diff --git a/ruoyi-webapi/src/main/resources/mapper/ApiMapper.xml b/ruoyi-webapi/src/main/resources/mapper/ApiMapper.xml index b5bb219..c6fb371 100644 --- a/ruoyi-webapi/src/main/resources/mapper/ApiMapper.xml +++ b/ruoyi-webapi/src/main/resources/mapper/ApiMapper.xml @@ -4,33 +4,50 @@ - INSERT INTO ledger_instant_binding (cargo_frame_epc, waybill_number,create_by,basket_id) VALUES (#{param1}, #{param2},#{param3},#{param4}); + INSERT INTO ledger_instant_binding (cargo_frame_epc, waybill_number, create_by, basket_id) + VALUES (#{param1}, #{param2}, #{param3}, #{param4}); - delete from ledger_instant_binding WHERE cargo_frame_epc = #{epc} + delete + from ledger_instant_binding + WHERE cargo_frame_epc = #{epc} - delete from ledger_instant_binding WHERE cargo_frame_epc = #{param1} and waybill_number = #{param2} + delete + from ledger_instant_binding + WHERE cargo_frame_epc = #{param1} + and waybill_number = #{param2} - UPDATE base_location_info SET remark = #{param2} WHERE location_code = #{param1} + UPDATE base_location_info + SET remark = #{param2} + WHERE location_code = #{param1} - UPDATE base_location_info SET remark = null WHERE location_code = #{locationCode}; + UPDATE base_location_info + SET remark = null + WHERE location_code = #{locationCode}; @@ -40,29 +57,32 @@ - select count(1) from ledger_instant_binding basket_id in #{item} - and create_by=#{user} + and create_by=#{user} - - - - - - + + + + + +