From 21829c4a9c4ce1fa25ee8c100ce0a42e15f552b4 Mon Sep 17 00:00:00 2001 From: hy2250089 Date: Wed, 11 Mar 2020 10:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E6=AC=A1=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E7=9A=84=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/produce/manage/PmsApplication.java | 4 -- .../constant/ProduceManagePublicMethod.java | 47 +++++++++++-------- .../manage/model/ProductProcessBatchDet.java | 22 ++++----- .../manage/model/ProductProcessHo.java | 10 ++++ .../manage/service/ProductProcessService.java | 2 +- .../impl/MaterialsInfoServiceImpl.java | 2 +- .../impl/ProductProcessServiceImpl.java | 34 ++++++++++++++ .../manage/web/ProductProcessController.java | 28 +++++++---- 8 files changed, 103 insertions(+), 46 deletions(-) diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java index db91e4e..e40e3b6 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/PmsApplication.java @@ -14,10 +14,6 @@ import org.springframework.context.annotation.ComponentScan; }) public class PmsApplication { public static void main(String[] args) { - String aa[] = new String[]{"11","22"}; - for (int i = 0; i < aa.length; i++) { - System.out.println("=="+aa[i]); - } SpringApplication.run(PmsApplication.class, args); } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/constant/ProduceManagePublicMethod.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/constant/ProduceManagePublicMethod.java index 98fa024..4704955 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/constant/ProduceManagePublicMethod.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/constant/ProduceManagePublicMethod.java @@ -10,13 +10,13 @@ import com.deer.wms.project.seed.util.RandomUtil; public class ProduceManagePublicMethod { /** - * 自动生成唯一的物料编码,规则:类型简称(type)+20190728+UUID后十位 + * 自动生成唯一编码,规则:类型简称(type)+20190728+UUID后十位 * type:WL,物料编码;JGD,加工单 * @return */ public static String creatUniqueCode(String type) { Date date = new Date(); - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddhh"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd"); String timePartStr = sdf1.format(date); String uuidStr = UUID.randomUUID().toString().substring(24); String newCode = type+timePartStr+uuidStr; @@ -24,23 +24,32 @@ public class ProduceManagePublicMethod { return newCode; } + /** + * 自动生成唯一的批次明细条码,规则:PCMX+八位日期+批次加工单id+批次号+卷号 + * @return + */ + public static String creatBatchDetCode(Date createDate, Integer productProcessId, String batchCode, Integer piNum, String volumeNum) { + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd"); + String timePartStr = sdf1.format(createDate); + + int count=0; //位数计数 + while(piNum>=1) { + piNum/=10; + count++; + } + + for (int i = 0; i < count-1 ; i++) { + volumeNum = 0+volumeNum;//如果是一位数,卷号为1,如果是两位数,卷号为01,如果是三位数,卷号为001,以此类推 + } + + String batchDetCode = "PCMX"+timePartStr+productProcessId+batchCode+volumeNum; + + return batchDetCode; + } - //public static String creatOrderCode(String orderType) { - // String orderCode=null; - //Date date = new Date(); - //SimpleDateFormat sdf= new SimpleDateFormat("yyyyMMdd"); - //String bach= sdf.format(date); - //String rondomStr=RandomUtil.generateString(4); - // if(orderType.equals(ProduceManageConstant.DELIVERY_ORDER_TYPE)) { - // orderCode=orderType+bach+rondomStr; - // } - // if(orderType.equals(ProduceManageConstant.STOCKTAKING_ORDER_TYPE)){ - // orderCode=orderType+bach+rondomStr; - // } - // if(orderType.equals(ProduceManageConstant.WINDING_MACHINE_TYPE)){ - // orderCode=orderType+bach+rondomStr; - // } - // return orderCode; - //} + public static void main(String[] args){ + String code = creatBatchDetCode(new Date(), 10, "1", 100, "1"); + System.out.println("----------"+code); + } } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessBatchDet.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessBatchDet.java index 84d0bb4..9b380dd 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessBatchDet.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessBatchDet.java @@ -50,10 +50,10 @@ public class ProductProcessBatchDet { private String deliveryCode; /** - * 产品加工编码 + * 批次产品加工单id */ - @Column(name = "product_process_code") - private String productProcessCode; + @Column(name = "product_process_id") + private Integer productProcessId; /** * 卷号,根据配送码单上有卷号 @@ -251,21 +251,21 @@ public class ProductProcessBatchDet { } /** - * 获取产品加工编码 + * 获取批次产品加工单id * - * @return product_process_code - 产品加工编码 + * @return product_process_id - 批次产品加工单id */ - public String getProductProcessCode() { - return productProcessCode; + public Integer getProductProcessId() { + return productProcessId; } /** - * 设置产品加工编码 + * 设置批次产品加工单id * - * @param productProcessCode 产品加工编码 + * @param productProcessId 产品加工编码 */ - public void setProductProcessCode(String productProcessCode) { - this.productProcessCode = productProcessCode; + public void setProductProcessId(Integer productProcessId) { + this.productProcessId = productProcessId; } /** diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessHo.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessHo.java index 6d4bfc0..0fde63e 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessHo.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProductProcessHo.java @@ -8,8 +8,18 @@ import java.util.List; * @Version 1.0 */ public class ProductProcessHo extends ProductProcess{ + private List productProcessBatchDetList; + private List processHoList; + public List getProductProcessBatchDetList() { + return productProcessBatchDetList; + } + + public void setProductProcessBatchDetList(List productProcessBatchDetList) { + this.productProcessBatchDetList = productProcessBatchDetList; + } + public List getProcessHoList() { return processHoList; } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java index 8ba52f2..46ab455 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java @@ -22,5 +22,5 @@ public interface ProductProcessService extends Service void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser); - + //void deleteRelevantById(Integer produceProcessId, CurrentUser currentUser); } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java index c98824b..d1520e5 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/MaterialsInfoServiceImpl.java @@ -63,7 +63,7 @@ public class MaterialsInfoServiceImpl extends AbstractService materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params); - if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){ + if(null!=materialsOutgoingLogList && materialsOutgoingLogList.size()!=0){ List ids = new ArrayList(); for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){ ids.add(materialsOutgoingLogVo.getId()); diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java index b12cb5f..7f8d820 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java @@ -44,6 +44,9 @@ public class ProductProcessServiceImpl extends AbstractService findList(ProductProcessParams params) { return productProcessMapper.findList(params); @@ -240,7 +243,38 @@ public class ProductProcessServiceImpl extends AbstractService productProcessBatchDetList = new ArrayList(); + for (int i = 0; i < productProcess.getPiNum(); i++) { + ProductProcessBatchDet productProcessBatchDet = new ProductProcessBatchDet(); + productProcessBatchDet.setOperatorId(currentUser.getUserId()); + productProcessBatchDet.setCreateTime(date); + productProcessBatchDet.setUpdateTime(date); + productProcessBatchDet.setVersion("1.1"); + productProcessBatchDet.setStatus(0); + productProcessBatchDet.setBatchCode(productProcess.getBatchCode()); + productProcessBatchDet.setDeliveryCode(productProcess.getDeliveryCode()); + productProcessBatchDet.setProductProcessId(productProcess.getId()); + productProcessBatchDet.setVolumeNum(i+1+""); + productProcessBatchDet.setBatchDetCode(ProduceManagePublicMethod.creatBatchDetCode(productProcessBatchDet.getCreateTime(), productProcessBatchDet.getProductProcessId(), productProcessBatchDet.getBatchCode(), productProcess.getPiNum(), productProcessBatchDet.getVolumeNum())); + productProcessBatchDet.setCompanyId(currentUser.getCompanyId()); + + productProcessBatchDetList.add(productProcessBatchDet); + } + if (productProcessBatchDetList.size() != 0) + productProcessBatchDetService.save(productProcessBatchDetList); } + //@Override + //public void deleteRelevantById(Integer produceProcessId, CurrentUser currentUser) { + // productProcessMapper.deleteByPrimaryKey(produceProcessId); + // HashMap produceProcessMap = new HashMap(); + // produceProcessMap.put("companyId", currentUser.getCompanyId()); + // produceProcessMap.put("produceProcessId", produceProcessId); + // processService.deleteByproduceProcessId(produceProcessId); + // + //} + } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java index c2fc752..b9d7646 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java @@ -58,12 +58,23 @@ public class ProductProcessController { productProcessService.save(productProcess, currentUser); return ResultGenerator.genSuccessResult(); } - - @OperateLog(description = "删除xxx", type = "删除") - @ApiOperation(value = "删除xxx", notes = "删除xxx") - @DeleteMapping("/delete/{id}") - public Result delete(@PathVariable Integer id) { - productProcessService.deleteById(id); + + /** + * hy暂没用 + * 删除批次生产加工单,顺带删除其下的工序、物料信息 + * @param produceProcessId 批次生产加工单id + * @param currentUser + * @return + */ + @OperateLog(description = "删除批次生产加工单", type = "删除") + @ApiOperation(value = "删除批次生产加工单", notes = "删除批次生产加工单") + @DeleteMapping("/delete/{produceProcessId}") + public Result delete(@PathVariable Integer produceProcessId, @ApiIgnore @User CurrentUser currentUser) { + if(currentUser==null){ + return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); + } + + //productProcessService.deleteRelevantById(produceProcessId, currentUser); return ResultGenerator.genSuccessResult(); } @@ -185,7 +196,7 @@ public class ProductProcessController { /** * hy正在用 - * 新建批次产品加工时,点击提交按钮在库表中同时保存初步的加工单、工序、物料信息 + * 新建批次产品加工时,点击提交按钮在库表中同时保存初步的批次加工单、批次明细、工序、物料信息 * @param productProcessHo * @param currentUser * @return @@ -201,9 +212,6 @@ public class ProductProcessController { return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); } - List processHoList = productProcessHo.getProcessHoList(); - ProcessHo processHo = processHoList.get(0); - System.out.println("-----------"+processHo.getOriginalLen()+" "+processHo.getAfterLen()+" "+processHo.getProcessPrice()); productProcessService.addProduceProcess(productProcessHo, currentUser); return ResultGenerator.genSuccessResult(); }