增加批次明细的保存
このコミットが含まれているのは:
コミット
21829c4a9c
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,8 +8,18 @@ import java.util.List;
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ProductProcessHo extends ProductProcess{
|
||||
private List<ProductProcessBatchDet> productProcessBatchDetList;
|
||||
|
||||
private List<ProcessHo> processHoList;
|
||||
|
||||
public List<ProductProcessBatchDet> getProductProcessBatchDetList() {
|
||||
return productProcessBatchDetList;
|
||||
}
|
||||
|
||||
public void setProductProcessBatchDetList(List<ProductProcessBatchDet> productProcessBatchDetList) {
|
||||
this.productProcessBatchDetList = productProcessBatchDetList;
|
||||
}
|
||||
|
||||
public List<ProcessHo> getProcessHoList() {
|
||||
return processHoList;
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ public interface ProductProcessService extends Service<ProductProcess, Integer>
|
||||
|
||||
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());
|
||||
List<MaterialsOutgoingLogVo> materialsOutgoingLogList = materialsOutgoingLogService.findListByOneMaterial(params);
|
||||
|
||||
if((null!=materialsOutgoingLogList) && (materialsOutgoingLogList.size()!=0)){
|
||||
if(null!=materialsOutgoingLogList && materialsOutgoingLogList.size()!=0){
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
for (MaterialsOutgoingLogVo materialsOutgoingLogVo : materialsOutgoingLogList){
|
||||
ids.add(materialsOutgoingLogVo.getId());
|
||||
|
@ -44,6 +44,9 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
@Autowired
|
||||
private ProcessMaterialsService processMaterialsService;
|
||||
|
||||
@Autowired
|
||||
private ProductProcessBatchDetService productProcessBatchDetService;
|
||||
|
||||
@Override
|
||||
public List<ProductProcessVo> findList(ProductProcessParams params) {
|
||||
return productProcessMapper.findList(params);
|
||||
@ -240,7 +243,38 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
if (processMaterialsList.size() != 0)
|
||||
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);
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<ProcessHo> processHoList = productProcessHo.getProcessHoList();
|
||||
ProcessHo processHo = processHoList.get(0);
|
||||
System.out.println("-----------"+processHo.getOriginalLen()+" "+processHo.getAfterLen()+" "+processHo.getProcessPrice());
|
||||
productProcessService.addProduceProcess(productProcessHo, currentUser);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする