增加批次明细的保存

This commit is contained in:
hy2250089 2020-03-11 10:04:23 +08:00
parent cf06d4fd2e
commit 21829c4a9c
8 changed files with 103 additions and 46 deletions

View File

@ -14,10 +14,6 @@ import org.springframework.context.annotation.ComponentScan;
}) })
public class PmsApplication { public class PmsApplication {
public static void main(String[] args) { 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); SpringApplication.run(PmsApplication.class, args);
} }

View File

@ -10,13 +10,13 @@ import com.deer.wms.project.seed.util.RandomUtil;
public class ProduceManagePublicMethod { public class ProduceManagePublicMethod {
/** /**
* 自动生成唯一的物料编码规则类型简称type+20190728+UUID后十位 * 自动生成唯一编码规则类型简称type+20190728+UUID后十位
* type:WL,物料编码JGD加工单 * type:WL,物料编码JGD加工单
* @return * @return
*/ */
public static String creatUniqueCode(String type) { public static String creatUniqueCode(String type) {
Date date = new Date(); Date date = new Date();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddhh"); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
String timePartStr = sdf1.format(date); String timePartStr = sdf1.format(date);
String uuidStr = UUID.randomUUID().toString().substring(24); String uuidStr = UUID.randomUUID().toString().substring(24);
String newCode = type+timePartStr+uuidStr; String newCode = type+timePartStr+uuidStr;
@ -24,23 +24,32 @@ public class ProduceManagePublicMethod {
return newCode; 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) { public static void main(String[] args){
// String orderCode=null; String code = creatBatchDetCode(new Date(), 10, "1", 100, "1");
//Date date = new Date(); System.out.println("----------"+code);
//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;
//}
} }

View File

@ -50,10 +50,10 @@ public class ProductProcessBatchDet {
private String deliveryCode; private String deliveryCode;
/** /**
* 产品加工编码 * 批次产品加工单id
*/ */
@Column(name = "product_process_code") @Column(name = "product_process_id")
private String productProcessCode; private Integer productProcessId;
/** /**
* 卷号根据配送码单上有卷号 * 卷号根据配送码单上有卷号
@ -251,21 +251,21 @@ public class ProductProcessBatchDet {
} }
/** /**
* 获取产品加工编码 * 获取批次产品加工单id
* *
* @return product_process_code - 产品加工编码 * @return product_process_id - 批次产品加工单id
*/ */
public String getProductProcessCode() { public Integer getProductProcessId() {
return productProcessCode; return productProcessId;
} }
/** /**
* 设置产品加工编码 * 设置批次产品加工单id
* *
* @param productProcessCode 产品加工编码 * @param productProcessId 产品加工编码
*/ */
public void setProductProcessCode(String productProcessCode) { public void setProductProcessId(Integer productProcessId) {
this.productProcessCode = productProcessCode; this.productProcessId = productProcessId;
} }
/** /**

View File

@ -8,8 +8,18 @@ import java.util.List;
* @Version 1.0 * @Version 1.0
*/ */
public class ProductProcessHo extends ProductProcess{ public class ProductProcessHo extends ProductProcess{
private List<ProductProcessBatchDet> productProcessBatchDetList;
private List<ProcessHo> processHoList; private List<ProcessHo> processHoList;
public List<ProductProcessBatchDet> getProductProcessBatchDetList() {
return productProcessBatchDetList;
}
public void setProductProcessBatchDetList(List<ProductProcessBatchDet> productProcessBatchDetList) {
this.productProcessBatchDetList = productProcessBatchDetList;
}
public List<ProcessHo> getProcessHoList() { public List<ProcessHo> getProcessHoList() {
return processHoList; return processHoList;
} }

View File

@ -22,5 +22,5 @@ public interface ProductProcessService extends Service<ProductProcess, Integer>
void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser); void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser);
//void deleteRelevantById(Integer produceProcessId, CurrentUser currentUser);
} }

View File

@ -63,7 +63,7 @@ public class MaterialsInfoServiceImpl extends AbstractService<MaterialsInfo, Int
params.setCompanyId(currentUser.getCompanyId()); params.setCompanyId(currentUser.getCompanyId());
List<MaterialsOutgoingLogVo> materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params); List<MaterialsOutgoingLogVo> materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params);
if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){ if(null!=materialsOutgoingLogList && materialsOutgoingLogList.size()!=0){
List<Integer> ids = new ArrayList<Integer>(); List<Integer> ids = new ArrayList<Integer>();
for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){ for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){
ids.add(materialsOutgoingLogVo.getId()); ids.add(materialsOutgoingLogVo.getId());

View File

@ -44,6 +44,9 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
@Autowired @Autowired
private ProcessMaterialsService processMaterialsService; private ProcessMaterialsService processMaterialsService;
@Autowired
private ProductProcessBatchDetService productProcessBatchDetService;
@Override @Override
public List<ProductProcessVo> findList(ProductProcessParams params) { public List<ProductProcessVo> findList(ProductProcessParams params) {
return productProcessMapper.findList(params); return productProcessMapper.findList(params);
@ -240,7 +243,38 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
if (processMaterialsList.size() != 0) if (processMaterialsList.size() != 0)
processMaterialsService.save(processMaterialsList); processMaterialsService.save(processMaterialsList);
} }
//保存批次明细
List<ProductProcessBatchDet> productProcessBatchDetList = new ArrayList<ProductProcessBatchDet>();
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);
//
//}
} }

View File

@ -58,12 +58,23 @@ public class ProductProcessController {
productProcessService.save(productProcess, currentUser); productProcessService.save(productProcess, currentUser);
return ResultGenerator.genSuccessResult(); return ResultGenerator.genSuccessResult();
} }
@OperateLog(description = "删除xxx", type = "删除") /**
@ApiOperation(value = "删除xxx", notes = "删除xxx") * hy暂没用
@DeleteMapping("/delete/{id}") * 删除批次生产加工单顺带删除其下的工序物料信息
public Result delete(@PathVariable Integer id) { * @param produceProcessId 批次生产加工单id
productProcessService.deleteById(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(); return ResultGenerator.genSuccessResult();
} }
@ -185,7 +196,7 @@ public class ProductProcessController {
/** /**
* hy正在用 * hy正在用
* 新建批次产品加工时点击提交按钮在库表中同时保存初步的加工单工序物料信息 * 新建批次产品加工时点击提交按钮在库表中同时保存初步的批次加工单批次明细工序物料信息
* @param productProcessHo * @param productProcessHo
* @param currentUser * @param currentUser
* @return * @return
@ -201,9 +212,6 @@ public class ProductProcessController {
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
} }
List<ProcessHo> processHoList = productProcessHo.getProcessHoList();
ProcessHo processHo = processHoList.get(0);
System.out.println("-----------"+processHo.getOriginalLen()+" "+processHo.getAfterLen()+" "+processHo.getProcessPrice());
productProcessService.addProduceProcess(productProcessHo, currentUser); productProcessService.addProduceProcess(productProcessHo, currentUser);
return ResultGenerator.genSuccessResult(); return ResultGenerator.genSuccessResult();
} }