Merge remote-tracking branch 'origin/master'

master
陈恒杰 5 months ago
commit 6c629a4d84

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

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

@ -0,0 +1,8 @@
package com.op.sap.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SapDeviceMapper {
}

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

@ -40,4 +40,6 @@ public interface SapItemSyncService {
R temporarilyCollected(List<Map> mapList);
R sap105temporarilyCollected(List<Map> mapList);
R ZmesPurwqGet(Map paramMap);
}

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

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

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

@ -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<CascaderDTO> 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<CascaderDTO> getChildren() {
return children;
}
public void setChildren(List<CascaderDTO> children) {
this.children = children;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

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

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

@ -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<String, CascaderDTO> getEquipInfoByCodes(String equipCodes);
}

@ -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<ProOrderWorkorder> selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder);
ProWetMaterialPlanDetail getWetMaterial(String workorderId);
List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder);
String selectRouteNameByRouteCode(String routeCode);
ProOrderWorkorder selectWorkOrderByCode(String code);
}

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

@ -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<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder);
AjaxResult getWorkOrders(String code);
}

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

@ -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<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> 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<String, CascaderDTO> 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<String> 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<ProOrderWorkorder> proOrderWorkorderList = new ArrayList<ProOrderWorkorder>();
// 查询该工单信息
ProOrderWorkorder pWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code);
proOrderWorkorderList.add(pWorkorder);
for (ProOrderWorkorder proOrderWorkorder1:proOrderWorkorderList){
proOrderWorkorder1.setUnit("辆");
}
return success(proOrderWorkorderList);
}
}

@ -1486,6 +1486,7 @@
user_defined2 userDefined2,
create_by createBy,
gmt_create createDate,
user_defined4 userDefined4,
user_defined3 userDefined3
FROM
wms_raw_mission_out

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.ProOrderMapper">
<select id="getEquipInfoByCodes" resultType="com.op.wms.domain.CascaderDTO">
select equipment_code value,equipment_name label from base_equipment where equipment_code in
('${equipCodes}')
</select>
</mapper>

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.ProOrderWorkorderMapper">
<resultMap type="ProOrderWorkorder" id="ProOrderWorkorderResult">
<result property="workorderId" column="workorder_id"/>
<result property="workorderCode" column="workorder_code"/>
<result property="workorderName" column="workorder_name"/>
<result property="orderId" column="order_id"/>
<result property="orderCode" column="order_code"/>
<result property="productId" column="product_id"/>
<result property="productCode" column="product_code"/>
<result property="productName" column="product_name"/>
<result property="productSpc" column="product_spc"/>
<result property="unit" column="unit"/>
<result property="quantityProduced" column="quantity_produced"/>
<result property="quantitySplit" column="quantity_split"/>
<result property="routeCode" column="route_code"/>
<result property="prodLineCode" column="prod_line_code"/>
<result property="productDate" column="product_date"/>
<result property="shiftId" column="shift_id"/>
<result property="parentOrder" column="parent_order"/>
<result property="ancestors" column="ancestors"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="atrr2" column="atrr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="prodType" column="prod_type"/>
<result property="factoryCode" column="factory_code"/>
<result property="endFlag" column="end_flag"/>
<result property="carNum" column="car_num"/>
<result property="sortNo" column="sort_no"/>
<result property="workorderCodeSap" column="workorder_code_sap"/>
<result property="pproductCode" column="pproductCode"/>
<result property="pproductName" column="pproductName"/>
<result property="pworkorderCodeSap" column="pworkorderCodeSap"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="sapCode" column="sap_code"/>
<result property="sapName" column="sap_Name"/>
</resultMap>
<select id="selectProOrderWorkorderList999" resultMap="ProOrderWorkorderResult">
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code, pow.product_id,
pow.product_code, pow.product_name,pow.product_spc, pow.unit, pow.quantity_produced, pow.quantity_split,
pow.route_code, pow.prod_line_code, pow.product_date,pow.shift_id, pow.parent_order, pow.ancestors, pow.status,
pow.remark, pow.attr1, pow.attr2, pow.attr3, pow.attr4, pow.create_by, pow.create_time,
pow.update_by, pow.update_time, pow.prod_type, pow.factory_code , pow.end_flag , pow.car_num,pow.sort_no,
pow.workorder_code_sap
from pro_order_workorder pow
<where>
<if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%',
#{workorderCode}, '%')
</if>
<if test="workorderName != null and workorderName != ''">and pow.workorder_name like concat('%',
#{workorderName}, '%')
</if>
<if test="orderId != null and orderId != ''">and pow.order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''">and pow.order_code like concat('%', #{orderCode}, '%')
</if>
<if test="productId != null and productId != ''">and pow.product_id = #{productId}</if>
<if test="productCode != null and productCode != ''">and pow.product_code like concat('%', #{productCode},
'%')
</if>
<if test="productName != null and productName != ''">and pow.product_name like concat('%', #{productName},
'%')
</if>
<if test="productSpc != null and productSpc != ''">and pow.product_spc = #{productSpc}</if>
<if test="unit != null and unit != ''">and pow.unit = #{unit}</if>
<if test="quantityProduced != null ">and pow.quantity_produced = #{quantityProduced}</if>
<if test="quantitySplit != null ">and pow.quantity_split = #{quantitySplit}</if>
<if test="routeCode != null and routeCode != ''">and pow.route_code = #{routeCode}</if>
<if test="prodLineCode != null and prodLineCode != ''">and pow.prod_line_code = #{prodLineCode}</if>
<if test="productDate != null ">and pow.product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''">and pow.shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''">and pow.parent_order = #{parentOrder}</if>
<if test="ancestors != null and ancestors != ''">and pow.ancestors = #{ancestors}</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="statusArray != null and statusArray != ''">and pow.status in (${statusArray})</if>
<if test="attr1 != null and attr1 != ''">and pow.attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''">and pow.attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''">and pow.attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''">and pow.attr4 = #{attr4}</if>
<if test="prodType != null and prodType != ''">and pow.prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''">and pow.factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''">and pow.end_flag = #{endFlag}</if>
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >=
'${productDateStart}'
</if>
<if test="productDateEnd != null ">and '${productDateEnd}%' >= CONVERT(varchar(10),pow.product_date, 120)
</if>
and pow.del_flag = '0'
</where>
order by pow.product_date desc
</select>
<sql id="selectProOrderWorkorderVo">
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
</sql>
<select id="selectWorkOrderByCode" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where workorder_code = #{workorderCode}
and del_flag = '0'
</select>
<select id="getWetMaterial" resultType="com.op.wms.domain.ProWetMaterialPlanDetail">
select top 1 material_code materialCode,
material_name materialName
from pro_wet_material_plan_detail
where workorder_id = #{workorderId} order by create_time desc
</select>
<select id="selectRouteNameByRouteCode" resultType="java.lang.String">
select route_name from pro_route where route_code = #{routeCode}
</select>
<select id="selectProOrderWorkorderList" parameterType="ProOrderWorkorder" resultMap="ProOrderWorkorderResult">
select pow.workorder_id, pow.workorder_code, pow.workorder_name, pow.order_id, pow.order_code,
pow.product_code, pow.product_name,pow.product_spc, pow.unit, pow.quantity_split,
pow.route_code, pow.prod_line_code, pow.product_date,
pow.shift_id, pow.parent_order,pow.status, pow.prod_type,pow.factory_code,
pow.end_flag,pow.car_num,pow.sort_no,
pow.workorder_code_sap,
ppow.product_code pproductCode,ppow.product_name pproductName,ppow.workorder_code_sap pworkorderCodeSap
from pro_order_workorder pow
left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code and ppow.del_flag = '0'
<where>
<if test="workorderCode != null and workorderCode != ''">and pow.workorder_code like concat('%',
#{workorderCode}, '%')
</if>
<if test="workorderName != null and workorderName != ''">and pow.workorder_name like concat('%',
#{workorderName}, '%')
</if>
<if test="orderId != null and orderId != ''">and pow.order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''">and pow.order_code like concat('%', #{orderCode}, '%')
</if>
<if test="productCode != null and productCode != ''">and ppow.product_code like concat('%', #{productCode},
'%')
</if>
<if test="productName != null and productName != ''">and ppow.product_name like concat('%', #{productName},
'%')
</if>
<if test="productDate != null ">and pow.product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''">and pow.shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''">and pow.parent_order = #{parentOrder}</if>
<if test="status != null and status != ''">and pow.status = #{status}</if>
<if test="statusArray != null and statusArray != ''">and pow.status in (${statusArray})</if>
<if test="prodType != null and prodType != ''">and pow.prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''">and pow.factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''">and pow.end_flag = #{endFlag}</if>
<if test="productDateStart != null ">and CONVERT(varchar(10),pow.product_date, 120) >=
'${productDateStart}'
</if>
<if test="productDateEnd != null ">and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120)
</if>
and pow.del_flag = '0'
</where>
order by pow.product_date desc
</select>
</mapper>

@ -254,6 +254,7 @@
product_date productDate,
factory_code factoryCode,
prod_type prodType,
attr1,
workorder_code_sap workorderCodeSap
FROM
pro_order_workorder

Loading…
Cancel
Save