diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java new file mode 100644 index 00000000..940b3fbe --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java @@ -0,0 +1,107 @@ +package com.op.system.api.domain.dto; + +import java.util.Date; +import java.util.List; + +public class WCSDTO { + + private String reqCode; + + private Date reqTime; + + private String planNo; + + private String code; + + private String message; + + private String factory; + + private String sku; + + private String loadNo; + + private List data; + + private List loadItems; + + public String getLoadNo() { + return loadNo; + } + + public void setLoadNo(String loadNo) { + this.loadNo = loadNo; + } + + public List getLoadItems() { + return loadItems; + } + + public void setLoadItems(List loadItems) { + this.loadItems = loadItems; + } + + public String getSku() { + return sku; + } + + public void setSku(String sku) { + this.sku = sku; + } + + public String getFactory() { + return factory; + } + + public void setFactory(String factory) { + this.factory = factory; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getReqCode() { + return reqCode; + } + + public void setReqCode(String reqCode) { + this.reqCode = reqCode; + } + + public Date getReqTime() { + return reqTime; + } + + public void setReqTime(Date reqTime) { + this.reqTime = reqTime; + } + + public String getPlanNo() { + return planNo; + } + + public void setPlanNo(String planNo) { + this.planNo = planNo; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java new file mode 100644 index 00000000..e2d85219 --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java @@ -0,0 +1,37 @@ +package com.op.system.api.domain.dto; + + +import java.util.List; + +public class WCSDataDTO { + + private String sku; + + private String loadNo; + + private List unLoadItems; + + public String getSku() { + return sku; + } + + public void setSku(String sku) { + this.sku = sku; + } + + public String getLoadNo() { + return loadNo; + } + + public void setLoadNo(String loadNo) { + this.loadNo = loadNo; + } + + public List getUnLoadItems() { + return unLoadItems; + } + + public void setUnLoadItems(List unLoadItems) { + this.unLoadItems = unLoadItems; + } +} diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataItemsDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataItemsDTO.java new file mode 100644 index 00000000..8d22580b --- /dev/null +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataItemsDTO.java @@ -0,0 +1,25 @@ +package com.op.system.api.domain.dto; + + +public class WCSDataItemsDTO { + + private String unloadNo; + + private String loadNo; + + public String getLoadNo() { + return loadNo; + } + + public void setLoadNo(String loadNo) { + this.loadNo = loadNo; + } + + public String getUnloadNo() { + return unloadNo; + } + + public void setUnloadNo(String unloadNo) { + this.unloadNo = unloadNo; + } +} diff --git a/op-common/op-common-log/src/main/java/com/op/common/log/enums/BusinessType.java b/op-common/op-common-log/src/main/java/com/op/common/log/enums/BusinessType.java index 3042c98f..082bafac 100644 --- a/op-common/op-common-log/src/main/java/com/op/common/log/enums/BusinessType.java +++ b/op-common/op-common-log/src/main/java/com/op/common/log/enums/BusinessType.java @@ -60,4 +60,12 @@ public enum BusinessType { * SAP */ SAP, + /** + * WCS请求接料 + */ + WCS_requestMaterialLoadNo, + /** + * WCS + */ + WCS } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java new file mode 100644 index 00000000..d9628cd1 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java @@ -0,0 +1,73 @@ +package com.op.mes.controller; + +import com.op.common.core.utils.StringUtils; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.system.api.domain.dto.WCSDTO; +import com.op.mes.service.IWCSInterfaceService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 工厂数据库Controller + * + * @author sf + * @date 2023-05-18 + */ +@RestController +@RequestMapping +public class WCSInterfaceController extends BaseController { + + @Autowired + private IWCSInterfaceService WCInterfaceService; + /** + * 接料请求 + * @param + * @return + */ + @Log(title = "请求接料", businessType = BusinessType.WCS_requestMaterialLoadNo) + @PostMapping("/requestMaterialLoadNo") + public WCSDTO requestMaterialLoadNo(@RequestBody WCSDTO wcsdto) { + if(StringUtils.isBlank(wcsdto.getFactory())){ + wcsdto.setCode("1"); + wcsdto.setMessage("factory is not null"); + return wcsdto; + } + return WCInterfaceService.requestMaterialLoadNo(wcsdto); + } + + /** + * 接料完成(用不上) + * @param + * @return + */ + @Log(title = "接料完成", businessType = BusinessType.WCS) + @PostMapping("/loadMaterialCompleted") + public WCSDTO loadMaterialCompleted(@RequestBody WCSDTO wcsdto) { + if(StringUtils.isBlank(wcsdto.getFactory())){ + wcsdto.setCode("1"); + wcsdto.setMessage("factory is not null"); + return wcsdto; + } + return WCInterfaceService.loadMaterialCompleted(wcsdto); + } + + /** + * RGV 请求送料 + * @param + * @return + */ + @Log(title = "请求送料", businessType = BusinessType.WCS) + @PostMapping("/requestMaterialUnLoadNo") + public WCSDTO requestMaterialUnLoadNo(@RequestBody WCSDTO wcsdto) { + if(StringUtils.isBlank(wcsdto.getFactory())){ + wcsdto.setCode("1"); + wcsdto.setMessage("factory is not null"); + return wcsdto; + } + return WCInterfaceService.requestMaterialUnLoadNo(wcsdto); + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java new file mode 100644 index 00000000..ff03ef13 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesMapper.java @@ -0,0 +1,20 @@ +package com.op.mes.mapper; + +import com.op.system.api.domain.dto.WCSDTO; +import com.op.system.api.domain.dto.WCSDataItemsDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * Mapper接口 + * + * @author Open Platform + * @date 2023-07-13 + */ +@Mapper +public interface MesMapper { + + + List getWetPlanDetail(WCSDTO wcsdto); +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java new file mode 100644 index 00000000..113b30a9 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java @@ -0,0 +1,21 @@ +package com.op.mes.service; + +import com.op.common.core.web.domain.AjaxResult; +import com.op.system.api.domain.dto.WCSDTO; + +import java.util.List; + +/** + * 订单Service接口 + * + * @author Open Platform + * @date 2023-07-13 + */ +public interface IWCSInterfaceService { + + WCSDTO requestMaterialLoadNo(WCSDTO wcsdto); + + WCSDTO loadMaterialCompleted(WCSDTO wcsdto); + + WCSDTO requestMaterialUnLoadNo(WCSDTO wcsdto); +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java new file mode 100644 index 00000000..6e6d0247 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -0,0 +1,109 @@ +package com.op.mes.service.impl; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.op.mes.mapper.MesMapper; +import com.op.mes.service.IWCSInterfaceService; +import com.op.system.api.domain.dto.WCSDTO; +import com.op.system.api.domain.dto.WCSDataItemsDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 订单Service业务层处理 + * + * @author Open Platform + * @date 2023-07-13 + */ +@Service +public class IWCInterfaceServiceImpl implements IWCSInterfaceService { + + @Value("${wcs.url2}") + public String requestMaterialLoadNoUrl; + @Autowired + private MesMapper mesMapper; + /** + * RGV请求接料 + * { + * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID + * "reqTime": "2023-06-30 21:24:04", //请求时间 + * "sku": "sku01" //物料编码 + * “factory”:"工厂编码" + * } + * 返回 + * { + * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求编号 + * "code": 0, //返回代码 + * "message": "OK", //返回信息 + * "loadItems": [ + * { + * "loadNo": "A1" //上料机台,上料罐 + * }, + * { + * "loadNo": "A2" //上料机台,上料罐 + * } + * ] + * } + * @param wcsdto + * @return + */ + @Override + public WCSDTO requestMaterialLoadNo(WCSDTO wcsdto) { + DynamicDataSourceContextHolder.push(wcsdto.getFactory()); + //获取湿料计划 + List loadItems = mesMapper.getWetPlanDetail(wcsdto); + WCSDTO dto = new WCSDTO(); + dto.setLoadItems(loadItems); + dto.setReqCode(wcsdto.getReqCode()); + dto.setCode("0"); + dto.setMessage("OK"); + return dto; + } + /** RGV 接料完成(我不要) + * { + * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID + * "reqTime": "2023-06-30 21:24:04",//请求时间 + * "loadNo": "A1"//接料 + * "factory":工厂编码 + * } + * 返回 + * { + * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID + * "code": 0,//返回代码 + * "message": "OK"//返回信息 + * } + */ + @Override + public WCSDTO loadMaterialCompleted(WCSDTO wcsdto) { + return null; + } + /**RGV 请求送料 + { + "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID + "reqTime": "2023-06-30 21:24:04", //请求时间 + "sku": "sku01" //对应的湿料的物料编码 + } + + JSON + { + "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID + "code": 0,//返回代码 + "message": "OK",//返回信息 + "unLoadItems": [ + { + "unloadNo": "B1"//送料机台,成型机 + }, + { + "unloadNo": "B2"//送料机台,成型机 + } + ] + } + **/ + @Override + public WCSDTO requestMaterialUnLoadNo(WCSDTO wcsdto) { + return null; + } + +} diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml new file mode 100644 index 00000000..a221fd07 --- /dev/null +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesMapper.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java index a94335e3..f6c0ed94 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProWetMaterialPlanController.java @@ -186,12 +186,9 @@ public class ProWetMaterialPlanController extends BaseController { * @return */ @Log(title = "湿料计划同步", businessType = BusinessType.EXPORT) - @PostMapping("/syncWCS") + @GetMapping("/syncWCS/{id}") @RequiresPermissions("mes:plan:add") - public AjaxResult syncWCS(@PathVariable String[] ids) { - if(ids==null||ids.length==0){ - return error("没有获取到湿料计划"); - } - return proWetMaterialPlanService.syncWCS(ids); + public AjaxResult syncWCS(@PathVariable String id) { + return proWetMaterialPlanService.syncWCS(id); } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java index d080dcd2..8801013e 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/dto/WCSDTO.java @@ -15,6 +15,8 @@ public class WCSDTO { private String message; + private List data; + public String getCode() { return code; } @@ -31,8 +33,6 @@ public class WCSDTO { this.message = message; } - private List data; - public String getReqCode() { return reqCode; } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index 025f3792..ae831a71 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -3,6 +3,7 @@ package com.op.plan.mapper; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.plan.domain.ProOrderWorkorder; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; @@ -96,14 +97,13 @@ public interface ProOrderWorkorderMapper { String selectEndWorkOrder(String id); ProOrderWorkorder selectWorkOrderByCode(String workorderCode); - - /** - * 下发生产订单 - **/ + /**下发生产订单**/ public int downProOrderWorkorderByWorkorderIds(String[] workorderIds); public List getWorkOrderByIds(String[] workorderIds); + String getBucketCodeByWorkId(@Param("workorderId") String workorderId); + /** * 通过订单Code查询工单list * diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanMapper.java index 8282edc0..5f048d8d 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProWetMaterialPlanMapper.java @@ -3,10 +3,12 @@ package com.op.plan.mapper; import java.util.Date; import java.util.List; +import com.op.common.core.web.domain.AjaxResult; import com.op.plan.domain.BMS; import com.op.plan.domain.Bucket; import com.op.plan.domain.ProWetMaterialPlan; import com.op.plan.domain.Product; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** @@ -15,6 +17,7 @@ import org.apache.ibatis.annotations.Param; * @author Open Platform * @date 2023-07-24 */ +@Mapper public interface ProWetMaterialPlanMapper { /** * 查询湿料计划管理 @@ -119,4 +122,5 @@ public interface ProWetMaterialPlanMapper { * @return */ String selectBucketNameById(String bucketId); + } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java index 5b1c78b2..c98d7b87 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProWetMaterialPlanService.java @@ -126,5 +126,5 @@ public interface IProWetMaterialPlanService { */ AjaxResult checkChangePlan(String id); - AjaxResult syncWCS(@PathVariable String[] ids); + AjaxResult syncWCS(@PathVariable String id); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 2472da04..b9bccba6 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -255,7 +255,8 @@ public class ProOrderServiceImpl implements IProOrderService { proOrder = new ProOrder(); BeanUtils.copyProperties(sapProOrder, proOrder); //pro_order_workorder - List orderExit = proOrderMapper.selectProOrderList(proOrder); + + List orderExit = proOrderWorkorderMapper.selectWorkOrderByOrderCode(proOrder.getOrderCode()); if (CollectionUtils.isEmpty(orderExit)) {//不存在就插入 proOrderMapper.insertProOrder(proOrder); } else if ("w0".equals(orderExit.get(0).getStatus())) { diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java index b1cabfc6..c1293e46 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProWetMaterialPlanServiceImpl.java @@ -1,9 +1,9 @@ package com.op.plan.service.impl; import java.util.*; +import java.util.stream.Collectors; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; @@ -12,9 +12,11 @@ import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.plan.domain.*; import com.op.plan.domain.dto.WCSDTO; +import com.op.plan.domain.dto.WCSDataDTO; +import com.op.plan.domain.dto.WCSDataItemsDTO; import com.op.plan.mapper.ProOrderWorkorderMapper; import com.op.plan.mapper.ProWetMaterialPlanDetailMapper; -import com.op.system.api.RemoteSapService; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -33,7 +35,7 @@ import static com.op.common.core.web.domain.AjaxResult.success; /** * 湿料计划管理Service业务层处理 * - * @author Open Platform + * @author zxl * @date 2023-07-24 */ @Service @@ -46,7 +48,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; @Value("${wcs.url1}") - public String requestMaterialLoadNoUrl; + public String materialPlanSyncUrl; /** * 查询湿料计划管理 * @@ -305,21 +307,63 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService * } */ @Override + @DS("#header.poolName") @Transactional(rollbackFor = Exception.class) - public AjaxResult syncWCS(@PathVariable String[] ids) { - String successid = ""; - for(String id:ids){ + public AjaxResult syncWCS(@PathVariable String id) { + //获取湿料计划 WCSDTO wcsdto = new WCSDTO(); wcsdto.setReqCode(id);//主计划id wcsdto.setReqTime(DateUtils.getNowDate()); List planDetails = proWetMaterialPlanDetailMapper.selectDetailListById(id); + //罐 + List gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode) + .distinct().collect(Collectors.toList()); + //罐-料 + Map glMap = planDetails.stream() + .collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode, + ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1)); - String sendResult = HttpUtils.sendPost(requestMaterialLoadNoUrl, JSON.toJSONString(wcsdto)); - WCSDTO resultdto = JSON.parseObject(sendResult,WCSDTO.class); - } - return success(successid+"同步成功"); + List data = new ArrayList<>(); + WCSDataDTO wCSDataDTO = null; + for (String g : gList) { + wCSDataDTO = new WCSDataDTO(); + wCSDataDTO.setSku(glMap.get(g));//罐 + wCSDataDTO.setLoadNo(g);//料 + List unLoadItems = new ArrayList<>();//上位机集合 + //罐-工单 + List ggList = planDetails.stream() + .filter(plan -> plan.getBucketCode().equals(g)) + .collect(Collectors.toList()); + WCSDataItemsDTO wCSDataItemsDTO = null; + for (ProWetMaterialPlanDetail gg : ggList) { + //根据工单查收坯机编码 + String bucketCode = proOrderWorkorderMapper.getBucketCodeByWorkId(gg.getWorkorderId()); + if (StringUtils.isNotBlank(bucketCode)) { + wCSDataItemsDTO = new WCSDataItemsDTO(); + wCSDataItemsDTO.setUnloadNo(bucketCode); + unLoadItems.add(wCSDataItemsDTO); + } + } + wCSDataDTO.setUnLoadItems(unLoadItems); + } + wcsdto.setData(data); + try { + String sendResult = HttpUtils.sendPost(materialPlanSyncUrl, JSON.toJSONString(wcsdto)); + WCSDTO resultdto = JSON.parseObject(sendResult, WCSDTO.class); + if ("1".equals(resultdto.getCode())) { + return error(resultdto.getMessage()); + } + }catch (Exception e){ + return error("调用接口异常"); + } + + ProWetMaterialPlan detail = new ProWetMaterialPlan(); + detail.setId(id); + detail.setSyncFlag("Y");//已经同步的标识 + proWetMaterialPlanMapper.updateProWetMaterialPlan(detail); + return success(); } /** @@ -411,9 +455,28 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService } public static void main(String args[]){ - String s2="{\"reqTime\":\"2022-07-10 19:39:07.377\",\"reqCode\":\"dbee4f0c-ced7-463f-b19b-c83234cbd5b0\"}"; - WCSDTO ps2= JSON.parseObject(s2,WCSDTO.class); - System.out.println(ps2); - + List planDetails = new ArrayList<>(); + ProWetMaterialPlanDetail d1=new ProWetMaterialPlanDetail(); + d1.setBucketCode("LG1"); + d1.setMaterialCode("WL00001"); + planDetails.add(d1); + ProWetMaterialPlanDetail d2=new ProWetMaterialPlanDetail(); + d2.setBucketCode("LG2"); + d2.setMaterialCode("WL00002"); + planDetails.add(d2); + ProWetMaterialPlanDetail d3=new ProWetMaterialPlanDetail(); + d3.setBucketCode("LG1"); + d3.setMaterialCode("WL00001"); + planDetails.add(d3); + //罐 + // List gList = planDetails.stream().map(ProWetMaterialPlanDetail::getBucketCode).distinct().collect(Collectors.toList()); +// +// List glList = planDetails.stream() +// .map(e -> new ProWetPlanDetailDTO(e.getBucketCode(), e.getMaterialCode())) +// .collect(Collectors.toList()); + //罐-料 + Map mapStream = planDetails.stream() + .collect(Collectors.toMap(ProWetMaterialPlanDetail::getBucketCode,ProWetMaterialPlanDetail::getMaterialCode, (k1, k2) -> k1)); + System.out.println(mapStream); } } diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index 203dd245..c6f2f5f1 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -39,7 +39,11 @@ - select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, prod_type, factory_code , is_end from pro_order_workorder + select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name, + product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date, + shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, + update_by, update_time, prod_type, factory_code , is_end + from pro_order_workorder + @@ -82,8 +86,13 @@ where wet_material_plan_id = #{id} and status = 'Y' - + select id, factory_code, wet_material_plan_id, workorder_id, atrr1, atrr2, atrr3, status, + create_by, create_time, update_by, update_time, bucket_id, bucket_code, + material_code, material_id, material_name, product_name, shift_id, + shift_code, shift_desc, plan_time + from pro_wet_material_plan_detail + where wet_material_plan_id = #{id} diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml index 03c258f6..ccf19338 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProWetMaterialPlanMapper.xml @@ -172,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - + delete from pro_wet_material_plan where id = #{id}