加工单物料批量更新

This commit is contained in:
hy2250089 2020-01-16 09:32:18 +08:00
parent 297cbaa591
commit ae7bb481cc
8 changed files with 52 additions and 48 deletions

View File

@ -10,4 +10,6 @@ import java.util.List;
public interface ProcessMaterialsMapper extends Mapper<ProcessMaterials> {
List<ProcessMaterialsVo> findProcMatVoListByProcess(MtAloneProcessParams params);
void updateList(List<ProcessMaterials> procMatList);
}

View File

@ -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>

View File

@ -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);
}

View File

@ -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);

View File

@ -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();
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);
}
}

View File

@ -28,9 +28,9 @@ public class ProcessMaterialsServiceImpl extends AbstractService<ProcessMaterial
return processMaterialsMapper.findProcMatVoListByProcess(params);
}
//@Override
//public List<ProcessMaterials> findList(ProcessMaterialsParams params) {
// return processMaterialsMapper.findList(params);
//}
@Override
public void updateList(List<ProcessMaterials> procMatList) {
processMaterialsMapper.updateList(procMatList);
}
}

View File

@ -196,11 +196,8 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
//保存工序和物料信息避免循环操作数据库
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,7 +228,7 @@ 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.setCode(ProduceManagePublicMethod.creatUniqueCode("JGWL"));
processMaterials.setDosage(productProcess.getPiNum() * processMaterials.getDosage());
processMaterials.setCompanyId(currentUser.getCompanyId());
processMaterialsList.add(processMaterials);
@ -233,12 +236,10 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
}
}
processService.save(processList);
if (0 != processMaterialsList.size())
if (processMaterialsList.size() != 0)
processMaterialsService.save(processMaterialsList);
}
}
}

View File

@ -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);
}