增加批次明细的保存
This commit is contained in:
parent
cf06d4fd2e
commit
21829c4a9c
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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; //位数计数
|
||||||
//public static String creatOrderCode(String orderType) {
|
while(piNum>=1) {
|
||||||
// String orderCode=null;
|
piNum/=10;
|
||||||
//Date date = new Date();
|
count++;
|
||||||
//SimpleDateFormat sdf= new SimpleDateFormat("yyyyMMdd");
|
}
|
||||||
//String bach= sdf.format(date);
|
|
||||||
//String rondomStr=RandomUtil.generateString(4);
|
for (int i = 0; i < count-1 ; i++) {
|
||||||
// if(orderType.equals(ProduceManageConstant.DELIVERY_ORDER_TYPE)) {
|
volumeNum = 0+volumeNum;//如果是一位数,卷号为1,如果是两位数,卷号为01,如果是三位数,卷号为001,以此类推
|
||||||
// orderCode=orderType+bach+rondomStr;
|
}
|
||||||
// }
|
|
||||||
// if(orderType.equals(ProduceManageConstant.STOCKTAKING_ORDER_TYPE)){
|
String batchDetCode = "PCMX"+timePartStr+productProcessId+batchCode+volumeNum;
|
||||||
// orderCode=orderType+bach+rondomStr;
|
|
||||||
// }
|
return batchDetCode;
|
||||||
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
@ -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);
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,22 @@ public class ProductProcessController {
|
|||||||
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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user