Commit e3918313f874923441111d5f4100002b7ec4ebf2
1 parent
ce3ebfcb
电池包生产领料单手动回传MES
Showing
11 changed files
with
183 additions
and
76 deletions
src/main/java/com/huaheng/api/erp/service/TaskReturnService.java
@@ -7,6 +7,7 @@ import com.huaheng.pc.barcode.barcodeHeader.domain.BarCodeHeader; | @@ -7,6 +7,7 @@ import com.huaheng.pc.barcode.barcodeHeader.domain.BarCodeHeader; | ||
7 | import com.huaheng.pc.monitor.job.domain.datas; | 7 | import com.huaheng.pc.monitor.job.domain.datas; |
8 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | 8 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
9 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; | 9 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
10 | +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; | ||
10 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; | 11 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
11 | import org.apache.poi.ss.formula.functions.T; | 12 | import org.apache.poi.ss.formula.functions.T; |
12 | 13 | ||
@@ -33,4 +34,6 @@ public interface TaskReturnService { | @@ -33,4 +34,6 @@ public interface TaskReturnService { | ||
33 | public Map<String,Object> getDataByMaterialCode(String materialCode); | 34 | public Map<String,Object> getDataByMaterialCode(String materialCode); |
34 | 35 | ||
35 | AjaxResult returnhistoryBatteryCode(FBatteryBill fBatteryBill); | 36 | AjaxResult returnhistoryBatteryCode(FBatteryBill fBatteryBill); |
37 | + | ||
38 | + AjaxResult toMes(ShipmentHeader shipmentHeader); | ||
36 | } | 39 | } |
src/main/java/com/huaheng/api/erp/service/TaskReturnServiceImpl.java
@@ -3,6 +3,7 @@ package com.huaheng.api.erp.service; | @@ -3,6 +3,7 @@ package com.huaheng.api.erp.service; | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | import com.huaheng.api.erp.domain.*; | 5 | import com.huaheng.api.erp.domain.*; |
6 | +import com.huaheng.api.general.domain.*; | ||
6 | import com.huaheng.common.utils.AddressUtils; | 7 | import com.huaheng.common.utils.AddressUtils; |
7 | import com.huaheng.common.utils.Wrappers; | 8 | import com.huaheng.common.utils.Wrappers; |
8 | import com.google.gson.Gson; | 9 | import com.google.gson.Gson; |
@@ -10,6 +11,7 @@ import com.huaheng.common.constant.QuantityConstant; | @@ -10,6 +11,7 @@ import com.huaheng.common.constant.QuantityConstant; | ||
10 | import com.huaheng.common.exception.service.ServiceException; | 11 | import com.huaheng.common.exception.service.ServiceException; |
11 | import com.huaheng.common.support.Convert; | 12 | import com.huaheng.common.support.Convert; |
12 | import com.huaheng.common.utils.StringUtils; | 13 | import com.huaheng.common.utils.StringUtils; |
14 | +import com.huaheng.common.utils.http.HttpUtils; | ||
13 | import com.huaheng.framework.aspectj.lang.annotation.ApiLogger; | 15 | import com.huaheng.framework.aspectj.lang.annotation.ApiLogger; |
14 | import com.huaheng.framework.aspectj.lang.annotation.Ds; | 16 | import com.huaheng.framework.aspectj.lang.annotation.Ds; |
15 | import com.huaheng.framework.web.domain.AjaxResult; | 17 | import com.huaheng.framework.web.domain.AjaxResult; |
@@ -24,10 +26,7 @@ import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | @@ -24,10 +26,7 @@ import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; | ||
24 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; | 26 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
25 | import com.huaheng.pc.monitor.apilog.domain.ApiLog; | 27 | import com.huaheng.pc.monitor.apilog.domain.ApiLog; |
26 | import com.huaheng.pc.monitor.apilog.service.IApiLogService; | 28 | import com.huaheng.pc.monitor.apilog.service.IApiLogService; |
27 | -import com.huaheng.pc.monitor.job.domain.ErpInfoId; | ||
28 | -import com.huaheng.pc.monitor.job.domain.TransferParams; | ||
29 | -import com.huaheng.pc.monitor.job.domain.datas; | ||
30 | -import com.huaheng.pc.monitor.job.domain.Fentity; | 29 | +import com.huaheng.pc.monitor.job.domain.*; |
31 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; | 30 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
32 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; | 31 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
33 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | 32 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
@@ -513,6 +512,8 @@ public class TaskReturnServiceImpl implements TaskReturnService { | @@ -513,6 +512,8 @@ public class TaskReturnServiceImpl implements TaskReturnService { | ||
513 | } | 512 | } |
514 | return AjaxResult.error(erpAjaxResult.getMsg() + erpAjaxResult.getErrorMsg()); | 513 | return AjaxResult.error(erpAjaxResult.getMsg() + erpAjaxResult.getErrorMsg()); |
515 | } | 514 | } |
515 | + | ||
516 | + | ||
516 | //根据单据号查找单据详情 | 517 | //根据单据号查找单据详情 |
517 | public FDetailBill findReceiptOrShipmentByFillNo(String filId,String fbillno){ | 518 | public FDetailBill findReceiptOrShipmentByFillNo(String filId,String fbillno){ |
518 | FDetailBill result=new FDetailBill(); | 519 | FDetailBill result=new FDetailBill(); |
@@ -662,4 +663,61 @@ public class TaskReturnServiceImpl implements TaskReturnService { | @@ -662,4 +663,61 @@ public class TaskReturnServiceImpl implements TaskReturnService { | ||
662 | return AjaxResult.error(erpAjaxResult.getMsg() + erpAjaxResult.getErrorMsg()); | 663 | return AjaxResult.error(erpAjaxResult.getMsg() + erpAjaxResult.getErrorMsg()); |
663 | 664 | ||
664 | } | 665 | } |
666 | + | ||
667 | + @Override | ||
668 | + public AjaxResult toMes(ShipmentHeader shipmentHeader) { | ||
669 | + //List<ShipmentHeader> shipmentHeaderList = shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>() | ||
670 | + // .eq(ShipmentHeader::getShipmentType, "SCLLD") | ||
671 | + // .lt(ShipmentHeader::getMesErrorCount, 3) | ||
672 | + // .ne(ShipmentHeader::getMesSuccessStatus, 1) | ||
673 | + // .ne(ShipmentHeader::getMesSuccessStatus, 5) | ||
674 | + // .ge(ShipmentHeader::getLastStatus, 500) | ||
675 | + // .ge(ShipmentHeader::getFirstStatus, 500)); | ||
676 | + | ||
677 | + OrderData orderData = new OrderData(); | ||
678 | + //出库组盘明细 | ||
679 | + List<ShipmentContainerDetail> containerDetailList = shipmentContainerDetailService.list(new LambdaQueryWrapper<ShipmentContainerDetail>() | ||
680 | + .eq(ShipmentContainerDetail::getShipmentId, shipmentHeader.getId()) | ||
681 | + .eq(ShipmentContainerDetail::getMaterialIsBattery, 1)); | ||
682 | + | ||
683 | + if (containerDetailList.size() < 1) { | ||
684 | + return AjaxResult.error("没有电池类的组盘明细"); | ||
685 | + } | ||
686 | + orderData.setBatterynumber(new BigDecimal(containerDetailList.size()));//电池包数量为生成的电池包数量 | ||
687 | + List<Barcodedata> barcodedataList = new ArrayList<>(); | ||
688 | + | ||
689 | + for (int i = 0; i < containerDetailList.size(); i++) { | ||
690 | + ShipmentContainerDetail containerDetail = containerDetailList.get(i); | ||
691 | + ShipmentDetail shipmentDetail = shipmentDetailService.getById(containerDetail.getShipmentDetailId()); | ||
692 | + orderData.setOrderNo(shipmentDetail.getOrderNo()); | ||
693 | + Barcodedata barcodedata = new Barcodedata(); | ||
694 | + barcodedata.setWeight(containerDetail.getMaterialNetWeight()); | ||
695 | + barcodedata.setBatterybarcode(containerDetail.getBatteryPackTwoCode()); | ||
696 | + barcodedata.setElectricquantity(containerDetail.getElectricQuantity()); | ||
697 | + barcodedata.setMaterialBatch(containerDetail.getMaterialBatch()); | ||
698 | + barcodedataList.add(barcodedata); | ||
699 | + } | ||
700 | + orderData.setBarcodedata(barcodedataList); | ||
701 | + Content content = new Content(); | ||
702 | + content.setOrderData(orderData); | ||
703 | + ReturnErp returnErp = new ReturnErp(); | ||
704 | + returnErp.setHeader(new Header("ServicesCUS.Module_CUS.CUS_AcceptWMSBatterybarcode", "DS", "DS", "", new String[]{}, "", "zh_CN", true, "web", "")); | ||
705 | + returnErp.setContent(content); | ||
706 | + String url = addressService.selectAddress(QuantityConstant.RETURN_MES); | ||
707 | + Gson gson = new Gson(); | ||
708 | + String str = gson.toJson(returnErp); | ||
709 | + String result = HttpUtils.bodyPostApiName(url, str, "CS0001", "拆解电池包"); | ||
710 | + ReturnValue returnvalue = JSON.parseObject(result, ReturnValue.class); | ||
711 | + if (StringUtils.isEmpty(result)) { | ||
712 | + return AjaxResult.success("连接MES失败"); | ||
713 | + } | ||
714 | + shipmentHeader.setMesErrorCount(shipmentHeader.getMesErrorCount() + 1); | ||
715 | + //mes回传成功 | ||
716 | + if (returnvalue.isISSuccess() && returnvalue.getContent().isISSuccess()) { | ||
717 | + shipmentHeader.setMesSuccessStatus(1); | ||
718 | + shipmentHeaderService.updateById(shipmentHeader); | ||
719 | + return AjaxResult.success("回传成功"); | ||
720 | + } | ||
721 | + return AjaxResult.error(returnvalue.getErrorInfo()); | ||
722 | + } | ||
665 | } | 723 | } |
src/main/java/com/huaheng/api/general/controller/BasicDataApiController.java
@@ -331,12 +331,4 @@ public class BasicDataApiController extends BaseController { | @@ -331,12 +331,4 @@ public class BasicDataApiController extends BaseController { | ||
331 | List<InventoryMaterialSummary> details = inventoryMaterialSummaryService.duplicateRemoval(list); | 331 | List<InventoryMaterialSummary> details = inventoryMaterialSummaryService.duplicateRemoval(list); |
332 | return AjaxResult.success(details); | 332 | return AjaxResult.success(details); |
333 | } | 333 | } |
334 | - | ||
335 | - | ||
336 | - | ||
337 | - | ||
338 | - | ||
339 | - | ||
340 | - | ||
341 | - | ||
342 | } | 334 | } |
src/main/java/com/huaheng/api/general/controller/TaskFinshReturnController.java deleted
src/main/java/com/huaheng/pc/monitor/job/domain/ReturnValue.java
@@ -5,7 +5,6 @@ import com.huaheng.api.general.domain.Content; | @@ -5,7 +5,6 @@ import com.huaheng.api.general.domain.Content; | ||
5 | import lombok.Data; | 5 | import lombok.Data; |
6 | 6 | ||
7 | @Data | 7 | @Data |
8 | - | ||
9 | public class ReturnValue { | 8 | public class ReturnValue { |
10 | 9 | ||
11 | private boolean ISSuccess;//true:成功,false:失败 | 10 | private boolean ISSuccess;//true:成功,false:失败 |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
@@ -4,7 +4,7 @@ package com.huaheng.pc.monitor.job.task; | @@ -4,7 +4,7 @@ package com.huaheng.pc.monitor.job.task; | ||
4 | import com.alibaba.fastjson.JSON; | 4 | import com.alibaba.fastjson.JSON; |
5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
6 | import com.huaheng.api.erp.domain.FBatteryBill; | 6 | import com.huaheng.api.erp.domain.FBatteryBill; |
7 | -import com.huaheng.api.erp.service.TaskReturnServiceImpl; | 7 | +import com.huaheng.api.general.domain.ToMes; |
8 | import com.huaheng.common.support.Convert; | 8 | import com.huaheng.common.support.Convert; |
9 | import com.huaheng.common.utils.DateUtils; | 9 | import com.huaheng.common.utils.DateUtils; |
10 | import com.huaheng.common.utils.Wrappers; | 10 | import com.huaheng.common.utils.Wrappers; |
@@ -18,13 +18,10 @@ import com.huaheng.common.constant.QuantityConstant; | @@ -18,13 +18,10 @@ import com.huaheng.common.constant.QuantityConstant; | ||
18 | import com.huaheng.common.exception.service.ServiceException; | 18 | import com.huaheng.common.exception.service.ServiceException; |
19 | import com.huaheng.common.utils.StringUtils; | 19 | import com.huaheng.common.utils.StringUtils; |
20 | import com.huaheng.common.utils.http.HttpUtils; | 20 | import com.huaheng.common.utils.http.HttpUtils; |
21 | -import com.huaheng.framework.aspectj.lang.annotation.ApiLogger; | ||
22 | import com.huaheng.framework.web.controller.BaseController; | 21 | import com.huaheng.framework.web.controller.BaseController; |
23 | import com.huaheng.framework.web.domain.AjaxResult; | 22 | import com.huaheng.framework.web.domain.AjaxResult; |
24 | import com.huaheng.framework.web.service.ConfigService; | 23 | import com.huaheng.framework.web.service.ConfigService; |
25 | -import com.huaheng.pc.barcode.barcodeDetail.domain.BarCodeDetail; | ||
26 | import com.huaheng.pc.barcode.barcodeDetail.service.BarCodeDetailService; | 24 | import com.huaheng.pc.barcode.barcodeDetail.service.BarCodeDetailService; |
27 | -import com.huaheng.pc.barcode.barcodeHeader.domain.BarCodeHeader; | ||
28 | import com.huaheng.pc.barcode.barcodeHeader.service.BarCodeHeaderService; | 25 | import com.huaheng.pc.barcode.barcodeHeader.service.BarCodeHeaderService; |
29 | import com.huaheng.pc.config.address.service.AddressService; | 26 | import com.huaheng.pc.config.address.service.AddressService; |
30 | import com.huaheng.pc.config.camera.service.ICameraService; | 27 | import com.huaheng.pc.config.camera.service.ICameraService; |
@@ -45,15 +42,12 @@ import com.huaheng.pc.monitor.apilog.domain.ApiLog; | @@ -45,15 +42,12 @@ import com.huaheng.pc.monitor.apilog.domain.ApiLog; | ||
45 | import com.huaheng.pc.monitor.apilog.service.IApiLogService; | 42 | import com.huaheng.pc.monitor.apilog.service.IApiLogService; |
46 | import com.huaheng.pc.monitor.job.domain.ReturnValue; | 43 | import com.huaheng.pc.monitor.job.domain.ReturnValue; |
47 | import com.huaheng.pc.monitor.job.domain.TransferParams; | 44 | import com.huaheng.pc.monitor.job.domain.TransferParams; |
48 | -import com.huaheng.pc.monitor.job.domain.datas; | ||
49 | -import com.huaheng.pc.monitor.job.domain.Fentity; | ||
50 | import com.huaheng.pc.monitor.job.service.IJobLogService; | 45 | import com.huaheng.pc.monitor.job.service.IJobLogService; |
51 | import com.huaheng.pc.monitor.operlog.service.IOperLogService; | 46 | import com.huaheng.pc.monitor.operlog.service.IOperLogService; |
52 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; | 47 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
53 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; | 48 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
54 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; | 49 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
55 | import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; | 50 | import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; |
56 | -import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | ||
57 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; | 51 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
58 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; | 52 | import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
59 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; | 53 | import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; |
@@ -82,9 +76,6 @@ import org.springframework.stereotype.Component; | @@ -82,9 +76,6 @@ import org.springframework.stereotype.Component; | ||
82 | import javax.annotation.Resource; | 76 | import javax.annotation.Resource; |
83 | 77 | ||
84 | import java.math.BigDecimal; | 78 | import java.math.BigDecimal; |
85 | -import java.text.SimpleDateFormat; | ||
86 | -import java.time.Duration; | ||
87 | -import java.time.LocalDateTime; | ||
88 | import java.util.*; | 79 | import java.util.*; |
89 | 80 | ||
90 | /** | 81 | /** |
@@ -366,8 +357,7 @@ public class RyTask extends BaseController { | @@ -366,8 +357,7 @@ public class RyTask extends BaseController { | ||
366 | .ge(ShipmentHeader::getLastStatus, 500) | 357 | .ge(ShipmentHeader::getLastStatus, 500) |
367 | .ge(ShipmentHeader::getFirstStatus, 500)); | 358 | .ge(ShipmentHeader::getFirstStatus, 500)); |
368 | 359 | ||
369 | - OrderData orderData = null; | ||
370 | - orderData = new OrderData(); | 360 | + OrderData orderData = new OrderData(); |
371 | 361 | ||
372 | for (ShipmentHeader shipmentHeader : shipmentHeaderList) { | 362 | for (ShipmentHeader shipmentHeader : shipmentHeaderList) { |
373 | //出库详情 | 363 | //出库详情 |
src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java
@@ -405,10 +405,10 @@ public class ReceiptHeaderController extends BaseController { | @@ -405,10 +405,10 @@ public class ReceiptHeaderController extends BaseController { | ||
405 | } | 405 | } |
406 | if (!isAdmin) { | 406 | if (!isAdmin) { |
407 | if (receiptHeader.getPushSuccessStatus() == 1) { | 407 | if (receiptHeader.getPushSuccessStatus() == 1) { |
408 | - return AjaxResult.error("已回传"); | 408 | + return AjaxResult.error("已成功,不能重复回传!"); |
409 | } | 409 | } |
410 | - if (receiptHeader.getPushSuccessStatus().intValue() == 2 && receiptHeader.getPushErrorCount().intValue() >= 3) { | ||
411 | - return AjaxResult.error("回传次数超过3次"); | 410 | + if (receiptHeader.getPushSuccessStatus() == 2 && receiptHeader.getPushErrorCount() >= 3) { |
411 | + return AjaxResult.error("回传失败次数超过3次,如需要再次回传请联系管理员!"); | ||
412 | } | 412 | } |
413 | } | 413 | } |
414 | return AjaxResult.success(); | 414 | return AjaxResult.success(); |
@@ -450,7 +450,7 @@ public class ReceiptHeaderController extends BaseController { | @@ -450,7 +450,7 @@ public class ReceiptHeaderController extends BaseController { | ||
450 | 450 | ||
451 | /** | 451 | /** |
452 | * pda根据物料码或物料名称搜索出单据 | 452 | * pda根据物料码或物料名称搜索出单据 |
453 | - * @param name | 453 | + * @param |
454 | * @return | 454 | * @return |
455 | */ | 455 | */ |
456 | @PostMapping("/pdaSelectReceipt") | 456 | @PostMapping("/pdaSelectReceipt") |
src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -109,6 +109,15 @@ public class ShipmentHeaderController extends BaseController { | @@ -109,6 +109,15 @@ public class ShipmentHeaderController extends BaseController { | ||
109 | } | 109 | } |
110 | } | 110 | } |
111 | String[] str_split=substring.split(","); | 111 | String[] str_split=substring.split(","); |
112 | + | ||
113 | + //电池包生产领料单 | ||
114 | + String shipmentType=""; | ||
115 | + if (StringUtils.isNotEmpty(shipmentHeader.getShipmentType())) { | ||
116 | + shipmentType=shipmentHeader.getShipmentType(); | ||
117 | + if (shipmentHeader.getShipmentType().equals("DCB")) { | ||
118 | + shipmentType="SCLLD"; | ||
119 | + } | ||
120 | + } | ||
112 | lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), ShipmentHeader::getCreated, createdBegin) | 121 | lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), ShipmentHeader::getCreated, createdBegin) |
113 | .le(StringUtils.isNotEmpty(createdEnd), ShipmentHeader::getCreated, createdEnd) | 122 | .le(StringUtils.isNotEmpty(createdEnd), ShipmentHeader::getCreated, createdEnd) |
114 | .eq(ShipmentHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | 123 | .eq(ShipmentHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) |
@@ -117,7 +126,7 @@ public class ShipmentHeaderController extends BaseController { | @@ -117,7 +126,7 @@ public class ShipmentHeaderController extends BaseController { | ||
117 | .in(StringUtils.isNotEmpty(customer.getCode()), ShipmentHeader::getCustomerCode,str_split) | 126 | .in(StringUtils.isNotEmpty(customer.getCode()), ShipmentHeader::getCustomerCode,str_split) |
118 | //.in(StringUtils.isEmpty(shipmentHeader.getCompanyCode()), ShipmentHeader::getCompanyCode, ShiroUtils.getCompanyCodeList()) | 127 | //.in(StringUtils.isEmpty(shipmentHeader.getCompanyCode()), ShipmentHeader::getCompanyCode, ShiroUtils.getCompanyCodeList()) |
119 | .eq(StringUtils.isNotEmpty(shipmentHeader.getCode()), ShipmentHeader::getCode, shipmentHeader.getCode()) | 128 | .eq(StringUtils.isNotEmpty(shipmentHeader.getCode()), ShipmentHeader::getCode, shipmentHeader.getCode()) |
120 | - .eq(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()), ShipmentHeader::getShipmentType, shipmentHeader.getShipmentType()) | 129 | + .eq(StringUtils.isNotEmpty(shipmentType), ShipmentHeader::getShipmentType, shipmentType) |
121 | .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode()) | 130 | .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode()) |
122 | .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType()) | 131 | .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType()) |
123 | .eq(shipmentHeader.getFirstStatus() != null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus()) | 132 | .eq(shipmentHeader.getFirstStatus() != null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus()) |
@@ -129,12 +138,12 @@ public class ShipmentHeaderController extends BaseController { | @@ -129,12 +138,12 @@ public class ShipmentHeaderController extends BaseController { | ||
129 | if(StringUtils.isNotEmpty(materialCode)){ | 138 | if(StringUtils.isNotEmpty(materialCode)){ |
130 | lambdaQueryWrapper.apply(" id in(select shipmentId from shipment_detail where materialCode ='"+materialCode+"' )"); | 139 | lambdaQueryWrapper.apply(" id in(select shipmentId from shipment_detail where materialCode ='"+materialCode+"' )"); |
131 | } | 140 | } |
141 | + if(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()) && shipmentHeader.getShipmentType().equals("DCB")){ | ||
142 | + lambdaQueryWrapper.apply(" id in(select shipmentId from shipment_detail where orderNo !='')"); | ||
143 | + } | ||
132 | lambdaQueryWrapper.orderByDesc(ShipmentHeader::getId); | 144 | lambdaQueryWrapper.orderByDesc(ShipmentHeader::getId); |
133 | 145 | ||
134 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | 146 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { |
135 | - /** | ||
136 | - * 使用分页查询 | ||
137 | - */ | ||
138 | Page<ShipmentHeader> page = new Page<>(pageNum, pageSize); | 147 | Page<ShipmentHeader> page = new Page<>(pageNum, pageSize); |
139 | IPage<ShipmentHeader> iPage = shipmentHeaderService.page(page, lambdaQueryWrapper); | 148 | IPage<ShipmentHeader> iPage = shipmentHeaderService.page(page, lambdaQueryWrapper); |
140 | return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | 149 | return getMpDataTable(iPage.getRecords(), iPage.getTotal()); |
@@ -248,6 +257,56 @@ public class ShipmentHeaderController extends BaseController { | @@ -248,6 +257,56 @@ public class ShipmentHeaderController extends BaseController { | ||
248 | } | 257 | } |
249 | 258 | ||
250 | /** | 259 | /** |
260 | + * 电池包拆解(196开头物料的生成领料单回传mes) | ||
261 | + */ | ||
262 | + @PostMapping("/toMes") | ||
263 | + @RequiresPermissions("shipment:shipmentHeader:receive") | ||
264 | + @ApiOperation(value = "出库单单据完成回传mes ", notes = "出库单单据完成回传mes ", httpMethod = "POST") | ||
265 | + @Log(title = "出库-入库单 ", operating = "出库单单据完成回传mes ", action = BusinessType.OTHER) | ||
266 | + @ResponseBody | ||
267 | + public AjaxResult toMes(@ApiParam(name = "id", value = "出库头表id") Integer id) { | ||
268 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); | ||
269 | + AjaxResult result = checkToMes(shipmentHeader); | ||
270 | + if (result.getCode() != 200) { | ||
271 | + return result; | ||
272 | + } | ||
273 | + AjaxResult ajaxResult = taskReturnService.toMes(shipmentHeader); | ||
274 | + if (ajaxResult.getCode() == 200) { | ||
275 | + return AjaxResult.success("回传成功"); | ||
276 | + } | ||
277 | + return AjaxResult.error("回传MES失败:"+ajaxResult.getMsg()); | ||
278 | + } | ||
279 | + | ||
280 | + private AjaxResult checkToMes(ShipmentHeader shipmentHeader) { | ||
281 | + //判断是否是电池包的生产领料单 | ||
282 | + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentId, shipmentHeader.getId())); | ||
283 | + if (shipmentDetailList.size()==0) { | ||
284 | + return AjaxResult.error("单据没有明细!"); | ||
285 | + } | ||
286 | + String substring = shipmentDetailList.get(0).getMaterialCode().substring(0, 3); | ||
287 | + if (!"196".equals(substring)) { | ||
288 | + return AjaxResult.error("领料单不是电池包"); | ||
289 | + } | ||
290 | + //非管理员只能回传3次 | ||
291 | + Set<String> set = iRoleService.selectRoleCodes(ShiroUtils.getUserId()); | ||
292 | + Boolean isAdmin = false; | ||
293 | + for (String str : set) { | ||
294 | + if (str.equals("admin")) { | ||
295 | + isAdmin = true; | ||
296 | + } | ||
297 | + } | ||
298 | + if (!isAdmin) { | ||
299 | + if (shipmentHeader.getMesSuccessStatus() == 1) { | ||
300 | + return AjaxResult.error("已成功,不能重复回传!"); | ||
301 | + } | ||
302 | + if (shipmentHeader.getPushSuccessStatus() == 2 && shipmentHeader.getPushErrorCount() >= 3) { | ||
303 | + return AjaxResult.error("回传失败次数超过3次,如需要再次回传请联系管理员!"); | ||
304 | + } | ||
305 | + } | ||
306 | + return AjaxResult.success(); | ||
307 | + } | ||
308 | + | ||
309 | + /** | ||
251 | * 出库单据回传给ERP | 310 | * 出库单据回传给ERP |
252 | */ | 311 | */ |
253 | @PostMapping("/receive") | 312 | @PostMapping("/receive") |
@@ -278,10 +337,10 @@ public class ShipmentHeaderController extends BaseController { | @@ -278,10 +337,10 @@ public class ShipmentHeaderController extends BaseController { | ||
278 | } | 337 | } |
279 | if (!isAdmin) { | 338 | if (!isAdmin) { |
280 | if (shipmentHeader.getPushSuccessStatus() == 1) { | 339 | if (shipmentHeader.getPushSuccessStatus() == 1) { |
281 | - return AjaxResult.error("已回传"); | 340 | + return AjaxResult.error("已成功,不能重复回传!"); |
282 | } | 341 | } |
283 | - if (shipmentHeader.getPushSuccessStatus().intValue() == 2 && shipmentHeader.getPushErrorCount().intValue() >= 3) { | ||
284 | - return AjaxResult.error("回传次数超过3次"); | 342 | + if (shipmentHeader.getPushSuccessStatus() == 2 && shipmentHeader.getPushErrorCount() >= 3) { |
343 | + return AjaxResult.error("回传失败次数超过3次,如需要再次回传请联系管理员!"); | ||
285 | } | 344 | } |
286 | } | 345 | } |
287 | return AjaxResult.success(); | 346 | return AjaxResult.success(); |
@@ -316,24 +375,6 @@ public class ShipmentHeaderController extends BaseController { | @@ -316,24 +375,6 @@ public class ShipmentHeaderController extends BaseController { | ||
316 | 375 | ||
317 | 376 | ||
318 | /** | 377 | /** |
319 | - * 订单分析 | ||
320 | - */ | ||
321 | -// @RequiresPermissions("shipment:bill:edit") | ||
322 | -// @Log(title = "出库-出库单", operating="订单分析", action = BusinessType.OTHER) | ||
323 | -// @PostMapping( "/analysis") | ||
324 | -// @ResponseBody | ||
325 | -// @Transactional | ||
326 | -// public void analysis(String ids){ | ||
327 | -// if (StringUtils.isEmpty(ids)) | ||
328 | -// throw new ServiceException("id不能为空"); | ||
329 | -// for (Integer id : Convert.toIntArray(ids)) | ||
330 | -// { | ||
331 | -// | ||
332 | -// } | ||
333 | -// | ||
334 | -// } | ||
335 | - | ||
336 | - /** | ||
337 | * 加入波次 | 378 | * 加入波次 |
338 | */ | 379 | */ |
339 | @GetMapping("/wave") | 380 | @GetMapping("/wave") |
src/main/java/com/huaheng/pc/shipment/shipmentHeader/domain/ShipmentHeader.java
@@ -110,7 +110,7 @@ public class ShipmentHeader implements Serializable { | @@ -110,7 +110,7 @@ public class ShipmentHeader implements Serializable { | ||
110 | private Integer firstStatus; | 110 | private Integer firstStatus; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | - * 拖状态 | 113 | + * 头状态 |
114 | */ | 114 | */ |
115 | @TableField(value = "lastStatus") | 115 | @TableField(value = "lastStatus") |
116 | @ApiModelProperty(value = "拖状态") | 116 | @ApiModelProperty(value = "拖状态") |
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
@@ -329,7 +329,7 @@ | @@ -329,7 +329,7 @@ | ||
329 | // if (row.firstStatus == 300 && row.lastStatus == 300 &&receiptType=='SCRKD') { | 329 | // if (row.firstStatus == 300 && row.lastStatus == 300 &&receiptType=='SCRKD') { |
330 | // actions.push('<a class="btn btn-info btn-xs ' + receiveFlag + '" href="#" onclick="receive(\''+row.id+'\')"><i class="fa fa-upload"></i>成品入库回传erp</a>'); | 330 | // actions.push('<a class="btn btn-info btn-xs ' + receiveFlag + '" href="#" onclick="receive(\''+row.id+'\')"><i class="fa fa-upload"></i>成品入库回传erp</a>'); |
331 | // } | 331 | // } |
332 | - if (row.firstStatus == 800 && row.lastStatus == 800 && row.receiptType!='CPRK') { | 332 | + if (row.firstStatus == 800 && row.lastStatus == 800 && row.receiptType!='CPRK' && row.pushSuccessStatus=='0' && row.pushSuccessStatus=='2') { |
333 | actions.push('<a class="btn btn-warning btn-xs ' + receiveFlag + '" href="#" onclick="receive(\''+row.id+'\')"><i class="fa fa-upload"></i>回传</a>'); | 333 | actions.push('<a class="btn btn-warning btn-xs ' + receiveFlag + '" href="#" onclick="receive(\''+row.id+'\')"><i class="fa fa-upload"></i>回传</a>'); |
334 | } | 334 | } |
335 | if (row.firstStatus >= 200 && row.lastStatus < 800) { | 335 | if (row.firstStatus >= 200 && row.lastStatus < 800) { |
src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
@@ -242,10 +242,10 @@ | @@ -242,10 +242,10 @@ | ||
242 | shiro:hasPermission="shipment:shippingCombination:combination"> | 242 | shiro:hasPermission="shipment:shippingCombination:combination"> |
243 | <i class="fa fa-hand-lizard-o"></i> 组盘 | 243 | <i class="fa fa-hand-lizard-o"></i> 组盘 |
244 | </a> | 244 | </a> |
245 | - <a class="btn btn-outline btn-primary btn-rounded auto-shipment" onclick="Toshipping(1)" | ||
246 | - shiro:hasPermission="shipment:shippingCombination:combination"> | ||
247 | - <i class="fa fa-code-fork"></i> 自动组盘 | ||
248 | - </a> | 245 | + <a class="btn btn-outline btn-primary btn-rounded auto-shipment" onclick="Toshipping(1)" |
246 | + shiro:hasPermission="shipment:shippingCombination:combination"> | ||
247 | + <i class="fa fa-code-fork"></i> 自动组盘 | ||
248 | + </a> | ||
249 | <!-- <a class="btn btn-outline btn-primary btn-rounded auto-shipment-task" onclick="Toshipping(2)"--> | 249 | <!-- <a class="btn btn-outline btn-primary btn-rounded auto-shipment-task" onclick="Toshipping(2)"--> |
250 | <!-- shiro:hasPermission="shipment:shippingCombination:combination">--> | 250 | <!-- shiro:hasPermission="shipment:shippingCombination:combination">--> |
251 | <!-- <i class="fa fa-code-fork"></i> 自动组盘并生成任务--> | 251 | <!-- <i class="fa fa-code-fork"></i> 自动组盘并生成任务--> |
@@ -320,6 +320,24 @@ | @@ -320,6 +320,24 @@ | ||
320 | } | 320 | } |
321 | }, | 321 | }, |
322 | { | 322 | { |
323 | + field: 'mesSuccessStatus', | ||
324 | + title: '回传MES', | ||
325 | + align: 'center', | ||
326 | + formatter: function(value, row, index) { | ||
327 | + console.log(row) | ||
328 | + if(value!==undefined &&row.shipmentType==='SCLLD'){ | ||
329 | + if(value===0){ | ||
330 | + return '<span style="color:black">未回传</span>' | ||
331 | + }else if(value===1){ | ||
332 | + return '<span style="color:green">回传成功</span>' | ||
333 | + }else if(value===2 ) { | ||
334 | + return '<span style="color:#b90e0e">回传失败</span>' | ||
335 | + } | ||
336 | + } | ||
337 | + return ''; | ||
338 | + } | ||
339 | + }, | ||
340 | + { | ||
323 | title: '操作', | 341 | title: '操作', |
324 | // align: 'center', | 342 | // align: 'center', |
325 | align: 'left', | 343 | align: 'left', |
@@ -335,8 +353,12 @@ | @@ -335,8 +353,12 @@ | ||
335 | if (row.firstStatus < 100) { | 353 | if (row.firstStatus < 100) { |
336 | actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); | 354 | actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
337 | } | 355 | } |
338 | - if (row.firstStatus == 500 && row.lastStatus == 500) { | ||
339 | - actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="receive(\'' + row.id + '\')"><i class="fa fa-upload"></i>回传</a>'); | 356 | + if (row.firstStatus == 500 && row.lastStatus == 500 && row.pushSuccessStatus=='0' || row.pushSuccessStatus=='2' ) { |
357 | + actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="receive(\'' + row.id + '\')"><i class="fa fa-external-link"></i>回传ERP</a>'); | ||
358 | + } | ||
359 | + | ||
360 | + if (row.firstStatus == 500 && row.lastStatus == 500 && row.shipmentType=='SCLLD' && row.mesSuccessStatus=='0'|| row.mesSuccessStatus=='2') { | ||
361 | + actions.push('<a style="margin-left: 5px;background-color: #54b095" class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="toMes(\'' + row.id + '\')"><i class="fa fa-external-link"></i>回传MES</a>'); | ||
340 | } | 362 | } |
341 | return actions.join(''); | 363 | return actions.join(''); |
342 | } | 364 | } |
@@ -553,14 +575,11 @@ | @@ -553,14 +575,11 @@ | ||
553 | { | 575 | { |
554 | title: '操作', | 576 | title: '操作', |
555 | align: 'center', | 577 | align: 'center', |
556 | - formatter: function (value, row, index) { | 578 | + events:'operateEvents', |
579 | + formatter: function(value, row, index) { | ||
557 | var actions = []; | 580 | var actions = []; |
558 | - if (row.status < 100) { | ||
559 | - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); | ||
560 | - } | ||
561 | - if (row.firstStatus == 500 && row.lastStatus == 500) { | ||
562 | - actions.push('<a class="btn btn-info btn-xs ' + receiveFlag + '" href="#" onclick="receive(\'' + row.id + '\')"><i class="fa fa-upload"></i>回传</a>'); | ||
563 | - } | 581 | + actions.push('<a id="table_edit" class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
582 | + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); | ||
564 | return actions.join(''); | 583 | return actions.join(''); |
565 | } | 584 | } |
566 | }, | 585 | }, |
@@ -601,8 +620,12 @@ | @@ -601,8 +620,12 @@ | ||
601 | title: '库存数量' | 620 | title: '库存数量' |
602 | }, | 621 | }, |
603 | { | 622 | { |
604 | - field: 'grossWeight', | ||
605 | - title: '毛重(kg)', | 623 | + field: 'orderNo', |
624 | + title: '工单号', | ||
625 | + }, | ||
626 | + { | ||
627 | + field: 'batteryPackTwoCode', | ||
628 | + title: '电池包号', | ||
606 | }, | 629 | }, |
607 | { | 630 | { |
608 | field: 'tareWeight', | 631 | field: 'tareWeight', |
@@ -870,6 +893,12 @@ | @@ -870,6 +893,12 @@ | ||
870 | $.operate.submit(url, "post", "json", data); | 893 | $.operate.submit(url, "post", "json", data); |
871 | } | 894 | } |
872 | 895 | ||
896 | + function toMes(id) { | ||
897 | + var url = prefix + "/toMes"; | ||
898 | + var data = {"id": id}; | ||
899 | + $.operate.submit(url, "post", "json", data); | ||
900 | + } | ||
901 | + | ||
873 | /* 编辑明细单据 */ | 902 | /* 编辑明细单据 */ |
874 | function edit(id) { | 903 | function edit(id) { |
875 | if (shipmentId == '') { | 904 | if (shipmentId == '') { |