From 6ee9d58d62dbbccf95ce809f358ec9f8d088b705 Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期五, 17 十一月 2023 09:16:16 +0800 Subject: [PATCH] Changes15 websocket --- mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java | 95 ++++++++++++++++++++--------------------------- 1 files changed, 41 insertions(+), 54 deletions(-) diff --git a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java index 085c240..01b4adc 100644 --- a/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java +++ b/mes-plan/src/main/java/com/chinaztt/mes/plan/service/impl/CustomerOrderServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.BooleanUtil; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import com.alibaba.excel.EasyExcel; @@ -37,7 +36,6 @@ import com.chinaztt.mes.common.oa.OAResult; import com.chinaztt.mes.common.util.StateResult; import com.chinaztt.mes.common.util.WechatMsgTips; -import com.chinaztt.mes.common.util.easyexcel.EasyExcelUtils; import com.chinaztt.mes.common.wechat.WechatProperty; import com.chinaztt.mes.plan.dto.*; import com.chinaztt.mes.plan.entity.*; @@ -95,10 +93,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; -import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -196,7 +194,7 @@ private final static String AFFILIATED_CONTRACT = "涓ぉ娉ㄥ鍘�"; - + //private FileSaveUtil fileSaveUtil; @Override public void otcDownload(Long id, HttpServletResponse response) { @@ -259,8 +257,9 @@ private void changeAudit(CustomerOrder customerOrder, String isAudit) { //瀹℃牳鐘舵�� 閫氳繃 璁㈠崟鐘舵�佸緟璁″垝 if (isAudit.equals(AuditStateStringValues.ACCEPTED)) { + //TODO: 瑕佸姞闆朵欢id鍙傛暟 Document document = documentMapper.selectById(customerOrder.getTechnologyDocumentId()); - Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getEngChgLevel, "1").eq(Part::getPartNo, customerOrder.getPartNo())); + Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getEngChgLevel, "1").eq(Part::getId,customerOrder.getPartId() )); if (null == part) { throw new RuntimeException("鏍规嵁闆朵欢缂栧彿 = 銆�" + customerOrder.getPartNo() + "銆慚ES鏈湴鏌ユ棤鍖归厤闆朵欢瀵硅薄"); } @@ -288,42 +287,17 @@ @Override - public R fullUpdate(CustomerOrderDTO customerOrderDTO) { - List<String> unitWhitMapList = customerOrderUnitWhiteListConfig.getUnitWhitListMap(); - String unitConcat = customerOrderDTO.getOtcUnit() + "_" + customerOrderDTO.getIfsSalesUnit(); - if (!customerOrderDTO.getOtcUnit().equals(customerOrderDTO.getIfsSalesUnit()) && !unitWhitMapList.contains(unitConcat)) { - //濡傛灉閿�鍞崟浣嶅拰ifs涓攢鍞崟浣嶄笉涓�鏍峰垯涓嶇粰淇濆瓨A - return R.failed("璁㈠崟琛岄攢鍞崟浣嶅拰閿�鍞欢閿�鍞閲忓崟浣嶄笉涓�鑷村苟涓旂櫧鍚嶅崟涓笉瀛樺湪瀵瑰簲鍏崇郴"); - } else { - if (StringUtils.isNotBlank(customerOrderDTO.getPartNo())) { - Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, customerOrderDTO.getPartNo())); - if (null == part) { - throw new RuntimeException("鏍规嵁闆朵欢缂栧彿 = 銆�" + customerOrderDTO.getPartNo() + "銆慚ES鏈湴鏌ユ棤鍖归厤闆朵欢瀵硅薄"); - } - } - if (StringUtils.isNotBlank(customerOrderDTO.getSalesPartNo())) { - Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, customerOrderDTO.getSalesPartNo())); - if (null == part) { - throw new RuntimeException("鏍规嵁閿�鍞欢缂栧彿 = 銆�" + customerOrderDTO.getSalesPartNo() + "銆慚ES鏈湴鏌ユ棤鍖归厤闆朵欢瀵硅薄"); - } - } - // 濡傛灉閿�鍞浂浠跺彿鏈慨鏀癸紝otc鍚屾鐘舵�佷笉闇�瑕佹洿鏂� - CustomerOrder oriCustomerOrder = customerOrderMapper.selectById(customerOrderDTO.getId()); - if (!org.apache.commons.lang3.StringUtils.equals(oriCustomerOrder.getSalesPartNo(), - customerOrderDTO.getSalesPartNo())) { - customerOrderDTO.setOtcPartSync(false); - } - //mes鏁伴噺 = 璁㈠崟鏁伴噺 * 鍥犲瓙 - Assert.notNull(customerOrderDTO.getIfsConvFactor(), "璇烽�夋嫨閿�鍞浂浠跺彿"); - customerOrderDTO.setBuyQtyDue(customerOrderDTO.getIfsConvFactor().multiply(customerOrderDTO.getOtcQuantity())); - if (BooleanUtil.isTrue(customerOrderDTO.getIsDocument())) { - customerOrderDTO.setCoState(CustomerOrderStateStringValues.PLAN); - } else { - customerOrderDTO.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK); - } - updateById(customerOrderDTO); - return R.ok(); - } + public R fullUpdate(CustomerOrderVO1 customerOrderVO1) { + CustomerOrder customerOrder = new CustomerOrder(); + BeanUtils.copyProperties(customerOrderVO1,customerOrder); + customerOrder.setId(customerOrderVO1.getId()); + customerOrderMapper.updateById(customerOrder); + + Customer customer = new Customer(); + BeanUtils.copyProperties(customerOrderVO1,customer); + customer.setId(customerOrderMapper.selectById(customerOrderVO1.getId()).getCustomerId()); + customerMapper.updateById(customer); + return R.ok("淇敼鎴愬姛!"); } @Override @@ -398,18 +372,28 @@ // } //淇濆瓨涓荤敓浜ц鍒� MasterProductionSchedule masterProductionSchedule = new MasterProductionSchedule(); + //涓荤敓浜ц鍒掑彿 masterProductionSchedule.setMpsNo(scheduleNumberGenerator.generateNumberWithPrefix(MasterProductionSchedule.DIGIT, MasterProductionSchedule.PREFIX, MasterProductionSchedule::getMpsNo)); - masterProductionSchedule.setPartId(customerOrderDTO.getPartId()); + Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, customerOrderDTO.getPartNo())); + //闆朵欢id + masterProductionSchedule.setPartId(part.getId()); //灏嗗鏍哥姸鎬佸拰宸ヨ壓鏂囦欢鐨刬d鍚屾缁欑敓浜ц鍒� masterProductionSchedule.setIsAudit(customerOrderDTO.getIsAudit()); masterProductionSchedule.setTechnologyDocumentId(customerOrderDTO.getTechnologyDocumentId()); masterProductionSchedule.setManufactureAttr(customerOrderDTO.getManufactureAttr()); masterProductionSchedule.setDocNumber(customerOrderDTO.getDocNumber()); + //闇�姹傛暟閲� + masterProductionSchedule.setQtyRequired(qta); + //闇�姹傛棩鏈� + masterProductionSchedule.setRequiredDate(customerOrderDTO.getDeliveryDate()); + //澶囨敞 + masterProductionSchedule.setRemark(customerOrderDTO.getRemark()); masterProductionSchedule.setQtyRequired(qta); masterProductionSchedule.setRequiredDate(customerOrderDTO.getWantedDeliveryDate()); masterProductionSchedule.setRemark(customerOrderDTO.getRemark()); masterProductionSchedule.setSource("閿�鍞鍗�"); masterProductionScheduleMapper.insert(masterProductionSchedule); + customerOrderDTO.setRequireNumber(customerOrderDTO.getQtyPlaned()); // if (CollectionUtil.isNotEmpty(operationTaskProduceList)) { // for (OperationTaskProduce operationTaskProduce : operationTaskProduceList) { @@ -436,6 +420,7 @@ return true; } + //澶氫釜閿�鍞鍗曞垱寤轰竴涓富鐢熶骇璁″垝 @Override public MasterProductionSchedule createOneMasterProductionScheduleByCustomerOrders(List<CustomerOrderDTO> customerOrders) { List<Long> ids = customerOrders.stream().map(CustomerOrderDTO::getId).collect(Collectors.toList()); @@ -597,17 +582,20 @@ return R.failed("宸ヨ壓鏂囦欢缂哄け"); } List<CustomerOrder> customerOrderList = baseMapper.selectBatchIds(ids); + customerOrderList.forEach(l->{ + log.info("鍏宠仈鏁版嵁==============================>"+l); + }); String msg = ""; for (CustomerOrder customerOrder : customerOrderList) { if (BooleanUtil.isTrue(customerOrder.getIsDocument())) { msg += customerOrder.getCustomerOrderNo() + "宸插叧鑱斿伐鑹烘枃浠讹紒"; } - if (StringUtils.isBlank(customerOrder.getSalesPartNo())) { + if (StringUtils.isBlank(customerOrder.getPartNo())) { msg += customerOrder.getCustomerOrderNo() + "鏈�夋嫨閿�鍞欢锛�"; } - if (StringUtils.isBlank(customerOrder.getPartNo())) { - customerOrder.setPartNo(document.getPartNo()); - } + //if (StringUtils.isBlank(customerOrder.getPartNo())) { + // customerOrder.setPartNo(document.getPartNo()); + //} customerOrder.setIsDocument(true); customerOrder.setCoState(CustomerOrderStateStringValues.PLAN); customerOrder.setTechnologyDocumentId(docId); @@ -697,9 +685,6 @@ .contentType("application/json") .header("Authorization", "Bearer " + token).form(map).execute().body(); JSONObject result = JSONObject.parseObject(str); - //JSONArray jsonArray = result.getJSONArray("data"); - //jsonArray.forEach(); - //return null; //涓昏〃鍙傛暟琛� List<OrderParam> orderParams = orderParamService.list(); if (result.getInteger("code") == 0) { @@ -824,7 +809,7 @@ customerOrder = new CustomerOrder(); } //濡傛灉杩欎釜鍗曞瓙鍦∣TC涓彇娑堢姸鎬� 閭e氨鍒犻櫎 - if (otcOrderStatus.equals("宸插彇娑�")) { + if (otcOrderStatus.equals(OTC_MAIN_STATUS_CANCEL)) { if (customerOrder.getId() != null) { baseMapper.deleteById(customerOrder.getId()); } @@ -912,7 +897,7 @@ } else { customerOrder.setCoState(CustomerOrderStateStringValues.PARTUNCHECKED); } - if (org.apache.commons.lang3.StringUtils.equals("宸蹭笅杈�", otcMainStatus)) { + if (org.apache.commons.lang3.StringUtils.equals(OTC_MAIN_STATUS_TRANSMIT, otcMainStatus)) { customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK); customerOrder.setOtcPartSync(Boolean.TRUE); } @@ -921,8 +906,8 @@ customerOrder.setCoState(CustomerOrderStateStringValues.TECHNOLOGYUNCHECK); customerOrder.setOtcPartSync(Boolean.TRUE); } - //瀹℃牳鐘舵�佷负 01draft 鑽夌 - customerOrder.setIsAudit(AuditStateStringValues.DRAFT); + //瀹℃牳鐘舵�佷负 03accepted 閫氳繃 + customerOrder.setIsAudit(AuditStateStringValues.ACCEPTED); baseMapper.insert(customerOrder); } addCustomerPara(customerJSONObject, customerOrderJSONObject, customerOrder, orderParamList); @@ -1924,7 +1909,9 @@ public R deleteProcessConfigFile(Long id) { try { OrderProcessConfigFile configFile = orderProcessConfigFileMapper.selectById(id); - minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); + String filePath=FileSaveUtil.FILE_PATH+"//"+configFile.getBucketName(); + boolean del = FileUtil.del(new File(filePath)); + //minioTemplate.removeObject(configFile.getBucketName(), configFile.getFileName()); orderProcessConfigFileMapper.deleteById(id); processConfigFileOrderMappingMapper.delete(Wrappers.<ProcessConfigFileOrderMapping>lambdaQuery().eq(ProcessConfigFileOrderMapping::getConfigFileId, id)); return R.ok(); -- Gitblit v1.9.3