diff --git a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java index f440d103..ed2cb9fb 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/controller/SapController.java @@ -66,6 +66,9 @@ public class SapController extends BaseController { @Autowired private SapWmsService sapWmsService; + @Autowired + private SapDeviceService sapDeviceService; + @Resource private DynamicDatasourceCreator dynamicDatasourceCreator; @Resource @@ -522,6 +525,13 @@ public class SapController extends BaseController { return sapItemSyncService.sap105temporarilyCollected(mapList); } +/*******************设备*****************/ + @PostMapping("/sapZmesAnlaGet") + @Log(title = "设备同步接口", businessType = BusinessType.SAP) + public R sapZmesAnlaGet(@RequestBody(required = false) Map paramMap) { + return sapDeviceService.sapZmesAnlaGet(paramMap); + } + @PostMapping("/addDatasource") public R addDatasource(@RequestBody DataSourcePropertyDTO dto){ DataSourceProperty dataSourceProperty = new DataSourceProperty(); @@ -538,5 +548,11 @@ public class SapController extends BaseController { return R.ok(); } + //白坯的未清采购订单数量 ZMES_PURWQ_GET + @PostMapping("/ZmesPurwqGet") + @Log(title = "白坯的未清采购订单数量", businessType = BusinessType.SAP) + public R ZmesPurwqGet(@RequestBody(required = false) Map paramMap) { + return sapItemSyncService.ZmesPurwqGet(paramMap); + } } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java b/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java new file mode 100644 index 00000000..ed2784fa --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/domain/vo/SapWBDemand.java @@ -0,0 +1,60 @@ +package com.op.sap.domain.vo; + +import java.util.Date; + +public class SapWBDemand { + private String werks;///工厂 + private String matnr;//物料号 + private String maktx;//物料描述 + private Double menge;//数量 + private String meins;//单位 + private Date bedat;//最早的采购订单日期 + + public String getWerks() { + return werks; + } + + public void setWerks(String werks) { + this.werks = werks; + } + + public String getMatnr() { + return matnr; + } + + public void setMatnr(String matnr) { + this.matnr = matnr; + } + + public String getMaktx() { + return maktx; + } + + public void setMaktx(String maktx) { + this.maktx = maktx; + } + + public Double getMenge() { + return menge; + } + + public void setMenge(Double menge) { + this.menge = menge; + } + + public String getMeins() { + return meins; + } + + public void setMeins(String meins) { + this.meins = meins; + } + + public Date getBedat() { + return bedat; + } + + public void setBedat(Date bedat) { + this.bedat = bedat; + } +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapDeviceMapper.java b/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapDeviceMapper.java new file mode 100644 index 00000000..30d68849 --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/mapper/SapDeviceMapper.java @@ -0,0 +1,8 @@ +package com.op.sap.mapper; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SapDeviceMapper { + +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapDeviceService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapDeviceService.java new file mode 100644 index 00000000..4eb4851f --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapDeviceService.java @@ -0,0 +1,10 @@ +package com.op.sap.service; + +import com.op.common.core.domain.R; + +import java.util.Map; + +public interface SapDeviceService { + + R sapZmesAnlaGet(Map paramMap); +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java index 7c1469b1..594f7732 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/SapItemSyncService.java @@ -40,4 +40,6 @@ public interface SapItemSyncService { R temporarilyCollected(List mapList); R sap105temporarilyCollected(List mapList); + + R ZmesPurwqGet(Map paramMap); } diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapDeviceServiceImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapDeviceServiceImpl.java new file mode 100644 index 00000000..ac6ae639 --- /dev/null +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapDeviceServiceImpl.java @@ -0,0 +1,72 @@ +package com.op.sap.service.impl; + + +import com.alibaba.fastjson2.JSONObject; +import com.op.common.core.constant.Constants; +import com.op.common.core.domain.R; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.sap.mapper.SapDeviceMapper; +import com.op.sap.service.SapDeviceService; +import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; +import com.sap.conn.jco.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import javax.validation.Validator; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Component +@Service +public class SapDeviceServiceImpl implements SapDeviceService { + @Autowired + private SapDeviceMapper sapDeviceMapper; + @Autowired + protected Validator validator; + + @Autowired + private JCoDestination dest; + + private static final Logger log = LoggerFactory.getLogger(SapItemSyncImpl.class); + + + @Override + public R sapZmesAnlaGet(Map paramMap) { + try { + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_ANLA_GET"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + log.info("设备同步参数-------" + paramMap.toString()); + //参数 + JCoParameterList jCoParameterList = func.getImportParameterList(); + jCoParameterList.setValue("P_SERNR", paramMap.get("P_SERNR")); + func.execute(dest);//执行调用函数 + JCoTable maraTable = func.getTableParameterList().getTable("L_ANLA"); + for (int i = 0; i < maraTable.getNumRows(); i++) { + maraTable.setRow(i); + String BUKRS = maraTable.getString("BUKRS"); + String ANLN1 = maraTable.getString("ANLN1"); + String ANLN2 = maraTable.getString("ANLN2"); + String TXT50 = maraTable.getString("TXT50"); + String SERNR = maraTable.getString("SERNR"); + String INVZU = maraTable.getString("INVZU"); + System.out.println("公司代码"+BUKRS+"主资产号"+ANLN1+"资产次级编号"+ANLN2+"资产描述"+TXT50+"序列号"+SERNR+"补充库存说明"+INVZU); + } + return R.ok(); + + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } +} diff --git a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java index 0884afda..83d9b05f 100644 --- a/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java +++ b/op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java @@ -10,6 +10,7 @@ import com.op.common.core.utils.StringUtils; import com.op.common.core.utils.bean.BeanValidators; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; +import com.op.sap.domain.vo.SapWBDemand; import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO; import com.op.system.api.domain.sap.SapBackflushMPQuery; import com.op.sap.domain.vo.SapItemQuery; @@ -208,7 +209,7 @@ public class SapItemSyncImpl implements SapItemSyncService { baseProduct.setUpdateBy(SecurityUtils.getUsername()); sapBaseProductList.add(baseProduct); } - //this.importProducts(sapBaseProductList) + return R.ok(this.importProducts(sapBaseProductList,sapItemQuery.getWerks())); } catch (Exception e) { return R.fail(e.getMessage()); @@ -809,5 +810,51 @@ public class SapItemSyncImpl implements SapItemSyncService { } } + @Override + public R ZmesPurwqGet(Map paramMap) { + try { + JCoRepository repository = dest.getRepository(); + JCoFunction func = repository.getFunction("ZMES_PURWQ_GET"); + if (func == null) { + throw new RuntimeException("Function does not exist in SAP"); + } + log.info("白坯的未清采购订单数量-------" + paramMap.toString()); + //参数 + JCoParameterList jCoParameterList = func.getImportParameterList(); + jCoParameterList.setValue("P_WERKS", paramMap.get("werks")); + + func.execute(dest);//执行调用函数 + JCoTable maraTable = func.getTableParameterList().getTable("LT_PURWQ"); + String RETCODE = func.getExportParameterList().getString("RETCODE"); + String RETMSG = func.getExportParameterList().getString("RETMSG"); + List sapWBDemandList=new ArrayList<>(); + if(Constants.LOGIN_SUCCESS_STATUS.equals(RETCODE)){ + for (int i = 0; i < maraTable.getNumRows(); i++) { + maraTable.setRow(i); + SapWBDemand sapWBDemand=new SapWBDemand(); + String WERKS = maraTable.getString("WERKS");///工厂 + String MATNR = maraTable.getString("MATNR");//物料号 + String MAKTX = maraTable.getString("MAKTX");//物料描述 + Double MENGE = maraTable.getDouble("MENGE");//数量 + String MEINS = maraTable.getString("MEINS");//单位 + Date BEDAT = maraTable.getDate("BEDAT");//最早的采购订单日期 + sapWBDemand.setWerks(WERKS); + sapWBDemand.setMatnr(MATNR); + sapWBDemand.setMaktx(MAKTX); + sapWBDemand.setMenge(MENGE); + sapWBDemand.setMeins(MEINS); + sapWBDemand.setBedat(BEDAT); + sapWBDemandList.add(sapWBDemand); + } + return R.ok(sapWBDemandList,RETMSG); + }else { + return R.fail(RETMSG); + } + + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail(e.getMessage()); + } + } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSInterfaceContorller.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSInterfaceContorller.java index 989f1c7e..c6725e7f 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSInterfaceContorller.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSInterfaceContorller.java @@ -1,17 +1,25 @@ package com.op.wms.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.core.web.page.TableDataInfo; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.wms.domain.BaseTeamT; +import com.op.wms.domain.ProOrderWorkorder; import com.op.wms.domain.WmsToWCSDTO; import com.op.wms.service.IWmsToWCSInterfaceService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +import static com.op.common.core.utils.PageUtils.startPage; +import static com.op.common.core.web.domain.AjaxResult.success; @RestController @RequestMapping("/WmsToWCSInterface") -public class WmsToWCSInterfaceContorller { +public class WmsToWCSInterfaceContorller extends BaseController { @Autowired private IWmsToWCSInterfaceService wmsToWCSInterfaceService; @@ -111,5 +119,25 @@ public class WmsToWCSInterfaceContorller { return wmsToWCSInterfaceService.blankDesignatedPalletOutbound(wcsdto); } + /** + * 查询生产工单列表 + */ + + @GetMapping("/listNe") + public TableDataInfo listNe(ProOrderWorkorder proOrderWorkorder) { + startPage(); + List list = wmsToWCSInterfaceService.selectProOrderWorkorderList(proOrderWorkorder); + return getDataTable(list); + } + /** + * 通过子工单code查询并返回所有级联工单 + * + * @param code + * @return + */ + @GetMapping("/getWorkOrders/{code}") + public AjaxResult getWorkOrders(@PathVariable("code") String code) { + return wmsToWCSInterfaceService.getWorkOrders(code); + } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/CascaderDTO.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/CascaderDTO.java new file mode 100644 index 00000000..5dfffff0 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/CascaderDTO.java @@ -0,0 +1,73 @@ +package com.op.wms.domain; + +import java.io.Serializable; +import java.util.List; + +/** + * Treeselect树结构实体类 + * + * @author OP + */ +public class CascaderDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 节点ID + */ + private Long id; + + private String value; + + /** + * 节点名称 + */ + private String label; + + /** + * 子节点 + */ + private List children; +// +// public TreeSelect() { +// +// } +// +// public TreeSelect(SysDept dept) { +// this.id = dept.getDeptId(); +// this.label = dept.getDeptName(); +// this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); +// } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/ProOrderWorkorder.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/ProOrderWorkorder.java index fd46a2b8..4e3bf063 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/ProOrderWorkorder.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/ProOrderWorkorder.java @@ -34,6 +34,8 @@ public class ProOrderWorkorder extends TreeEntity { */ @Excel(name = "sap工单编码") private String workorderCodeSap; + private String carNum; + private String sortNo; public String getWorkorderCodeSap() { return workorderCodeSap; @@ -109,6 +111,17 @@ public class ProOrderWorkorder extends TreeEntity { @Excel(name = "工艺编码") private String routeCode; + // 工艺名称 + private String routeName; + + public String getRouteName() { + return routeName; + } + + public void setRouteName(String routeName) { + this.routeName = routeName; + } + /** * 产线编码 */ @@ -172,13 +185,23 @@ public class ProOrderWorkorder extends TreeEntity { */ @Excel(name = "预留字段3") private String attr3; + private String atrr2; + + public String getAtrr2() { + return atrr2; + } + + public void setAtrr2(String atrr2) { + this.atrr2 = atrr2; + } /** * 预留字段4 */ @Excel(name = "预留字段4") private String attr4; - + private String sapName; + private String sapCode; /** * 产品类型 */ @@ -190,6 +213,71 @@ public class ProOrderWorkorder extends TreeEntity { private String attribute2; private String attribute3; private String waCode; + private String statusArray; + + public String getStatusArray() { + return statusArray; + } + + public void setStatusArray(String statusArray) { + this.statusArray = statusArray; + } + + public String getCarNum() { + return carNum; + } + + public void setCarNum(String carNum) { + this.carNum = carNum; + } + + public String getSortNo() { + return sortNo; + } + + public void setSortNo(String sortNo) { + this.sortNo = sortNo; + } + + public String getSapName() { + return sapName; + } + + public void setSapName(String sapName) { + this.sapName = sapName; + } + + public String getSapCode() { + return sapCode; + } + + public void setSapCode(String sapCode) { + this.sapCode = sapCode; + } + + public String getPworkorderCodeSap() { + return pworkorderCodeSap; + } + + public void setPworkorderCodeSap(String pworkorderCodeSap) { + this.pworkorderCodeSap = pworkorderCodeSap; + } + + public String getPproductCode() { + return pproductCode; + } + + public void setPproductCode(String pproductCode) { + this.pproductCode = pproductCode; + } + + public String getPproductName() { + return pproductName; + } + + public void setPproductName(String pproductName) { + this.pproductName = pproductName; + } public String getWaCode() { return waCode; @@ -285,7 +373,9 @@ public class ProOrderWorkorder extends TreeEntity { // 物料id(湿料计划模块使用) private Integer materialId; - + private String pworkorderCodeSap; + private String pproductCode; + private String pproductName; // 物料编码(湿料计划模块使用) private String materialCode; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/ProWetMaterialPlanDetail.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/ProWetMaterialPlanDetail.java new file mode 100644 index 00000000..15afae0f --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/ProWetMaterialPlanDetail.java @@ -0,0 +1,329 @@ +package com.op.wms.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 配料计划明细对象 pro_wet_material_plan_detail + * + * @author Open Platform + * @date 2023-07-27 + */ +public class ProWetMaterialPlanDetail extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 计划工厂编码 + */ + @Excel(name = "计划工厂编码") + private String factoryCode; + + /** + * 配料计划id + */ + @Excel(name = "配料计划id") + private String wetMaterialPlanId; + + /** + * 工单id + */ + @Excel(name = "工单id") + private String workorderId; + + /** + * + */ + private String atrr1; + + /** + * + */ + private String atrr2; + + /** + * + */ + private String atrr3; + + /** + * 1接料完成0未接料 + */ + @Excel(name = "是否接料", readConverterExp = "N=未接料,Y=已接料") + private String status; + + /** + * 料罐id + */ + private String bucketId; + + /** + * 料罐编码 + */ + @Excel(name = "料罐编码") + private String bucketCode; + + /** + * 物料编码 + */ + private String materialCode; + + /** + * 物料id + */ + private String materialId; + + /** + * 物料名称 + */ + @Excel(name = "物料名称") + private String materialName; + + /** + * 产品名称 + */ + @Excel(name = "产品名称") + private String productName; + + /** + * 班次id + */ + private Long shiftId; + + /** + * 班次编码 + */ + private String shiftCode; + + /** + * 班次简称 + */ + @Excel(name = "班次简称") + private String shiftDesc; + + /** + * 计划日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 1) + private Date planTime; + + // 工单编码 + private String workorderCode; + + + // 工单日期 + @JsonFormat(pattern = "yyyy-MM-dd") + private Date productDate; + + // 料罐名称 + private String bucketName; + + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getFactoryCode() { + return factoryCode; + } + + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getWetMaterialPlanId() { + return wetMaterialPlanId; + } + + public void setWetMaterialPlanId(String wetMaterialPlanId) { + this.wetMaterialPlanId = wetMaterialPlanId; + } + + public String getWorkorderId() { + return workorderId; + } + + public void setWorkorderId(String workorderId) { + this.workorderId = workorderId; + } + + public String getAtrr1() { + return atrr1; + } + + public void setAtrr1(String atrr1) { + this.atrr1 = atrr1; + } + + public String getAtrr2() { + return atrr2; + } + + public void setAtrr2(String atrr2) { + this.atrr2 = atrr2; + } + + public String getAtrr3() { + return atrr3; + } + + public void setAtrr3(String atrr3) { + this.atrr3 = atrr3; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getBucketId() { + return bucketId; + } + + public void setBucketId(String bucketId) { + this.bucketId = bucketId; + } + + public String getBucketCode() { + return bucketCode; + } + + public void setBucketCode(String bucketCode) { + this.bucketCode = bucketCode; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + + public String getMaterialId() { + return materialId; + } + + public void setMaterialId(String materialId) { + this.materialId = materialId; + } + + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getShiftId() { + return shiftId; + } + + public void setShiftId(Long shiftId) { + this.shiftId = shiftId; + } + + public String getShiftCode() { + return shiftCode; + } + + public void setShiftCode(String shiftCode) { + this.shiftCode = shiftCode; + } + + public String getShiftDesc() { + return shiftDesc; + } + + public void setShiftDesc(String shiftDesc) { + this.shiftDesc = shiftDesc; + } + + public Date getPlanTime() { + return planTime; + } + + public void setPlanTime(Date planTime) { + this.planTime = planTime; + } + + public String getWorkorderCode() { + return workorderCode; + } + + public void setWorkorderCode(String workorderCode) { + this.workorderCode = workorderCode; + } + + public Date getProductDate() { + return productDate; + } + + public void setProductDate(Date productDate) { + this.productDate = productDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("factoryCode", getFactoryCode()) + .append("wetMaterialPlanId", getWetMaterialPlanId()) + .append("workorderId", getWorkorderId()) + .append("atrr1", getAtrr1()) + .append("atrr2", getAtrr2()) + .append("atrr3", getAtrr3()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("bucketId", getBucketId()) + .append("bucketCode", getBucketCode()) + .append("materialCode", getMaterialCode()) + .append("materialId", getMaterialId()) + .append("materialName", getMaterialName()) + .append("productName", getProductName()) + .append("shiftId", getShiftId()) + .append("shiftCode", getShiftCode()) + .append("shiftDesc", getShiftDesc()) + .append("planTime", getPlanTime()) + .append("workorderCode", getWorkorderCode()) + .append("productDate", getProductDate()) + .append("bucketName", getBucketName()) + .toString(); + } +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderMapper.java new file mode 100644 index 00000000..828d9938 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderMapper.java @@ -0,0 +1,22 @@ +package com.op.wms.mapper; + +import com.op.wms.domain.CascaderDTO; +import org.apache.ibatis.annotations.MapKey; + + + +import java.util.Map; + +/** + * 订单Mapper接口 + * + * @author Open Platform + * @date 2023-07-13 + */ + +public interface ProOrderMapper { + + + @MapKey("value") + Map getEquipInfoByCodes(String equipCodes); +} diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderWorkorderMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderWorkorderMapper.java new file mode 100644 index 00000000..191547d3 --- /dev/null +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/ProOrderWorkorderMapper.java @@ -0,0 +1,30 @@ +package com.op.wms.mapper; + + +import com.op.wms.domain.ProOrderWorkorder; +import com.op.wms.domain.ProWetMaterialPlanDetail; + + + +import java.util.List; + +/** + * 生产工单Mapper接口 + * + * @author Open Platform + * @date 2023-07-18 + */ + +public interface ProOrderWorkorderMapper { + + List selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder); + + ProWetMaterialPlanDetail getWetMaterial(String workorderId); + + List selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder); + + String selectRouteNameByRouteCode(String routeCode); + + ProOrderWorkorder selectWorkOrderByCode(String code); +} + diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsToWCSInterfaceMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsToWCSInterfaceMapper.java index 5956bae8..a59f80a5 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsToWCSInterfaceMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsToWCSInterfaceMapper.java @@ -1,7 +1,12 @@ package com.op.wms.mapper; +import com.op.wms.domain.ProOrderWorkorder; +import com.op.wms.domain.ProWetMaterialPlanDetail; import com.op.wms.domain.WmsToWCSDTO; +import java.util.List; + public interface WmsToWCSInterfaceMapper { WmsToWCSDTO selectWmsToWCSDTO(WmsToWCSDTO wcsdto); + } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsToWCSInterfaceService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsToWCSInterfaceService.java index 53250efe..82954fc3 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsToWCSInterfaceService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsToWCSInterfaceService.java @@ -1,7 +1,11 @@ package com.op.wms.service; +import com.op.common.core.web.domain.AjaxResult; +import com.op.wms.domain.ProOrderWorkorder; import com.op.wms.domain.WmsToWCSDTO; +import java.util.List; + public interface IWmsToWCSInterfaceService { WmsToWCSDTO requestMaterialLoadNo(WmsToWCSDTO wcsdto); @@ -12,4 +16,8 @@ public interface IWmsToWCSInterfaceService { WmsToWCSDTO issuanceOfBlankOutboundDemand(WmsToWCSDTO wcsdto); WmsToWCSDTO blankDesignatedPalletOutbound(WmsToWCSDTO wcsdto); + + List selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder); + + AjaxResult getWorkOrders(String code); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index 30a45016..af94faad 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -628,7 +628,6 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { public ProOrderWorkorder selectWmsOdsWhiteEmbryoInhAnd(WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIns) { //pro order workorder //ipro order workorder batch - DynamicDataSourceContextHolder.push("ds_" + wmsOdsWhiteEmbryoIns.getSiteCode()); ProOrderWorkorder proOrderWorkorder= wmsOdsWhiteEmbryoInMapper.selectProOrderWorkorder(wmsOdsWhiteEmbryoIns); if (proOrderWorkorder!=null){ @@ -644,6 +643,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { proOrderWorkorder.setProOrderWorkorderBatchList(proOrderWorkorderBatchList); } + proOrderWorkorder.setUnit("辆"); return proOrderWorkorder; } @@ -693,6 +693,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { wmsOdsEmStorageNewsSn.setCreateBy(wmsOdsWhiteEmbryoIn.getCreateBy()); wmsOdsEmStorageNewsSn.setGmtCreate(new Date()); wmsOdsEmStorageNewsSn.setActiveFlag("1"); + wmsOdsEmStorageNewsSn.setUserDefined1(wmsOdsWhiteEmbryoIn.getOrderCode()); wmsOdsEmStorageNewsSn.setFactoryCode(wmsOdsWhiteEmbryoIn.getSiteCode()); wmsOdsEmStorageNewsSnMapper.insertWmsOdsEmStorageNewsSn(wmsOdsEmStorageNewsSn); WmsOdsEmStorageNews wmsOdsEmStorageNews=new WmsOdsEmStorageNews(); diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsToWCSInterfaceServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsToWCSInterfaceServiceImpl.java index 882981c8..4b19e620 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsToWCSInterfaceServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsToWCSInterfaceServiceImpl.java @@ -1,18 +1,27 @@ package com.op.wms.service.impl; +import com.alibaba.fastjson2.JSONArray; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.core.web.domain.AjaxResult; import com.op.wms.domain.*; import com.op.wms.mapper.*; import com.op.wms.service.IWmsToWCSInterfaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; + +import static com.op.common.core.web.domain.AjaxResult.success; @Service public class WmsToWCSInterfaceServiceImpl implements IWmsToWCSInterfaceService { @@ -26,6 +35,10 @@ public class WmsToWCSInterfaceServiceImpl implements IWmsToWCSInterfaceService { private WmsOdsEmStorageNewsMapper wmsOdsEmStorageNewsMapper; @Autowired private OdsWhiteEmbryoMapper odsWhiteEmbryoMapper; + @Autowired + private ProOrderMapper proOrderMapper; + @Autowired + private ProOrderWorkorderMapper proOrderWorkorderMapper; @Override @DS("#header.poolName") @@ -144,4 +157,72 @@ public class WmsToWCSInterfaceServiceImpl implements IWmsToWCSInterfaceService { return null; } + + @Override + @DS("#header.poolName") + public List selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) { + List workorderList = null; + String key = "#header.poolName"; + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String factoryCode = request.getHeader(key.substring(8)).replace("ds_", ""); + if ("999".equals(factoryCode)) { + workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList999(proOrderWorkorder); + for (ProOrderWorkorder owork : workorderList) { + ProWetMaterialPlanDetail material = proOrderWorkorderMapper.getWetMaterial(owork.getWorkorderId()); + owork.setMaterialCode(material.getMaterialCode()); + owork.setMaterialName(material.getMaterialName()); + } + } else { + workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder); + } + + for (ProOrderWorkorder workorder : workorderList) { + String prodLineName = ""; + String equipCods = "'"; + System.out.println("workorder_id:" + workorder.getWorkorderId()); + System.out.println("prodLineCode:" + workorder.getProdLineCode()); + JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode()); + for (int c = 0; c < codeArray.size(); c++) { + equipCods += codeArray.getJSONArray(c).getString(1) + "','"; + } + + Map equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 + for (int c = 0; c < codeArray.size(); c++) { + String equipCode = codeArray.getJSONArray(c).getString(1); + CascaderDTO eInfo = equipMap.get(equipCode); + if (eInfo != null) { + prodLineName += eInfo.getLabel() + ","; + } + } + + workorder.setProdLineName(prodLineName); +// // 通过设备code查询出机型名称 +// workorder.setProdLineCode(proOrderMapper.selectProdLineName(workorder.getProdLineCode())); + // 通过工艺编码code查询出机型名称 + workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode())); +// +// //批次信息(母) +// List batchs = proOrderWorkorderMapper.getBatchInfo(workorder.getWorkorderId()); +// workorder.setBatchInfo(batchs); + } + for (ProOrderWorkorder proOrderWorkorder1:workorderList){ + proOrderWorkorder1.setUnit("辆"); + } + return workorderList; + } + + @Override + @DS("#header.poolName") + public AjaxResult getWorkOrders(String code) { + // 创建返回工单列表 + List proOrderWorkorderList = new ArrayList(); + // 查询该工单信息 + ProOrderWorkorder pWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); + proOrderWorkorderList.add(pWorkorder); + for (ProOrderWorkorder proOrderWorkorder1:proOrderWorkorderList){ + proOrderWorkorder1.setUnit("辆"); + } + + return success(proOrderWorkorderList); + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml index bad947c4..ef451c8a 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml @@ -1486,6 +1486,7 @@ user_defined2 userDefined2, create_by createBy, gmt_create createDate, + user_defined4 userDefined4, user_defined3 userDefined3 FROM wms_raw_mission_out diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderMapper.xml new file mode 100644 index 00000000..4ca98f5b --- /dev/null +++ b/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderWorkorderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderWorkorderMapper.xml new file mode 100644 index 00000000..1549da5d --- /dev/null +++ b/op-modules/op-wms/src/main/resources/mapper/wms/ProOrderWorkorderMapper.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 , end_flag , car_num,sort_no,workorder_code_sap + from pro_order_workorder + + + + + + diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsWhiteEmbryoInMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsWhiteEmbryoInMapper.xml index f6c17e30..0a737e56 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsWhiteEmbryoInMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/WmsOdsWhiteEmbryoInMapper.xml @@ -254,6 +254,7 @@ product_date productDate, factory_code factoryCode, prod_type prodType, + attr1, workorder_code_sap workorderCodeSap FROM pro_order_workorder