refactor(integration): 重构报工接口并优化库存更新逻辑- 新增 OutMaterialCompleteLogDto 类用于完工入库事务
- 新增 OutMaterialCompleteLogService 接口及实现类 - 修改 OutMaterialSapService 接口,增加 warehousing 方法 - 实现 OutMaterialSapServiceImpl 中的 warehousing 方法 - 更新 OutSapReportController 中的报工接口,使用 OutShopOrderDto 封装报工数据 - 优化库存更新逻辑,减少冗余代码
This commit is contained in:
parent
e47cd6bb76
commit
125016df46
@ -0,0 +1,287 @@
|
||||
package com.foreverwin.iep.integration.dto;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.foreverwin.iep.integration.entity.OutMaterialCompleteLog;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 完工入库事务表
|
||||
*
|
||||
* @author mom code generator
|
||||
* @date 2024-11-11 09:56:21
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class OutMaterialCompleteLogDto extends OutMaterialCompleteLog{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String fabNo;
|
||||
|
||||
/**
|
||||
* 工作中心
|
||||
*/
|
||||
private String workCenter;
|
||||
|
||||
/**
|
||||
* 资源
|
||||
*/
|
||||
private String resource;
|
||||
|
||||
/**
|
||||
* WMS_INVENTORY_LOG表主键
|
||||
*/
|
||||
private String inventoryLogSid;
|
||||
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
private String shopOrder;
|
||||
|
||||
/**
|
||||
* 生产批号,卷号
|
||||
*/
|
||||
private String lotNo;
|
||||
|
||||
/**
|
||||
* 101(主产品入库)、531(副产品入库)
|
||||
*/
|
||||
private String productType;
|
||||
|
||||
/**
|
||||
* 物料批次,默认为SAP_BATCH_NO
|
||||
*/
|
||||
private String materialLot;
|
||||
|
||||
private String userWorkShift;
|
||||
|
||||
/**
|
||||
* 生产批序列号
|
||||
*/
|
||||
private String lotSerial;
|
||||
|
||||
/**
|
||||
* 客户外部批次
|
||||
*/
|
||||
private String externalLot;
|
||||
|
||||
/**
|
||||
* 品质判定等级
|
||||
*/
|
||||
private String qcGrade;
|
||||
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
private String item;
|
||||
|
||||
private String erpItem;
|
||||
|
||||
private String itemDesc;
|
||||
|
||||
/**
|
||||
* 物料主单位
|
||||
*/
|
||||
private String mainUom;
|
||||
|
||||
/**
|
||||
* 主单位完工数量
|
||||
*/
|
||||
private BigDecimal mainQty;
|
||||
|
||||
/**
|
||||
* 组件物料辅单位
|
||||
*/
|
||||
private String subUom;
|
||||
|
||||
/**
|
||||
* 辅单位完工数量
|
||||
*/
|
||||
|
||||
private BigDecimal subQty;
|
||||
|
||||
/**
|
||||
* 完工仓库
|
||||
*/
|
||||
private String warehouseCode;
|
||||
|
||||
/**
|
||||
* 完工存储位置
|
||||
*/
|
||||
private String storageLocation;
|
||||
|
||||
/**
|
||||
* 消耗存储货格
|
||||
*/
|
||||
private String storageBin;
|
||||
|
||||
/**
|
||||
* ERP仓库编号
|
||||
*/
|
||||
private String erpInventory;
|
||||
|
||||
/**
|
||||
* 移动日志(0:入库、2:销售出库)
|
||||
*/
|
||||
private String moveType;
|
||||
|
||||
/**
|
||||
* 状态(0:正常、1:冻结、2:已扫描出库、3:待出库过账)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 制造日期
|
||||
*/
|
||||
private LocalDateTime dateMfg;
|
||||
|
||||
/**
|
||||
* 到期日
|
||||
*/
|
||||
private LocalDateTime dateExp;
|
||||
|
||||
/**
|
||||
* 库存日期
|
||||
*/
|
||||
private LocalDateTime dateInventory;
|
||||
|
||||
/**
|
||||
* 事务处理类型
|
||||
*/
|
||||
private String transactionType;
|
||||
|
||||
/**
|
||||
* 事务处理日期
|
||||
*/
|
||||
private LocalDateTime transactionDate;
|
||||
|
||||
/**
|
||||
* ERP抛送旗帜
|
||||
*/
|
||||
private String erpFlag;
|
||||
|
||||
/**
|
||||
* SAP批次编号(向SAP申请的批次号)
|
||||
*/
|
||||
private String sapBatchNo;
|
||||
|
||||
/**
|
||||
* 库存类型(质检库存、冻结库存等)
|
||||
*/
|
||||
private String inventoryType;
|
||||
|
||||
/**
|
||||
* 特殊库存标识
|
||||
*/
|
||||
private String inventoryMark;
|
||||
|
||||
/**
|
||||
* 销售订单行号
|
||||
*/
|
||||
private String soLineNo;
|
||||
|
||||
/**
|
||||
* 销售订单号
|
||||
*/
|
||||
private String soNo;
|
||||
|
||||
/**
|
||||
* 同步提交人
|
||||
*/
|
||||
private String syncSubmitter;
|
||||
|
||||
/**
|
||||
* 同步过账日期
|
||||
*/
|
||||
private LocalDate syncPostingDate;
|
||||
|
||||
/**
|
||||
* 同步请求处理编号
|
||||
*/
|
||||
private String syncTransBatch;
|
||||
|
||||
/**
|
||||
* 同步请求处理时间
|
||||
*/
|
||||
private LocalDateTime syncTransDate;
|
||||
|
||||
/**
|
||||
* 同步返回结果
|
||||
*/
|
||||
private String syncStatus;
|
||||
|
||||
/**
|
||||
* 同步消息识别
|
||||
*/
|
||||
private String syncMsgId;
|
||||
|
||||
/**
|
||||
* 同步系统消息编号
|
||||
*/
|
||||
private String syncMsgNo;
|
||||
|
||||
/**
|
||||
* 同步返回消息文本
|
||||
*/
|
||||
private String syncMsgText;
|
||||
|
||||
/**
|
||||
* 同步返回物料凭证编号
|
||||
*/
|
||||
private String syncVoucherNo;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updater;
|
||||
|
||||
private String erpReverse;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String startTime;
|
||||
@TableField(exist = false)
|
||||
private String endTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.foreverwin.iep.integration.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OutShopOrderDto<T> {
|
||||
private String shopOrder;
|
||||
private List<T> list;
|
||||
}
|
||||
@ -330,9 +330,14 @@ public class OutMaterialCompleteLog extends Model<OutMaterialCompleteLog> {
|
||||
@ApiModelProperty(value = "erp冲销标识(Y:冲销成功、无值代表无冲销动作、其它值代表erp冲销返回结果值)")
|
||||
private String erpReverse;
|
||||
|
||||
@ApiModelProperty(value = "膜卷类型")
|
||||
private String rollType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String startTime;
|
||||
@TableField(exist = false)
|
||||
private String endTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ public class OutSapMaterialLog extends Model<OutSapMaterialLog> {
|
||||
private String erpReverse;
|
||||
|
||||
@ApiModelProperty(value = "条码")
|
||||
private String inventory_id;
|
||||
private String inventoryId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String startTime;
|
||||
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.foreverwin.iep.common.faas.common.util.StringUtils;
|
||||
import com.foreverwin.iep.integration.domain.InvokeRequest;
|
||||
import com.foreverwin.iep.integration.domain.InvokeResponse;
|
||||
import com.foreverwin.iep.integration.dto.OutShopOrderDto;
|
||||
import com.foreverwin.iep.integration.entity.*;
|
||||
import com.foreverwin.iep.integration.handler.def.sap.*;
|
||||
import com.foreverwin.iep.integration.mapper.OutSapShoporderStatisticsMapper;
|
||||
@ -298,12 +299,12 @@ public class OutSapReportController {
|
||||
@ApiOperation(value = "生产管理报工平台-物料消耗报工", notes = "生产管理报工平台-物料消耗报工")
|
||||
@SysLog("生产管理报工平台-物料消耗报工")
|
||||
@PostMapping("/callErpMaterial")
|
||||
public R callErpMaterial(@RequestBody List<OutSapMaterialLog> outSapMaterialLogs) {
|
||||
InvokeResponse invokeResponse = outMaterialSapService.callLotMaterialConsumption(outSapMaterialLogs, false, "");
|
||||
public R callErpMaterial(@RequestBody OutShopOrderDto<OutSapMaterialLog> outShopOrderDto) {
|
||||
InvokeResponse invokeResponse = outMaterialSapService.callLotMaterialConsumption(outShopOrderDto.getList(), false, "", outShopOrderDto.getShopOrder());
|
||||
if ("E".equals(invokeResponse.getResult())) {
|
||||
return R.failed("SAP错误:" + invokeResponse.getMessageContent());
|
||||
} else {
|
||||
boolean b = outMaterialSapService.batchUpdateMaterialInventory(outSapMaterialLogs);
|
||||
boolean b = outMaterialSapService.batchUpdateMaterialInventory(outShopOrderDto.getList());
|
||||
if (!b) {
|
||||
return R.failed("更新mes库存失败!");
|
||||
}
|
||||
@ -311,28 +312,22 @@ public class OutSapReportController {
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------- 批次完工入库报工开始 -----------------------------------------------
|
||||
|
||||
@ApiOperation(value = "生产管理报工平台-批次完工入库获取SAP批次号", notes = "生产管理报工平台-批次完工入库获取SAP批次号")
|
||||
@SysLog("生产管理报工平台-批次完工入库获取SAP批次号")
|
||||
@PostMapping("/api/getSapBatchNo")
|
||||
public R<String> getSapBatchNo(@RequestBody String erpItem) {
|
||||
String sapBatchNo = registerDocumentService.getSapBatchNo(erpItem);
|
||||
return R.ok(sapBatchNo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "生产管理报工平台-批次完工入库报工", notes = "生产管理报工平台-批次完工入库报工")
|
||||
@SysLog("生产管理报工平台-批次完工入库报工")
|
||||
@PostMapping("/callErpLot")
|
||||
public R callErpLot(@RequestBody List<OutMaterialCompleteLog> outMaterialCompleteLogList) {
|
||||
InvokeResponse invokeResponse = outMaterialSapService.callLotMaterialComplete(outMaterialCompleteLogList, false, "");
|
||||
public R callErpLot(@RequestBody OutShopOrderDto<OutMaterialCompleteLog> outShopOrderDto) {
|
||||
String shopOrder = outShopOrderDto.getShopOrder();
|
||||
List<OutMaterialCompleteLog> list = outShopOrderDto.getList();
|
||||
InvokeResponse invokeResponse = outMaterialSapService.callLotMaterialComplete(list, false, "",shopOrder);
|
||||
if ("E".equals(invokeResponse.getResult())) {
|
||||
return R.failed("SAP错误:" + invokeResponse.getMessageContent());
|
||||
} else {
|
||||
boolean b = outMaterialSapService.batchUpdateCompleteInventory(outMaterialCompleteLogList);
|
||||
if (!b){
|
||||
return R.failed("mes库存更新失败,请检查条码号是否正确");
|
||||
}
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
outMaterialSapService.warehousing(list, site);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -392,50 +387,50 @@ public class OutSapReportController {
|
||||
// return R.ok();
|
||||
// }
|
||||
|
||||
private InvokeResponse sendSapToCancel(String syncVoucherNo) {
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
InvokeRequest invokeRequest = new InvokeRequest();
|
||||
// 传参对象
|
||||
try {
|
||||
String messageId = "ZMM_MES_GOODMVT_REVERSE";
|
||||
LocalDateTime nowLocalDateTime = LocalDateTime.now();
|
||||
String nowTime = nowLocalDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
invokeRequest.setTransSid(SapUtil.generateReqId());
|
||||
invokeRequest.setTransTime(nowTime); // 设定过账日期
|
||||
invokeRequest.setFromSystem("IEP");
|
||||
invokeRequest.setToSystem("ERP");
|
||||
invokeRequest.setSite(TenantContextHolder.getTenantId());
|
||||
invokeRequest.setMessageId(messageId);
|
||||
|
||||
String postingDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("RFC_FUNCTION", messageId);
|
||||
JSONObject headRe = new JSONObject();
|
||||
headRe.put("EXCHANGE_SYSTEM", "MES");
|
||||
headRe.put("EXCHANGE_ID", SapUtil.generateReqId());
|
||||
headRe.put("EXCHANGE_DOC", "iMES_Call_SAP");
|
||||
jsonObject.put("REQUEST_CONTEXT", headRe);
|
||||
JSONObject bodyRe = new JSONObject();
|
||||
JSONObject isInput = new JSONObject();
|
||||
isInput.put("MBLNR", syncVoucherNo); // 物料凭证编号
|
||||
isInput.put("ZPARTNER", SecurityUtils.getUserName()); // 员工BP编号
|
||||
isInput.put("BUDAT", postingDate); // 凭证中的过账日期
|
||||
bodyRe.put("IS_INPUT", isInput);
|
||||
jsonObject.put("REQUEST_BODY", bodyRe);
|
||||
|
||||
// 组装抛送的报完呢
|
||||
String jsonObjectStr = SapUtil.appendHead(jsonObject.toJSONString());
|
||||
invokeRequest.setMessageContent(jsonObjectStr);
|
||||
invokeRequest.setStart(nowTime);
|
||||
invokeRequest.setKeyValue(nowTime);
|
||||
invokeRequest.setRetry(false);
|
||||
invokeResponse = goodMvtReverseService.call(invokeRequest);
|
||||
} catch (Exception e) {
|
||||
// 不用回滚,将错误抛出
|
||||
invokeResponse.setResult("E");
|
||||
invokeResponse.setMessageContent(e.getMessage());
|
||||
}
|
||||
return invokeResponse;
|
||||
}
|
||||
// private InvokeResponse sendSapToCancel(String syncVoucherNo) {
|
||||
// InvokeResponse invokeResponse = new InvokeResponse();
|
||||
// InvokeRequest invokeRequest = new InvokeRequest();
|
||||
// // 传参对象
|
||||
// try {
|
||||
// String messageId = "ZMM_MES_GOODMVT_REVERSE";
|
||||
// LocalDateTime nowLocalDateTime = LocalDateTime.now();
|
||||
// String nowTime = nowLocalDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// invokeRequest.setTransSid(SapUtil.generateReqId());
|
||||
// invokeRequest.setTransTime(nowTime); // 设定过账日期
|
||||
// invokeRequest.setFromSystem("IEP");
|
||||
// invokeRequest.setToSystem("ERP");
|
||||
// invokeRequest.setSite(TenantContextHolder.getTenantId());
|
||||
// invokeRequest.setMessageId(messageId);
|
||||
//
|
||||
// String postingDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("RFC_FUNCTION", messageId);
|
||||
// JSONObject headRe = new JSONObject();
|
||||
// headRe.put("EXCHANGE_SYSTEM", "MES");
|
||||
// headRe.put("EXCHANGE_ID", SapUtil.generateReqId());
|
||||
// headRe.put("EXCHANGE_DOC", "iMES_Call_SAP");
|
||||
// jsonObject.put("REQUEST_CONTEXT", headRe);
|
||||
// JSONObject bodyRe = new JSONObject();
|
||||
// JSONObject isInput = new JSONObject();
|
||||
// isInput.put("MBLNR", syncVoucherNo); // 物料凭证编号
|
||||
// isInput.put("ZPARTNER", SecurityUtils.getUserName()); // 员工BP编号
|
||||
// isInput.put("BUDAT", postingDate); // 凭证中的过账日期
|
||||
// bodyRe.put("IS_INPUT", isInput);
|
||||
// jsonObject.put("REQUEST_BODY", bodyRe);
|
||||
//
|
||||
// // 组装抛送的报完呢
|
||||
// String jsonObjectStr = SapUtil.appendHead(jsonObject.toJSONString());
|
||||
// invokeRequest.setMessageContent(jsonObjectStr);
|
||||
// invokeRequest.setStart(nowTime);
|
||||
// invokeRequest.setKeyValue(nowTime);
|
||||
// invokeRequest.setRetry(false);
|
||||
// invokeResponse = goodMvtReverseService.call(invokeRequest);
|
||||
// } catch (Exception e) {
|
||||
// // 不用回滚,将错误抛出
|
||||
// invokeResponse.setResult("E");
|
||||
// invokeResponse.setMessageContent(e.getMessage());
|
||||
// }
|
||||
// return invokeResponse;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.foreverwin.iep.integration.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.iep.integration.entity.OutMaterialCompleteLog;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
|
||||
public interface OutMaterialCompleteLogService extends IService<OutMaterialCompleteLog> {
|
||||
|
||||
}
|
||||
@ -9,14 +9,14 @@ import java.util.List;
|
||||
|
||||
public interface OutMaterialSapService {
|
||||
|
||||
InvokeResponse callLotMaterialComplete(List<OutMaterialCompleteLog> outMaterialCompleteLogs, boolean isPass, String postingDate);
|
||||
InvokeResponse callLotMaterialComplete(List<OutMaterialCompleteLog> outMaterialCompleteLogs, boolean isPass, String postingDate,String shopOrder);
|
||||
|
||||
InvokeResponse callLotMaterialConsumption(List<OutSapMaterialLog> outSapMaterialLogs, boolean isPass, String postingDate);
|
||||
InvokeResponse callLotMaterialConsumption(List<OutSapMaterialLog> outSapMaterialLogs, boolean isPass, String postingDate,String shopOrder);
|
||||
|
||||
boolean batchUpdateCompleteInventory(List<OutMaterialCompleteLog> outMaterialCompleteLogs);
|
||||
|
||||
boolean batchUpdateMaterialInventory(List<OutSapMaterialLog> outSapMaterialLogs);
|
||||
|
||||
|
||||
|
||||
void warehousing(List<OutMaterialCompleteLog> outMaterialCompleteLogs, String site);
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.foreverwin.iep.integration.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.integration.entity.OutMaterialCompleteLog;
|
||||
import com.foreverwin.iep.integration.mapper.OutSapCompleteMapper;
|
||||
import com.foreverwin.iep.integration.service.OutMaterialCompleteLogService;
|
||||
import com.foreverwin.mom.wms.entity.InventoryLog;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service
|
||||
public class OutMaterialCompleteLogServiceImpl extends ServiceImpl<OutSapCompleteMapper, OutMaterialCompleteLog> implements OutMaterialCompleteLogService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -11,8 +11,10 @@ import com.foreverwin.iep.integration.handler.def.sap.GoodMvtCreateService;
|
||||
import com.foreverwin.iep.integration.handler.def.sap.SapUtil;
|
||||
import com.foreverwin.iep.integration.mapper.OutSapCompleteMapper;
|
||||
import com.foreverwin.iep.integration.mapper.OutSapMaterialMapper;
|
||||
import com.foreverwin.iep.integration.service.OutMaterialCompleteLogService;
|
||||
import com.foreverwin.iep.integration.service.OutMaterialSapService;
|
||||
import com.foreverwin.iep.integration.service.RegisterDocumentService;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.iep.wip.dto.OperationOutBomComponentDTO;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
@ -20,7 +22,6 @@ import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryRecordService;
|
||||
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.google.protobuf.ServiceException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -28,15 +29,15 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
|
||||
private final GoodMvtCreateService goodMvtCreateService;
|
||||
private final OutSapCompleteMapper outSapCompleteMapper ;
|
||||
private final OutSapCompleteMapper outSapCompleteMapper;
|
||||
private final OutMaterialCompleteLogService outLogService;
|
||||
private final OutSapMaterialMapper outSapMaterialMapper;
|
||||
private final RegisterDocumentService registerDocumentService;
|
||||
private final RemoteWmsInventoryService remoteWmsInventoryService;
|
||||
@ -45,7 +46,7 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
private final String messageId = "ZMM_MES_GOODSMVT_CREATE";
|
||||
|
||||
@Override
|
||||
public InvokeResponse callLotMaterialComplete(List<OutMaterialCompleteLog> outMaterialCompleteLogs, boolean isPass, String postingDate) {
|
||||
public InvokeResponse callLotMaterialComplete(List<OutMaterialCompleteLog> outMaterialCompleteLogs, boolean isPass, String postingDate, String shopOrder) {
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
List<OutMaterialCompleteLog> newOneZeroOneList = new ArrayList<>();
|
||||
List<OutMaterialCompleteLog> newFiveThreeOneList = new ArrayList<>();
|
||||
@ -57,59 +58,58 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
// 重新校验一遍是否已经报过工,防止重复报工
|
||||
OutMaterialCompleteLog targetObj = completeTransaction;
|
||||
|
||||
if (StringUtils.isEmpty(postingDate)) {
|
||||
postingDate = completeTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} else {
|
||||
completeTransaction.setSyncPostingDate(LocalDate.parse(postingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
}
|
||||
targetObj.setSyncPostingDate(completeTransaction.getSyncPostingDate());
|
||||
srcList.add(targetObj);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
site = completeTransaction.getSite();
|
||||
jsonObject.put("ZEILE", null); // 物料凭证中的项目
|
||||
jsonObject.put("MATNR", completeTransaction.getErpItem()); // 物料编号
|
||||
jsonObject.put("MATKL", ""); // 物料组
|
||||
jsonObject.put("WERKS", site); // 工厂
|
||||
jsonObject.put("LGORT", completeTransaction.getErpInventory()); // 存储地点
|
||||
String sapBatchNo = registerDocumentService.getSapBatchNo(completeTransaction.getErpInventory());
|
||||
completeTransaction.setSapBatchNo(sapBatchNo);
|
||||
jsonObject.put("CHARG", sapBatchNo); // 批次号
|
||||
jsonObject.put("BWART", completeTransaction.getProductType()); // 移动类型
|
||||
jsonObject.put("SOBKZ", ""); // 特殊库存标识
|
||||
jsonObject.put("AUFNR", completeTransaction.getShopOrder()); // 订单号
|
||||
jsonObject.put("EBELN", ""); // 采购订单号
|
||||
jsonObject.put("EBELP", ""); // 采购凭证的项目编号
|
||||
jsonObject.put("MENGE", completeTransaction.getMainQty()); // 数量
|
||||
jsonObject.put("MEINS", completeTransaction.getMainUom()); // 基本计量单位
|
||||
if (StringUtils.isEmpty(completeTransaction.getSubUom()) || completeTransaction.getSubQty() == null) {
|
||||
jsonObject.put("ERFMG", null); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", ""); // 录入单位
|
||||
} else {
|
||||
jsonObject.put("ERFMG", completeTransaction.getSubQty()); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", completeTransaction.getSubUom()); // 录入单位
|
||||
}
|
||||
jsonObject.put("MAT_KDAUF", completeTransaction.getSoNo()); // 评估销售定单库存的销售定单号
|
||||
if (StringUtils.isNotEmpty(completeTransaction.getSoLineNo())) {
|
||||
jsonObject.put("MAT_KDPOS", Integer.valueOf(completeTransaction.getSoLineNo())); // 评估销售订单库存的销售订单项目
|
||||
} else {
|
||||
jsonObject.put("MAT_KDPOS", null); // 评估销售订单库存的销售订单项目
|
||||
}
|
||||
jsonObject.put("UMWRK", ""); // 收货工厂/发货工厂
|
||||
jsonObject.put("UMLGO", ""); // 收货/发货库存地点
|
||||
jsonObject.put("UMCHA", ""); // 收货/发货批量
|
||||
jsonObject.put("RSNUM", ""); // 预留/相关需求的编号
|
||||
jsonObject.put("RSPOS", ""); // 预留 / 相关需求的项目编号
|
||||
jsonObject.put("Z_JH", completeTransaction.getLotNo()); // 卷号
|
||||
jsonObject.put("Z_CVN", completeTransaction.getExternalLot()); // 客户卷号
|
||||
jsonObject.put("Z_GRADE", completeTransaction.getQcGrade()); // 等级
|
||||
if ("101".equals(completeTransaction.getProductType())) {
|
||||
oneZeroOneList.add(jsonObject);
|
||||
newOneZeroOneList.add(targetObj);
|
||||
} else if ("531".equals(completeTransaction.getProductType())) {
|
||||
fiveThreeOneList.add(jsonObject);
|
||||
newFiveThreeOneList.add(targetObj);
|
||||
}
|
||||
if (StringUtils.isEmpty(postingDate)) {
|
||||
postingDate = completeTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} else {
|
||||
completeTransaction.setSyncPostingDate(LocalDate.parse(postingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
}
|
||||
targetObj.setSyncPostingDate(completeTransaction.getSyncPostingDate());
|
||||
srcList.add(targetObj);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
site = completeTransaction.getSite();
|
||||
jsonObject.put("ZEILE", null); // 物料凭证中的项目
|
||||
jsonObject.put("MATNR", completeTransaction.getErpItem()); // 物料编号
|
||||
jsonObject.put("MATKL", ""); // 物料组
|
||||
jsonObject.put("WERKS", site); // 工厂
|
||||
jsonObject.put("LGORT", completeTransaction.getErpInventory()); // 存储地点
|
||||
jsonObject.put("CHARG", completeTransaction.getSapBatchNo()); // 批次号
|
||||
jsonObject.put("BWART", completeTransaction.getProductType()); // 移动类型
|
||||
jsonObject.put("SOBKZ", ""); // 特殊库存标识
|
||||
jsonObject.put("AUFNR", shopOrder); // 订单号
|
||||
completeTransaction.setShopOrder(shopOrder);
|
||||
jsonObject.put("EBELN", ""); // 采购订单号
|
||||
jsonObject.put("EBELP", ""); // 采购凭证的项目编号
|
||||
jsonObject.put("MENGE", completeTransaction.getMainQty()); // 数量
|
||||
jsonObject.put("MEINS", completeTransaction.getMainUom()); // 基本计量单位
|
||||
if (StringUtils.isEmpty(completeTransaction.getSubUom()) || completeTransaction.getSubQty() == null) {
|
||||
jsonObject.put("ERFMG", null); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", ""); // 录入单位
|
||||
} else {
|
||||
jsonObject.put("ERFMG", completeTransaction.getSubQty()); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", completeTransaction.getSubUom()); // 录入单位
|
||||
}
|
||||
jsonObject.put("MAT_KDAUF", completeTransaction.getSoNo()); // 评估销售定单库存的销售定单号
|
||||
if (StringUtils.isNotEmpty(completeTransaction.getSoLineNo())) {
|
||||
jsonObject.put("MAT_KDPOS", Integer.valueOf(completeTransaction.getSoLineNo())); // 评估销售订单库存的销售订单项目
|
||||
} else {
|
||||
jsonObject.put("MAT_KDPOS", null); // 评估销售订单库存的销售订单项目
|
||||
}
|
||||
jsonObject.put("UMWRK", ""); // 收货工厂/发货工厂
|
||||
jsonObject.put("UMLGO", ""); // 收货/发货库存地点
|
||||
jsonObject.put("UMCHA", ""); // 收货/发货批量
|
||||
jsonObject.put("RSNUM", ""); // 预留/相关需求的编号
|
||||
jsonObject.put("RSPOS", ""); // 预留 / 相关需求的项目编号
|
||||
// jsonObject.put("Z_JH", completeTransaction.getLotNo()); // 卷号
|
||||
jsonObject.put("Z_CVN", completeTransaction.getExternalLot()); // 客户卷号
|
||||
jsonObject.put("Z_GRADE", completeTransaction.getQcGrade()); // 等级
|
||||
if ("101".equals(completeTransaction.getProductType())) {
|
||||
oneZeroOneList.add(jsonObject);
|
||||
newOneZeroOneList.add(targetObj);
|
||||
} else if ("531".equals(completeTransaction.getProductType())) {
|
||||
fiveThreeOneList.add(jsonObject);
|
||||
newFiveThreeOneList.add(targetObj);
|
||||
}
|
||||
}
|
||||
|
||||
if (oneZeroOneList.size() > 0) {
|
||||
invokeResponse = sendSap(invokeResponse, site, oneZeroOneList, postingDate, newOneZeroOneList);
|
||||
@ -143,6 +143,14 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
invokeRequest.setRetry(false);
|
||||
TenantContextHolder.setTenantId(site);
|
||||
invokeResponse = goodMvtCreateService.call(invokeRequest);
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
invokeResponse = goodMvtCreateService.call(invokeRequest);
|
||||
long endTime = System.currentTimeMillis();
|
||||
long duration = endTime - startTime;
|
||||
System.out.println("执行时间: " + duration + " 毫秒");
|
||||
|
||||
|
||||
// 处理ERP返回的报文
|
||||
invokeResponse = updateLotComplete(invokeResponse.getObjectResponse(), srcList, invokeResponse);
|
||||
} catch (Exception e) {
|
||||
@ -174,6 +182,7 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
}
|
||||
|
||||
public InvokeResponse updateLotComplete(JSONObject jsonObject, List<OutMaterialCompleteLog> srcList, InvokeResponse invokeResponse) {
|
||||
Vector<OutMaterialCompleteLog> srcListVector = new Vector<>();
|
||||
JSONObject bodyJson = jsonObject.getJSONObject("RESPONSE_BODY");
|
||||
JSONObject outJson = bodyJson.getJSONObject("ES_OUTPUT");
|
||||
String result = outJson.getString("MSGTY");
|
||||
@ -189,8 +198,9 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
targetObj.setCreator(SecurityUtils.getUserName());
|
||||
targetObj.setDateCreate(LocalDateTime.now());
|
||||
targetObj.setDateUpdate(LocalDateTime.now());
|
||||
outSapCompleteMapper.insert(targetObj);
|
||||
srcListVector.add(targetObj);
|
||||
}
|
||||
outLogService.saveBatch(srcListVector);
|
||||
invokeResponse.setResult(result);
|
||||
invokeResponse.setMessageContent(message);
|
||||
return invokeResponse;
|
||||
@ -199,59 +209,67 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
|
||||
// ------------------------- 物料消耗报工开始 ----------------------------------------------------------
|
||||
@Override
|
||||
public InvokeResponse callLotMaterialConsumption(List<OutSapMaterialLog> outSapMaterialLogs, boolean isPass, String postingDate) {
|
||||
public InvokeResponse callLotMaterialConsumption(List<OutSapMaterialLog> outSapMaterialLogs, boolean isPass, String postingDate, String shopOrder) {
|
||||
InvokeResponse invokeResponse = new InvokeResponse();
|
||||
String site = "";
|
||||
JSONArray itemList = new JSONArray();
|
||||
List<OutSapMaterialLog> srcList = new ArrayList<>();
|
||||
for (OutSapMaterialLog consumptionTransaction : outSapMaterialLogs) {
|
||||
//获取物料批次
|
||||
String inventoryBo = Inventory.genHandle(consumptionTransaction.getSite(), consumptionTransaction.getInventoryId());
|
||||
Inventory inventory = remoteWmsInventoryService.getInventoryDto(inventoryBo).getData();
|
||||
String batchNo = inventory.getBatchNo();
|
||||
consumptionTransaction.setSapBatchNo(batchNo);
|
||||
|
||||
|
||||
OutSapMaterialLog targetObj = consumptionTransaction;
|
||||
if (StringUtils.isEmpty(postingDate)) {
|
||||
postingDate = consumptionTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} else {
|
||||
consumptionTransaction.setSyncPostingDate(LocalDate.parse(postingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
}
|
||||
targetObj.setSyncPostingDate(consumptionTransaction.getSyncPostingDate());
|
||||
srcList.add(targetObj);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
site = consumptionTransaction.getSite();
|
||||
jsonObject.put("ZEILE", ""); // 物料凭证中的项目
|
||||
jsonObject.put("MATNR", consumptionTransaction.getComponentItem()); // 物料编号
|
||||
jsonObject.put("MATKL", ""); // 物料组
|
||||
jsonObject.put("WERKS", site); // 工厂
|
||||
jsonObject.put("LGORT", consumptionTransaction.getErpInventory()); // 存储地点
|
||||
jsonObject.put("CHARG", consumptionTransaction.getSapBatchNo()); // 批次号
|
||||
jsonObject.put("BWART", "261"); // 移动类型
|
||||
jsonObject.put("SOBKZ", ""); // 特殊库存标识
|
||||
jsonObject.put("AUFNR", consumptionTransaction.getShopOrder()); // 订单号
|
||||
jsonObject.put("EBELN", ""); // 采购订单号
|
||||
jsonObject.put("EBELP", ""); // 采购凭证的项目编号
|
||||
jsonObject.put("MENGE", consumptionTransaction.getMainQty()); // 数量
|
||||
jsonObject.put("MEINS", consumptionTransaction.getMainUom()); // 基本计量单位
|
||||
if (StringUtils.isEmpty(consumptionTransaction.getSubUom()) || consumptionTransaction.getSubQty() == null) {
|
||||
jsonObject.put("ERFMG", null); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", ""); // 录入单位
|
||||
} else {
|
||||
jsonObject.put("ERFMG", consumptionTransaction.getSubQty()); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", consumptionTransaction.getSubUom()); // 录入单位
|
||||
}
|
||||
jsonObject.put("MAT_KDAUF", ""); // 评估销售定单库存的销售定单号
|
||||
jsonObject.put("MAT_KDPOS", ""); // 评估销售订单库存的销售订单项目
|
||||
jsonObject.put("UMWRK", ""); // 收货工厂/发货工厂
|
||||
jsonObject.put("UMLGO", ""); // 收货/发货库存地点
|
||||
jsonObject.put("UMCHA", ""); // 收货/发货批量
|
||||
if (StringUtils.isEmpty(postingDate)) {
|
||||
postingDate = consumptionTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
} else {
|
||||
consumptionTransaction.setSyncPostingDate(LocalDate.parse(postingDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
}
|
||||
targetObj.setSyncPostingDate(consumptionTransaction.getSyncPostingDate());
|
||||
srcList.add(targetObj);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
site = consumptionTransaction.getSite();
|
||||
jsonObject.put("ZEILE", ""); // 物料凭证中的项目
|
||||
jsonObject.put("MATNR", consumptionTransaction.getComponentItem()); // 物料编号
|
||||
jsonObject.put("MATKL", ""); // 物料组
|
||||
jsonObject.put("WERKS", site); // 工厂
|
||||
jsonObject.put("LGORT", consumptionTransaction.getErpInventory()); // 存储地点
|
||||
jsonObject.put("CHARG", batchNo); // 批次号
|
||||
jsonObject.put("BWART", "261"); // 移动类型
|
||||
jsonObject.put("SOBKZ", ""); // 特殊库存标识
|
||||
consumptionTransaction.setShopOrder(shopOrder);
|
||||
jsonObject.put("AUFNR", shopOrder); // 订单号
|
||||
jsonObject.put("EBELN", ""); // 采购订单号
|
||||
jsonObject.put("EBELP", ""); // 采购凭证的项目编号
|
||||
jsonObject.put("MENGE", consumptionTransaction.getMainQty()); // 数量
|
||||
jsonObject.put("MEINS", consumptionTransaction.getMainUom()); // 基本计量单位
|
||||
if (StringUtils.isEmpty(consumptionTransaction.getSubUom()) || consumptionTransaction.getSubQty() == null) {
|
||||
jsonObject.put("ERFMG", null); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", ""); // 录入单位
|
||||
} else {
|
||||
jsonObject.put("ERFMG", consumptionTransaction.getSubQty()); // 以录入项单位表示的数量
|
||||
jsonObject.put("ERFME", consumptionTransaction.getSubUom()); // 录入单位
|
||||
}
|
||||
jsonObject.put("MAT_KDAUF", ""); // 评估销售定单库存的销售定单号
|
||||
jsonObject.put("MAT_KDPOS", ""); // 评估销售订单库存的销售订单项目
|
||||
jsonObject.put("UMWRK", ""); // 收货工厂/发货工厂
|
||||
jsonObject.put("UMLGO", ""); // 收货/发货库存地点
|
||||
jsonObject.put("UMCHA", ""); // 收货/发货批量
|
||||
R<OperationOutBomComponentDTO> reserve = remoteWmsInventoryRecordService.getReserve(consumptionTransaction.getSite(), consumptionTransaction.getShopOrder(), consumptionTransaction.getComponentItem());
|
||||
OperationOutBomComponentDTO data = reserve.getData();
|
||||
if (data == null){
|
||||
if (data == null) {
|
||||
invokeResponse.setResult("E");
|
||||
invokeResponse.setMessageContent("未找到预留行号与预留编号!");
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
jsonObject.put("RSNUM", data.getReserved()); // 预留/相关需求的编号
|
||||
jsonObject.put("RSPOS", data.getReservedSeq()); // 预留 / 相关需求的项目编号
|
||||
itemList.add(jsonObject);
|
||||
}
|
||||
jsonObject.put("RSPOS", data.getReservedSeq()); // 预留 / 相关需求的项目编号
|
||||
itemList.add(jsonObject);
|
||||
}
|
||||
|
||||
if (itemList.size() > 0) {
|
||||
InvokeRequest invokeRequest = new InvokeRequest();
|
||||
@ -293,7 +311,7 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
String inventoryBo = Inventory.genHandle(outMaterialCompleteLog.getSite(), outMaterialCompleteLog.getLotNo());
|
||||
R<Inventory> inventoryDto = remoteWmsInventoryService.getInventoryDto(inventoryBo);
|
||||
Inventory inventory = inventoryDto.getData();
|
||||
if (inventory==null){
|
||||
if (inventory == null) {
|
||||
return false;
|
||||
}
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
@ -308,31 +326,36 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
|
||||
@Override
|
||||
public boolean batchUpdateMaterialInventory(List<OutSapMaterialLog> outSapMaterialLogs) {
|
||||
List<Inventory> inventories = new ArrayList<>();
|
||||
Map<String, Inventory> inventoryMap = new HashMap<>();
|
||||
|
||||
for (OutSapMaterialLog outSapMaterialLog : outSapMaterialLogs) {
|
||||
outSapMaterialLog.getInventory_id();
|
||||
String inventoryBo = Inventory.genHandle(outSapMaterialLog.getSite(), outSapMaterialLog.getInventory_id());
|
||||
String inventoryBo = Inventory.genHandle(outSapMaterialLog.getSite(), outSapMaterialLog.getInventoryId());
|
||||
R<Inventory> inventoryDto = remoteWmsInventoryService.getInventoryDto(inventoryBo);
|
||||
|
||||
Inventory inventory = inventoryDto.getData();
|
||||
if (inventory==null){
|
||||
return false;
|
||||
}
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
BigDecimal mainQty = outSapMaterialLog.getMainQty();
|
||||
if (qtyOnHand.compareTo(mainQty) >= 0) {
|
||||
BigDecimal result = qtyOnHand.subtract(mainQty);
|
||||
inventory.setQtyOnHand(result);
|
||||
inventories.add(inventory);
|
||||
} else {
|
||||
if (inventory == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
remoteWmsInventoryService.batchUpdate(inventories);
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
BigDecimal mainQty = outSapMaterialLog.getMainQty();
|
||||
|
||||
if (qtyOnHand.compareTo(mainQty) >= 0) {
|
||||
BigDecimal result = qtyOnHand.subtract(mainQty);
|
||||
inventory.setQtyOnHand(result);
|
||||
inventoryMap.put(inventoryBo, inventory);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 批量更新所有 Inventory
|
||||
remoteWmsInventoryService.batchUpdate(new ArrayList<>(inventoryMap.values()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public InvokeResponse updateMaterialConsumption(JSONObject jsonObject, List<OutSapMaterialLog> srcList, InvokeResponse invokeResponse) {
|
||||
JSONObject bodyJson = jsonObject.getJSONObject("RESPONSE_BODY");
|
||||
JSONObject outJson = bodyJson.getJSONObject("ES_OUTPUT");
|
||||
@ -364,4 +387,64 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warehousing(List<OutMaterialCompleteLog> outMaterialCompleteLogs, String site) {
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
Vector<Inventory> inventories = new Vector<>();
|
||||
for (OutMaterialCompleteLog outMaterialCompleteLog : outMaterialCompleteLogs) {
|
||||
String dataTime = String.valueOf(outMaterialCompleteLog.getSyncPostingDate());
|
||||
LocalDateTime pdt = null;
|
||||
if (dataTime.contains("-")) {
|
||||
pdt = LocalDate.parse(dataTime, dateTimeFormatter).atTime(0, 0);
|
||||
} else {
|
||||
pdt = LocalDate.parse(dataTime, dateTimeFormatter2).atTime(0, 0);
|
||||
}
|
||||
|
||||
String user = SecurityUtils.getUserName();
|
||||
String erpInventory = outMaterialCompleteLog.getErpInventory();
|
||||
String barcode = outMaterialCompleteLog.getLotNo();
|
||||
String status = outMaterialCompleteLog.getStatus();
|
||||
String erpItem = outMaterialCompleteLog.getErpItem();
|
||||
String sapBatchNo = outMaterialCompleteLog.getSapBatchNo();
|
||||
BigDecimal qtyDone = outMaterialCompleteLog.getMainQty();
|
||||
String grade = outMaterialCompleteLog.getQcGrade();
|
||||
String uom = outMaterialCompleteLog.getRollType();
|
||||
String subUom = outMaterialCompleteLog.getSubUom();
|
||||
BigDecimal subQty = outMaterialCompleteLog.getSubQty();
|
||||
|
||||
String inventoryBo = Inventory.genHandle(site, barcode);
|
||||
Inventory data = remoteWmsInventoryService.getInventoryDto(inventoryBo).getData();
|
||||
if (data != null) {
|
||||
|
||||
}
|
||||
|
||||
Inventory inventory = new Inventory();
|
||||
inventory.setHandle(inventoryBo);
|
||||
inventory.setSite(site);
|
||||
inventory.setCreator(user);
|
||||
inventory.setCreateTime(LocalDateTime.now());
|
||||
Item itemObj = remoteWmsInventoryService.selectCurrentByMes(site, erpItem).getData();
|
||||
inventory.setItemBo(itemObj.getHandle());
|
||||
inventory.setUnitOfMeasure(itemObj.getUnitOfMeasure());
|
||||
inventory.setErpStorageLocation(erpInventory);
|
||||
inventory.setStatus(status);
|
||||
inventory.setInventoryId(barcode);
|
||||
inventory.setItem(erpItem);
|
||||
inventory.setBatchNo(sapBatchNo);
|
||||
inventory.setOriginalQty(qtyDone);
|
||||
inventory.setQtyOnHand(qtyDone);
|
||||
inventory.setProductionDate(pdt);
|
||||
|
||||
|
||||
inventory.setQualityInspectionStatus(grade);
|
||||
|
||||
inventory.setRollType(uom);
|
||||
inventory.setAuxiliaryUnit(subUom);
|
||||
inventory.setAuxiliaryOty(String.valueOf(subQty));
|
||||
inventories.add(inventory);
|
||||
}
|
||||
remoteWmsInventoryService.batchSave(inventories);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface OutSapMaterialMapper extends BaseMapper<OutSapMaterialLog> {
|
||||
|
||||
|
||||
|
||||
// OutSapMaterialLog selectBySapBatchNo(String sapBatchNo);
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user