| | |
| | | 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; |
| | |
| | | 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.*; |
| | |
| | | // } |
| | | //保存主生产计划 |
| | | 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()); |
| | | //将审核状态和工艺文件的id同步给生产计划 |
| | | 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) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | //多个销售订单创建一个主生产计划 |
| | | @Override |
| | | public MasterProductionSchedule createOneMasterProductionScheduleByCustomerOrders(List<CustomerOrderDTO> customerOrders) { |
| | | List<Long> ids = customerOrders.stream().map(CustomerOrderDTO::getId).collect(Collectors.toList()); |
| | |
| | | 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); |
| | |
| | | .contentType("application/json") |
| | | .header("Authorization", "Bearer " + token).form(map).execute().body(); |
| | | JSONObject result = JSONObject.parseObject(str); |
| | | //JSONArray jsonArray = result.getJSONArray("data"); |
| | | log.info("主表长度============================================>"+result.getJSONArray("data").size()); |
| | | //jsonArray.forEach(); |
| | | //return null; |
| | | //主表参数表 |