diff --git a/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java b/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java new file mode 100644 index 00000000..0376f294 --- /dev/null +++ b/common/src/main/java/com/foreverwin/mesnac/common/dto/LabelPrintDto.java @@ -0,0 +1,151 @@ +package com.foreverwin.mesnac.common.dto; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 标签打印参数类 + * + */ +public class LabelPrintDto implements Serializable { + + private String site; + private String user; + //打印机 + private String printer; + //打印模板名称 + private String printTemplate; + //物料编码 + private String item; + //物料描述 + private String itemDescription; + //供应商 + private String supplier; + //批次号 + private String batch; + + //工作指令 + private String workOrder; + //图纸版本号 + private String drawingVersion; + //产品条码 + private String sfc; + //数量 + private BigDecimal qty; + //下料尺寸 + private String blankingSize; + //下道工序 + private String operation; + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPrinter() { + return printer; + } + + public void setPrinter(String printer) { + this.printer = printer; + } + + public String getPrintTemplate() { + return printTemplate; + } + + public void setPrintTemplate(String printTemplate) { + this.printTemplate = printTemplate; + } + + public String getItem() { + return item; + } + + public void setItem(String item) { + this.item = item; + } + + public String getItemDescription() { + return itemDescription; + } + + public void setItemDescription(String itemDescription) { + this.itemDescription = itemDescription; + } + + public String getSupplier() { + return supplier; + } + + public void setSupplier(String supplier) { + this.supplier = supplier; + } + + public String getBatch() { + return batch; + } + + public void setBatch(String batch) { + this.batch = batch; + } + + public String getWorkOrder() { + return workOrder; + } + + public void setWorkOrder(String workOrder) { + this.workOrder = workOrder; + } + + public String getDrawingVersion() { + return drawingVersion; + } + + public void setDrawingVersion(String drawingVersion) { + this.drawingVersion = drawingVersion; + } + + public String getSfc() { + return sfc; + } + + public void setSfc(String sfc) { + this.sfc = sfc; + } + + public BigDecimal getQty() { + return qty; + } + + public void setQty(BigDecimal qty) { + this.qty = qty; + } + + public String getBlankingSize() { + return blankingSize; + } + + public void setBlankingSize(String blankingSize) { + this.blankingSize = blankingSize; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String operation) { + this.operation = operation; + } +} diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java index 7c35ed72..08f017d8 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/PrintLogServiceImpl.java @@ -2,8 +2,11 @@ package com.foreverwin.mesnac.common.service.impl; import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONString; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.foreverwin.mesnac.common.dto.LabelPrintDto; import com.foreverwin.mesnac.common.model.PrintLog; import com.foreverwin.mesnac.common.mapper.PrintLogMapper; import com.foreverwin.mesnac.common.service.PrintLogService; @@ -15,6 +18,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; /** @@ -54,16 +58,16 @@ public class PrintLogServiceImpl extends ServiceImpl i return; } - - JSONArray jsonArray = new JSONArray(); + List labelPrintDtoList = new ArrayList<>(); for (PrintLog printLog : printList) { - JSONObject _json = new JSONObject(); - _json.put("PRINTER", printLog.getPrintName()); - _json.put("PRINT_TEMPLATE", printLog.getPrintTemplate()); - _json.put("PRINT_PARAM", printLog.getPrintParam()); - jsonArray.add(_json); + LabelPrintDto labelPrintDto = new LabelPrintDto(); + labelPrintDto.setPrinter(printLog.getPrintName()); + labelPrintDto.setPrintTemplate(printLog.getPrintTemplate()); + labelPrintDto.setItem(printLog.getItem()); + labelPrintDto.setItemDescription(printLog.getItemDescription()); + labelPrintDtoList.add(labelPrintDto); } - HttpUtil.post(printServer, jsonArray.toJSONString(), 30000); + HttpUtil.post(printServer, JSON.toJSONString(labelPrintDtoList), 30000); } } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java index 11f668f7..df56abf3 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java @@ -69,6 +69,12 @@ public class CallItemController { List result; try { callItem.setSite(CommonMethods.getSite()); + if (callItem.getRequireFromDate_S() != null) { + callItem.setRequireFromDate(DateUtil.parse(callItem.getRequireFromDate_S())); + } + if (callItem.getRequireToDate_S() != null) { + callItem.setRequireToDate(DateUtil.parse(callItem.getRequireToDate_S())); + } if (callItem.getStartFromDate_S() != null) { callItem.setStartFromDate(DateUtil.parse(callItem.getStartFromDate_S())); } diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java index 06adb248..856b1f63 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java @@ -95,7 +95,7 @@ public class CallItemServiceImpl extends ServiceImpl i for (int i = 0; i< callItemList.size(); i++) { CallItem callItem = callItemList.get(i); String component = StringUtil.trimHandle(callItem.getComponentBo()); - String callItemNo = callItem.getSfc() + component; + String callItemNo = callItem.getSfc() + callItem.getStepId() + component; callItem.setCallItemNo(callItemNo); callItem.setHandle(HandleEnum.CALL_ITEM.getHandle(site, callItemNo)); diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java index cc09551b..9a7f9a18 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java @@ -145,7 +145,7 @@ public class IssueItemServiceImpl extends ServiceImpl list = callItemService.findIssueMatchCallItemList(site, workOrder, blankingSize, resource, item); if (list == null || list.size() <= 0) { - throw BusinessException.build("根据发料数据未找到发料记录!"); + throw BusinessException.build("未找到当前物料对应的叫料记录!"); } BigDecimal remainQty = new BigDecimal(qty); diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index bb7ab6b0..5aa8cb75 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -316,8 +316,6 @@ public class SfcDispatchServiceImpl extends ServiceImpl + AND ZSD.DISPATCH_NO = #{dispatchNo} + AND ZSD.WORK_CENTER = #{workCenter} @@ -815,16 +818,16 @@ ORDER BY ZSD.SFC, ZSD.STEP_ID, ZCI.CALL_TYPE - - MODIFY Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} + + UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} WHERE STATUS != '804' AND SFC_DISPATCH_BO IN #{item.sfcDispatchBo} - - MODIFY Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} + + UPDATE Z_CALL_ITEM SET STATUS = #{status}, MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime} WHERE STATUS != '804' AND CALL_ITEM_NO IN #{item} @@ -832,7 +835,7 @@ - MODIFY Z_CALL_ITEM SET MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = ( + UPDATE Z_CALL_ITEM SET MODIFY_USER = #{user}, MODIFIED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = ( SELECT ZSD.PLANNED_START_DATE FROM Z_SFC_DISPATCH ZSD WHERE Z_CALL_ITEM.SFC_DISPATCH_BO = ZSD.HANDLE @@ -850,8 +853,11 @@ INNER JOIN ITEM M ON B.COMPONENT_BO = M.HANDLE INNER JOIN SHOP_ORDER Z ON Z.SITE = B.SITE AND Z.SHOP_ORDER = B.SHOP_ORDER LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = Z.HANDLE AND CF."ATTRIBUTE" = 'WORK_ORDER' - WHERE B.SITE = #{site} AND M.ITEM = #{item} AND P.BLANKING_SIZE = #{blankingSize} + WHERE B.SITE = #{site} AND M.ITEM = #{item} AND (B.ISSUE_QTY IS NULL OR B.ISSUE_QTY < B.REQUIRED_QTY) + + AND P.BLANKING_SIZE = #{blankingSize} + AND CF.VALUE = #{workOrder} diff --git a/meapi/src/main/resources/mapper/SfcMapper.xml b/meapi/src/main/resources/mapper/SfcMapper.xml index 454a9683..47cda5a3 100644 --- a/meapi/src/main/resources/mapper/SfcMapper.xml +++ b/meapi/src/main/resources/mapper/SfcMapper.xml @@ -656,7 +656,7 @@ LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh' INNER JOIN SFC_ROUTING SG ON SG.SFC_BO = SC.HANDLE INNER JOIN SFC_ROUTER SR ON SR.SFC_ROUTING_BO = SG.HANDLE AND SR.IN_USE = 'true' - INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE + INNER JOIN SFC_STEP SP ON SP.SFC_ROUTER_BO = SR.HANDLE AND (SP.QTY_IN_QUEUE > 0 OR SP.QTY_IN_WORK > 0) INNER JOIN OPERATION OP ON SP.OPERATION_BO = 'OperationBO:'||OP.SITE||','||OP.OPERATION||',#' AND OP.CURRENT_REVISION = 'true' LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh' LEFT JOIN Z_SFC_DISPATCH ZSD ON ZSD.SITE = SC.SITE AND ZSD.SFC = SC.SFC AND ZSD.OPERATION = OP.OPERATION AND ZSD.STEP_ID = SP.STEP_ID