diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index 764ee92e..9a5b2bcf 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -664,6 +664,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where mrw.parent_order = '0' and mrw.workorder_code = #{workorderCode} and mrw.del_flag = '0' and po.del_flag = '0' + order by mrw.batch - + select qum.user_code userCode, + qum.user_name userName + from qc_user_material qum + left join pro_order_workorder pow on pow.workorder_code = qum.material_code + where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and qum.del_flag = '0' diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index d8bbab66..9378f944 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -286,6 +286,8 @@ public class ProOrderController extends BaseController { } /** * 下发生产工单。workorderIds:母工单号 + * 如果改成复选,需要考虑很多中订单组合情况 + * 所以尽量不要动 */ @RequiresPermissions("mes:pro:order:edit") @Log(title = "关闭订单", businessType = BusinessType.OTHER) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java index 0b0807e6..aff63cb2 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderMapper.java @@ -234,4 +234,6 @@ public interface ProOrderMapper { void updateOrderStatusCompleteByOrderCode(String orderCode); void addSapLog(SysSapLog sysSapLog); + + int updateCloseOrderBatchById(@Param("orderIds")String[] orderIds); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 057509dc..19098c91 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -192,5 +192,7 @@ public interface ProOrderWorkorderMapper { int deletePrepareDetailBatch(@Param("workorders")List workorders); List getOrderNotW0(@Param("workorderCodes") String[] workorderCodes); + + List getOrderByOrders(@Param("orderIds") String[] orderIds); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 9626a0fa..52ad1800 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -1093,7 +1093,16 @@ public class ProOrderServiceImpl implements IProOrderService { @DS("#header.poolName") @Transactional(rollbackFor = Exception.class) public int deleteOrder(String[] orderIds) { - //可以进行订单关闭的数据 + + //未拆分,直接关闭订单 + List checkOrders = proOrderWorkorderMapper.getOrderByOrders(orderIds); + if(!CollectionUtils.isEmpty(checkOrders)){ + int m0 = proOrderMapper.deleteProOrderByIds(orderIds); + logger.info(orderIds[0]+"删除订单m0:"+m0); + return 1; + } + + //已经存在工单可以进行订单关闭的数据 List checkWorkOrders = proOrderWorkorderMapper.getWorkOrderByOrders(orderIds); if(checkWorkOrders.size() != orderIds.length){ return 2; @@ -1138,33 +1147,27 @@ public class ProOrderServiceImpl implements IProOrderService { closeR.getCode()+","+ closeR.getMsg()+","+ closeR.getData()); - //if(closeR.getCode()==200){ - String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]); - if (workorderIds.length > 0) { - //删除工单(字母)pro_order_workorder - int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds); - logger.info(workorderCodes.get(0)+"删除订单m1:"+m1); - //删除批次pro_order_workorder_batch - int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds); - logger.info(workorderCodes.get(0)+"删除订单m2:"+m2); - //删除领料单mes_prepare - int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes); - logger.info(workorderCodes.get(0)+"删除订单m3:"+m3); - //删除领料单明细mes_prepare_detail - int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes); - logger.info(workorderCodes.get(0)+"删除订单m4:"+m4); - } + String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]); + if (workorderIds.length > 0) { + //删除工单(字母)pro_order_workorder + int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds); + logger.info(workorderCodes.get(0)+"删除订单m1:"+m1); + //删除批次pro_order_workorder_batch + int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds); + logger.info(workorderCodes.get(0)+"删除订单m2:"+m2); + //删除领料单mes_prepare + int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes); + logger.info(workorderCodes.get(0)+"删除订单m3:"+m3); + //删除领料单明细mes_prepare_detail + int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes); + logger.info(workorderCodes.get(0)+"删除订单m4:"+m4); + } - if (!CollectionUtils.isEmpty(workers)) { - //删除订单pro_order - int m5 = proOrderMapper.updateCloseOrderBatch(workers); - logger.info(workorderCodes.get(0)+"删除订单m5:"+m5); - } -// }else{ -// logger.info(workorder.getWorkorderCode()+"删除订单后关闭订单sap返回结果:"+ -// JSONObject.toJSONString(closeR)); -// return 0; -// } + if (!CollectionUtils.isEmpty(workers)) { + //删除订单pro_order + int m5 = proOrderMapper.updateCloseOrderBatch(workers); + logger.info(workorderCodes.get(0)+"删除订单m5:"+m5); + } } return 1; } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index 0612fdb9..679f9847 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -379,6 +379,14 @@ update pro_order set status = 'o2' where parent_order = #{orderCode} and del_flag = '0' + + update pro_order + set del_flag = '1' + where id in + + #{id} + + update pro_order diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 948cf41d..abf3252d 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -534,6 +534,15 @@ and pow.status in ('w0') and pow.del_flag = '0' + insert into mes_prepare_detail diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java index 3cf1903f..6be4541a 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDefect.java @@ -74,6 +74,8 @@ public class QcCheckTaskDefect extends BaseEntity { @Excel(name = "检验任务id") private String belongTo; + private String belongToDetail; + /** * 合格数量 */ @@ -86,6 +88,14 @@ public class QcCheckTaskDefect extends BaseEntity { @Excel(name = "不合格数量") private BigDecimal noOkQuality; + public String getBelongToDetail() { + return belongToDetail; + } + + public void setBelongToDetail(String belongToDetail) { + this.belongToDetail = belongToDetail; + } + public void setRecordId(String recordId) { this.recordId = recordId; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java index 1aac1cf1..e2193604 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskDetail.java @@ -135,6 +135,33 @@ public class QcCheckTaskDetail extends BaseEntity { private String fileListStr; private List files; private List fileUrls; + private String defectCodes; + private String defectNames; + private String defectQualitys; + + public String getDefectCodes() { + return defectCodes; + } + + public void setDefectCodes(String defectCodes) { + this.defectCodes = defectCodes; + } + + public String getDefectNames() { + return defectNames; + } + + public void setDefectNames(String defectNames) { + this.defectNames = defectNames; + } + + public String getDefectQualitys() { + return defectQualitys; + } + + public void setDefectQualitys(String defectQualitys) { + this.defectQualitys = defectQualitys; + } public List getFileUrls() { return fileUrls; diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java index be2987fd..f2792672 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcCheckTaskIncomeMapper.java @@ -90,6 +90,8 @@ public interface QcCheckTaskIncomeMapper { List getUserByMaterial(String materialCode); + List getCheckUsers(String orderNo); + int addCheckUsers(@Param("list") List users); int addQcCheckTaskDefects(@Param("list") List defects); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportProduceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportProduceServiceImpl.java index a18e95e8..ce3e22e3 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportProduceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckReportProduceServiceImpl.java @@ -19,10 +19,7 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -215,6 +212,7 @@ public class QcCheckReportProduceServiceImpl implements IQcCheckReportProduceSer if(StringUtils.isNotBlank(produce.getIncomeBatchNo())){ List batchNos = Arrays.asList(produce.getIncomeBatchNo().split(";")); List disBatchNos = batchNos.stream().distinct().collect(Collectors.toList()); + Collections.sort(disBatchNos); produce.setIncomeBatchNo(StringUtils.join(disBatchNos, ";")); } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java index 859c39d3..71992ffa 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskIncomeServiceImpl.java @@ -214,7 +214,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { qcCheckTaskIncome.setCheckManName(""); qcCheckTaskIncome.setCheckManCode(""); /**qc_user_material取默认检查人**/ - List users = qcCheckTaskIncomeMapper.getUserByMaterial(qcCheckTaskIncome.getMaterialCode()); + List users = qcCheckTaskIncomeMapper.getCheckUsers(qcCheckTaskIncome.getOrderNo()); if(CollectionUtils.isEmpty(users)){ QcUserMaterialDTO dto0 = new QcUserMaterialDTO(); dto0.setId(IdUtils.fastSimpleUUID()); @@ -599,7 +599,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService { break; } } - + //TODO;today int n = 0; QcCheckTaskIncome qcCheckTask = new QcCheckTaskIncome(); qcCheckTask.setUpdateBy(updateBy); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskInventoryServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskInventoryServiceImpl.java index c2bd2478..93630137 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskInventoryServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskInventoryServiceImpl.java @@ -176,23 +176,6 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer } //检验人插入 qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList); - } else {//上位机 - qcCheckTaskInventory.setCheckManName(""); - qcCheckTaskInventory.setCheckManCode(""); - /**qc_user_material取默认检查人**/ - List users = qcCheckTaskIncomeMapper.getUserByMaterial(qcCheckTaskInventory.getMaterialCode()); - if (!CollectionUtils.isEmpty(users)) { - for (QcUserMaterialDTO user : users) { - user.setId(IdUtils.fastSimpleUUID()); - user.setBelongTo(beLongId); - user.setCheckNo(qcCheckTaskInventory.getCheckNo()); - user.setCreateBy(createBy); - user.setFactoryCode(factoryCode); - user.setCreateTime(nowDate); - } - int m = qcCheckTaskIncomeMapper.addCheckUsers(users); - logger.info("检查人新增" + m + "成功"); - } } /** 不良品数据插入 */ BigDecimal noOkQuality = new BigDecimal(0); diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskMarketServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskMarketServiceImpl.java index d250d743..bad68a89 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskMarketServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskMarketServiceImpl.java @@ -173,23 +173,6 @@ public class QcCheckTaskMarketServiceImpl implements IQcCheckTaskMarketService { } //检验人插入 qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList); - } else {//上位机 - qcCheckTaskMarket.setCheckManName(""); - qcCheckTaskMarket.setCheckManCode(""); - /**qc_user_material取默认检查人**/ - List users = qcCheckTaskIncomeMapper.getUserByMaterial(qcCheckTaskMarket.getMaterialCode()); - if (!CollectionUtils.isEmpty(users)) { - for (QcUserMaterialDTO user : users) { - user.setId(IdUtils.fastSimpleUUID()); - user.setBelongTo(beLongId); - user.setCheckNo(qcCheckTaskMarket.getCheckNo()); - user.setCreateBy(createBy); - user.setFactoryCode(factoryCode); - user.setCreateTime(nowDate); - } - int m = qcCheckTaskIncomeMapper.addCheckUsers(users); - logger.info("检查人新增" + m + "成功"); - } } /** 不良品数据插入 */ if(qcCheckTaskMarket.getNoOkQuality()==null){ diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java index cb363579..207d4d59 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java @@ -204,7 +204,7 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService qcCheckTaskProduce.setCheckManName(""); qcCheckTaskProduce.setCheckManCode(""); /**qc_user_material取默认检查人**/ - List users = qcCheckTaskIncomeMapper.getUserByMaterial(qcCheckTaskProduce.getMaterialCode()); + List users = qcCheckTaskIncomeMapper.getCheckUsers(qcCheckTaskProduce.getOrderNo()); if(!CollectionUtils.isEmpty(users)){ for(QcUserMaterialDTO user:users){ user.setId(IdUtils.fastSimpleUUID()); diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml index 0d0597c1..c6c1bbfd 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskIncomeMapper.xml @@ -338,9 +338,16 @@ +