| | |
| | | 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; |
| | |
| | | |
| | | private final static String AFFILIATED_CONTRACT = "中天注塑厂"; |
| | | |
| | | |
| | | //private FileSaveUtil fileSaveUtil; |
| | | |
| | | @Override |
| | | public void otcDownload(Long id, HttpServletResponse response) { |
| | |
| | | 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() + "】MES本地查无匹配零件对象"); |
| | | } |
| | |
| | | |
| | | |
| | | @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() + "】MES本地查无匹配零件对象"); |
| | | } |
| | | } |
| | | 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() + "】MES本地查无匹配零件对象"); |
| | | } |
| | | } |
| | | // 如果销售零件号未修改,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 |
| | |
| | | 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(); |