加工单物料批量更新
This commit is contained in:
parent
297cbaa591
commit
ae7bb481cc
@ -10,4 +10,6 @@ import java.util.List;
|
||||
|
||||
public interface ProcessMaterialsMapper extends Mapper<ProcessMaterials> {
|
||||
List<ProcessMaterialsVo> findProcMatVoListByProcess(MtAloneProcessParams params);
|
||||
|
||||
void updateList(List<ProcessMaterials> procMatList);
|
||||
}
|
@ -55,4 +55,15 @@
|
||||
</where> ORDER BY procmaterials.id
|
||||
</select>
|
||||
|
||||
<update id="updateList" parameterType="java.util.List">
|
||||
<foreach collection="list" index="index" item="item" open="" separator=";" close="">
|
||||
UPDATE mt_alone_process_materials
|
||||
<set>
|
||||
dosage = #{item.dosage},
|
||||
update_time = #{item.updateTime}
|
||||
</set>
|
||||
WHERE id = #{item.id} AND company_id = #{item.companyId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -14,4 +14,5 @@ import java.util.List;
|
||||
public interface ProcessMaterialsService extends Service<ProcessMaterials, Integer> {
|
||||
List<ProcessMaterialsVo> findProcMatVoListByProcess(MtAloneProcessParams params);
|
||||
|
||||
void updateList(List<ProcessMaterials> procMatList);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class MaterialsInfoServiceImpl extends AbstractService<MaterialsInfo, Int
|
||||
ids.add(materialsOutgoingLogVo.getId());
|
||||
}
|
||||
|
||||
if((null!=ids) && (ids.size()!=0)) {
|
||||
if(null!=ids && ids.size()!=0) {
|
||||
HashMap outgoingParam = new HashMap();
|
||||
outgoingParam.put("companyId", currentUser.getCompanyId());
|
||||
outgoingParam.put("ids", ids);
|
||||
|
@ -42,7 +42,7 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
List<ProcessBom> processBomList = processBomService.findListByProductBom(params);
|
||||
List<MtAloneProcess> processList = new ArrayList<MtAloneProcess>();
|
||||
|
||||
if(processBomList!=null && processBomList.size()!=0){
|
||||
if (processBomList != null && processBomList.size() != 0) {
|
||||
//循环工序bom给工序初步赋值,先不保存
|
||||
for (ProcessBom processBom : processBomList) {
|
||||
MtAloneProcess process = new MtAloneProcess();
|
||||
@ -66,9 +66,9 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
//根据工序id查询物料信息
|
||||
List<ProcessMaterialsVo> procMatVoList = processMaterialsService.findProcMatVoListByProcess(params);
|
||||
ProcessHo processHo = new ProcessHo();
|
||||
if(null != processVo){
|
||||
System.out.println("----------"+processVo.getId());
|
||||
System.out.println("----------"+processVo.getProcessName());
|
||||
if (null != processVo) {
|
||||
System.out.println("----------" + processVo.getId());
|
||||
System.out.println("----------" + processVo.getProcessName());
|
||||
BeanUtils.copyProperties(processVo, processHo);
|
||||
processHo.setProcessMaterialsVoList(procMatVoList);
|
||||
}
|
||||
@ -98,27 +98,16 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
BeanUtils.copyProperties(processHo, process);
|
||||
this.update(process);
|
||||
|
||||
//if(null != processHo.getProcessMaterialsVoList()) {
|
||||
// List<ProcessMaterialsVo> procMatVoList = processHo.getProcessMaterialsVoList();
|
||||
// List<ProcessMaterials> procMatList = new ArrayList<ProcessMaterials>(procMatVoList.size());
|
||||
// for (ProcessMaterialsVo processMaterialsVo : procMatVoList){
|
||||
// ProcessMaterials processMaterials = new ProcessMaterials();
|
||||
// processMaterialsVo.setUpdateTime(date);
|
||||
// BeanUtils.copyProperties(processMaterialsVo, processMaterials);
|
||||
// procMatList.add(processMaterials);
|
||||
// }
|
||||
// processMaterialsService.update(procMatList);
|
||||
//}
|
||||
|
||||
if(null != processHo.getProcessMaterialsVoList()) {
|
||||
List<ProcessMaterialsVo> procMatVoList = processHo.getProcessMaterialsVoList();
|
||||
for (ProcessMaterialsVo processMaterialsVo : procMatVoList){
|
||||
List<ProcessMaterialsVo> procMatVoList = processHo.getProcessMaterialsVoList();
|
||||
if (null != procMatVoList && procMatVoList.size() != 0) {
|
||||
List<ProcessMaterials> procMatList = new ArrayList<ProcessMaterials>(procMatVoList.size());
|
||||
for (ProcessMaterialsVo processMaterialsVo : procMatVoList) {
|
||||
ProcessMaterials processMaterials = new ProcessMaterials();
|
||||
processMaterialsVo.setUpdateTime(date);
|
||||
BeanUtils.copyProperties(processMaterialsVo, processMaterials);
|
||||
processMaterialsService.update(processMaterials);
|
||||
procMatList.add(processMaterials);
|
||||
}
|
||||
|
||||
processMaterialsService.updateList(procMatList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ public class ProcessMaterialsServiceImpl extends AbstractService<ProcessMaterial
|
||||
return processMaterialsMapper.findProcMatVoListByProcess(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateList(List<ProcessMaterials> procMatList) {
|
||||
processMaterialsMapper.updateList(procMatList);
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public List<ProcessMaterials> findList(ProcessMaterialsParams params) {
|
||||
// return processMaterialsMapper.findList(params);
|
||||
//}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
productProcess.setVersion("1.1");
|
||||
productProcess.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
productProcess.setWorkOrderCode(ProduceManagePublicMethod.creatUniqueCode("PCJGD"));
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen()/productProcess.getLen())*100+"%");
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen() / productProcess.getLen()) * 100 + "%");
|
||||
productProcess.setReviewStatus(ProduceManageConstant.REVIEW_STATUS_FORREVIEW);
|
||||
productProcess.setCompanyId(currentUser.getCompanyId());
|
||||
productProcessMapper.insert(productProcess);
|
||||
@ -77,14 +77,14 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
productProcess.setVersion("1.1");
|
||||
productProcess.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
productProcess.setWorkOrderCode(ProduceManagePublicMethod.creatUniqueCode("PCJGD"));
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen()/productProcess.getLen())*100+"%");
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen() / productProcess.getLen()) * 100 + "%");
|
||||
productProcess.setReviewStatus(ProduceManageConstant.REVIEW_STATUS_FORREVIEW);
|
||||
productProcess.setCompanyId(currentUser.getCompanyId());
|
||||
productProcessMapper.insert(productProcess);
|
||||
|
||||
//保存由前端获取的工序信息
|
||||
List<MtAloneProcessVo> processVoList = productAndProcess.getProcessVoList();
|
||||
if(null != processVoList) {
|
||||
if (null != processVoList) {
|
||||
List<MtAloneProcess> processList = new ArrayList<MtAloneProcess>(processVoList.size());
|
||||
for (MtAloneProcess processVo : processVoList) {
|
||||
MtAloneProcess process = new MtAloneProcess();
|
||||
@ -104,7 +104,7 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
List<MtAloneProcessVo> tempProcessVoList = processService.findProcessVoListByProductProcess(params);
|
||||
|
||||
ProductProcessHo productProcessHo = new ProductProcessHo();
|
||||
if(null != productProcess) {
|
||||
if (null != productProcess) {
|
||||
BeanUtils.copyProperties(productProcess, productProcessHo);
|
||||
if (null != tempProcessVoList) {
|
||||
List<ProcessHo> processHoList = new ArrayList<ProcessHo>(tempProcessVoList.size());
|
||||
@ -127,7 +127,7 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
|
||||
//批次产品加工单初步赋值,关联bom
|
||||
ProductProcessBom productProcessBom = productProcessBomService.selectByProdProcBom(params);
|
||||
if(null != productProcessBom) {
|
||||
if (null != productProcessBom) {
|
||||
productProcessHo.setProductBomId(productProcessBom.getId());
|
||||
productProcessHo.setProductProcessBomName(productProcessBom.getProductProcessName());
|
||||
//工序初步赋值,关联bom
|
||||
@ -189,18 +189,15 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
productProcess.setVersion("1.1");
|
||||
productProcess.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
productProcess.setWorkOrderCode(ProduceManagePublicMethod.creatUniqueCode("PCJGD"));
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen()/productProcess.getLen())*100+"%");
|
||||
productProcess.setShrinkage((productProcess.getDetectionLen() / productProcess.getLen()) * 100 + "%");
|
||||
productProcess.setReviewStatus(ProduceManageConstant.REVIEW_STATUS_FORREVIEW);
|
||||
productProcess.setCompanyId(currentUser.getCompanyId());
|
||||
productProcessMapper.insert(productProcess);
|
||||
|
||||
//保存工序和物料信息,避免循环操作数据库
|
||||
List<ProcessHo> processHoList = productProcessHo.getProcessHoList();
|
||||
List<MtAloneProcess> processList;
|
||||
List<ProcessMaterials> processMaterialsList;
|
||||
if((null!=processHoList) && (0!=processHoList.size())) {
|
||||
processList = new ArrayList<MtAloneProcess>(processHoList.size());
|
||||
processMaterialsList = new ArrayList<ProcessMaterials>();
|
||||
if (null != processHoList && processHoList.size() != 0) {
|
||||
List<MtAloneProcess> processList = new ArrayList<MtAloneProcess>(processHoList.size());
|
||||
for (ProcessHo processHo : processHoList) {
|
||||
MtAloneProcess process = new MtAloneProcess();
|
||||
BeanUtils.copyProperties(processHo, process);
|
||||
@ -210,12 +207,18 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
process.setVersion("1.1");
|
||||
process.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
process.setProductProcessId(productProcess.getId());
|
||||
process.setCode(ProduceManagePublicMethod.creatUniqueCode("GX"));
|
||||
process.setCode(ProduceManagePublicMethod.creatUniqueCode("JGGX"));
|
||||
process.setCompanyId(currentUser.getCompanyId());
|
||||
processList.add(process);
|
||||
}
|
||||
processService.save(processList);
|
||||
|
||||
List<ProcessMaterials> processMaterialsList = new ArrayList<ProcessMaterials>();
|
||||
for (int i = 0; i < processHoList.size(); i++) {
|
||||
ProcessHo processHo = processHoList.get(i);
|
||||
MtAloneProcess process = processList.get(i);
|
||||
List<ProcessMaterialsVo> processMaterialsVoList = processHo.getProcessMaterialsVoList();
|
||||
if((null!=processMaterialsVoList) && (0!=processMaterialsVoList.size())){
|
||||
if (null != processMaterialsVoList && processMaterialsVoList.size() != 0) {
|
||||
for (ProcessMaterialsVo processMaterialsVo : processMaterialsVoList) {
|
||||
ProcessMaterials processMaterials = new ProcessMaterials();
|
||||
BeanUtils.copyProperties(processMaterialsVo, processMaterials);
|
||||
@ -225,20 +228,18 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
processMaterials.setVersion("1.1");
|
||||
processMaterials.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
processMaterials.setProcessId(process.getId());
|
||||
processMaterials.setCode(ProduceManagePublicMethod.creatUniqueCode("SCWL"));
|
||||
processMaterials.setDosage(productProcess.getPiNum()*processMaterials.getDosage());
|
||||
processMaterials.setCode(ProduceManagePublicMethod.creatUniqueCode("JGWL"));
|
||||
processMaterials.setDosage(productProcess.getPiNum() * processMaterials.getDosage());
|
||||
processMaterials.setCompanyId(currentUser.getCompanyId());
|
||||
processMaterialsList.add(processMaterials);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processService.save(processList);
|
||||
if (0 != processMaterialsList.size())
|
||||
if (processMaterialsList.size() != 0)
|
||||
processMaterialsService.save(processMaterialsList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -124,12 +124,12 @@ public class MaterialsInfoController {
|
||||
@ApiOperation(value = "获取某种物料详细信息", notes = "获取某种物料详细信息")
|
||||
@GetMapping("/detail")
|
||||
public Result detail(MaterialsInfoParams params, @ApiIgnore @User CurrentUser currentUser) {
|
||||
//if(currentUser==null){
|
||||
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
|
||||
//}
|
||||
if(currentUser==null){
|
||||
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
|
||||
}
|
||||
StringUtil.trimObjectStringProperties(params);
|
||||
|
||||
params.setCompanyId(1);
|
||||
params.setCompanyId(currentUser.getCompanyId());
|
||||
MaterialsInfoDto materialsInfoDto = materialsInfoService.findDetailById(params);
|
||||
return ResultGenerator.genSuccessResult(materialsInfoDto);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user