diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java index 19893847..9e7f6548 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/dal/mysql/material/MaterialMapper.java @@ -35,11 +35,14 @@ public interface MaterialMapper extends BaseMapperX { .like(!StringUtils.isEmpty(reqVO.getCode()), MaterialDO::getCode, reqVO.getCode()) .eq(!StringUtils.isEmpty(reqVO.getMaterialType()), MaterialDO::getMaterialType, reqVO.getMaterialType()) .eq(reqVO.getStatus() != null, MaterialDO::getStatus, reqVO.getStatus()) - .eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name()); + .eq(true,MaterialDO::getVirtualPart, YesOrNoEnum.N.name()) + .apply(!StringUtils.isEmpty(reqVO.getCodeAndName()), " (t.name like {0} or t.code like {0})", "%"+reqVO.getCodeAndName()+"%"); + +// if(!StringUtils.isEmpty(reqVO.getCodeAndName())){ +// query.like(MaterialDO::getName, reqVO.getCodeAndName()).or().like(MaterialDO::getCode, reqVO.getCodeAndName()); +// +// } - if(!StringUtils.isEmpty(reqVO.getCodeAndName())){ - query.like(MaterialDO::getName, reqVO.getCodeAndName()).or().like(MaterialDO::getCode, reqVO.getCodeAndName()); - } return selectPage(reqVO, query); } diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java index 6010e648..1d563178 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/plan/PlanServiceImpl.java @@ -1,10 +1,12 @@ package com.chanko.yunxi.mes.module.heli.service.plan; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.chanko.yunxi.mes.framework.common.pojo.PageParam; import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanPageReqVO; import com.chanko.yunxi.mes.module.heli.controller.admin.plan.vo.PlanSaveReqVO; +import com.chanko.yunxi.mes.module.heli.controller.admin.plansub.vo.PlanSubPageReqVO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.plan.PlanDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.plansub.PlanSubDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderSubDO; @@ -119,6 +121,8 @@ public class PlanServiceImpl implements PlanService { orderByDesc(PlanDO::getId); last("LIMIT 1"); }}); + // 生成生产计划子项目信息 + List projectOrderSubDOs = projectOrderService.getProjectOrderSubListByProjectOrderId(projectId); if(planDO != null){ // 设置项目更新次数 planDO.setChangeNum(planDO.getChangeNum()+1); @@ -127,6 +131,22 @@ public class PlanServiceImpl implements PlanService { // 设置生产计划状态 planDO.setStatus(ProjectPlanStatusEnum.CHANGE.getCode()); planMapper.updateById(planDO); + + PlanSubPageReqVO pageReqVO = new PlanSubPageReqVO(); + pageReqVO.setPageNo(1); + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = planSubMapper.selectPage(pageReqVO).getList(); + + for(ProjectOrderSubDO item : projectOrderSubDOs){ + if(!list.stream().anyMatch(a ->a.getProjectSubId().equals(item.getId()))) { + PlanSubDO planSubDO = new PlanSubDO(); + planSubDO.setProjectPlanId(planDO.getId()); + planSubDO.setProjectId(projectId); + planSubDO.setProjectSubId(item.getId()); + planSubMapper.insert(planSubDO); + } + } + }else{ planDO = new PlanDO(); planDO.setProjectId(projectId); @@ -146,8 +166,6 @@ public class PlanServiceImpl implements PlanService { // 回写序列记录 serialNumberService.updateSerialNumber(serialNumberDO); - // 生成生产计划子项目信息 - List projectOrderSubDOs = projectOrderService.getProjectOrderSubListByProjectOrderId(projectId); for(ProjectOrderSubDO item : projectOrderSubDOs){ PlanSubDO planSubDO = new PlanSubDO(); planSubDO.setProjectPlanId(planDO.getId()); diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue index 7a701abe..1bc9df17 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/plan/edit.vue @@ -106,7 +106,7 @@ - + @@ -166,7 +166,7 @@ + placeholder="工艺开始日期" :disabled="!formData.hasCraft "/> @@ -238,7 +238,7 @@ + placeholder="工艺结束日期" :disabled="!formData.hasCraft " /> @@ -280,9 +280,9 @@ - - + @@ -573,21 +573,21 @@ const submitForm = async () => { data.craftContent = JSON.stringify(data.craftInfos) await PlanApi.updatePlan(data) - formData.value.projectOrderSubs.forEach(item => { + formData.value.projectPlanSubs.forEach(item => { var subData = item as unknown as PlanSubApid.PlanSubVo - subData.projectId = item.projectOrderId - subData.projectPlanId = formData.value.id - subData.projectSubShortName = item.projectSubShortName - subData.projectSubCode = item.projectSubCode - subData.projectSubId = item.id - if (item.planSubId == undefined) { + // subData.projectId = item.projectOrderId + // subData.projectPlanId = formData.value.id + // subData.projectSubShortName = item.projectSubShortName + // subData.projectSubCode = item.projectSubCode + // subData.projectSubId = item.projectSubId + if (subData.id == undefined) { subData.id = 0 - PlanSubApi.createPlanSub(subData) + subData.id = PlanSubApi.createPlanSub(subData) } else { - subData.id = item.planSubId + //subData.id = item.planSubId PlanSubApi.updatePlanSub(subData) } - subData.id = subData.projectSubId + //subData.id = subData.projectSubId }) message.success(t('common.updateSuccess')) // 发送操作成功的事件 @@ -612,23 +612,26 @@ const handleInitPlanSub = async () => { formData.value.projectPlanSubs = (await PlanSubApi.getPlanSubPage(queryParams)).list - formData.value.projectOrderSubs.forEach(item => { - if (formData.value.projectPlanSubs.filter(sub => sub.projectSubId == item.id).length > 0) { - var subTemp = formData.value.projectPlanSubs.find(sub => sub.projectSubId == item.id) - item.planSubId = subTemp.id + formData.value.projectPlanSubs.forEach(item => { + if (formData.value.projectOrderSubs.filter(sub => item.projectSubId == sub.id).length > 0) { + var subTemp = formData.value.projectOrderSubs.find(sub => item.projectSubId == sub.id) + item.planSubId = item.id item.projectPlanId = subTemp.projectPlanId - item.projectId = subTemp.projectId - item.projectSubId = subTemp.projectSubId - item.projectSubShortName = subTemp.projectSubShortName - item.projectSubCode = subTemp.projectSubCode - item.mouldId = subTemp.mouldId - item.equipId = subTemp.equipId - item.blankDate = subTemp.blankDate - item.blankOwner = subTemp.blankOwner - item.twoDimDate = subTemp.twoDimDate - item.twoDimOwner = subTemp.twoDimOwner - item.threeDimDate = subTemp.threeDimDate - item.threeDimOwner = subTemp.threeDimOwner + item.projectId = subTemp.projectOrderId + item.projectSubId = subTemp.id + item.name = subTemp.name + item.compositionName = subTemp.compositionName + item.unit= subTemp.unit + item.amount = subTemp.amount + // item.projectSubCode = subTemp.projectSubCode + // item.mouldId = subTemp.mouldId + // item.equipId = subTemp.equipId + // item.blankDate = subTemp.blankDate + // item.blankOwner = subTemp.blankOwner + // item.twoDimDate = subTemp.twoDimDate + // item.twoDimOwner = subTemp.twoDimOwner + // item.threeDimDate = subTemp.threeDimDate + // item.threeDimOwner = subTemp.threeDimOwner item.equipList = equipInit.value.filter(rg => rg.mould_type_id == subTemp.mouldId) } @@ -649,6 +652,7 @@ onMounted(async () => { equipInit.value = await EquipApi.getSimpList() // 获取库存信息 formData.value = await PlanApi.getPlan(query.id) + formData.value.hasCraft = 1 await handleInitPlanSub()