add:中鼎回传业务处理
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package org.nl.wms.ext_manage.purchase.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.api.MesApi;
|
||||
import org.nl.wms.ext_manage.purchase.service.InboundZDwmsService;
|
||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.strategy.core.impl.sap.SapProductionOutboundDelivery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -22,15 +24,23 @@ public class InboundZDwmsServiceImpl implements InboundZDwmsService {
|
||||
@Autowired
|
||||
private MesApi mesApi;
|
||||
|
||||
@Autowired
|
||||
private SapProductionOutboundDelivery sapProductionOutboundDelivery;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleZDwmsCallback(List<MesApi.PmDemandCall> dtos) {
|
||||
for (MesApi.PmDemandCall dto : dtos) {
|
||||
PmDemand pmDemand = pmDemandService.getById(dto.getReqId());
|
||||
pmDemand.setAssign_qty(pmDemand.getAssign_qty().add(new BigDecimal(dto.getQty())));
|
||||
if (pmDemand == null) {
|
||||
throw new BadRequestException("需求单不存在:" + dto.getReqId());
|
||||
}
|
||||
BigDecimal feedbackQty = new BigDecimal(dto.getQty());
|
||||
pmDemand.setAssign_qty(pmDemand.getAssign_qty().add(feedbackQty));
|
||||
pmDemand.setLk_container(dto.getContainerCode());
|
||||
pmDemandService.updateById(pmDemand);
|
||||
sapProductionOutboundDelivery.feedbackDemand(pmDemand, feedbackQty);
|
||||
}
|
||||
mesApi.pmDemandCallback(dtos);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext_manage.sap.dto.SapBillFeedbackRequest;
|
||||
import org.nl.wms.ext_manage.sap.service.SapBillFeedbackService;
|
||||
import org.nl.wms.pm_manage.sap.materialDocument.service.MaterialDocumentService;
|
||||
import org.nl.wms.pm_manage.sap.materialDocument.service.dto.MaterialDocumentDTO;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.service.OutboundDeliveryService;
|
||||
@@ -21,8 +22,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wms/sap_services/maintain")
|
||||
@@ -34,6 +33,7 @@ public class SapSyncController {
|
||||
private final MaterialDocumentService materialDocumentService;
|
||||
private final OutboundDeliveryService outboundDeliveryService;
|
||||
private final SalesReturnOutService salesReturnOutService;
|
||||
private final SapBillFeedbackService sapBillFeedbackService;
|
||||
|
||||
@PostMapping("/insertSapJhd")
|
||||
@Log("SAP收货单同步")
|
||||
@@ -64,22 +64,8 @@ public class SapSyncController {
|
||||
}
|
||||
@PostMapping("/sapBillFeedback")
|
||||
@Log("反馈SAP单据完成")
|
||||
public ResponseEntity<Object> sapBillFeedback(@RequestBody SapBillFeedbackRequest requests) {
|
||||
//这些业务类型的单子,只要把MaterialDocumentIo原单据关闭就可以
|
||||
// TRANSFER_IN("TRANSFER_IN", "调拨入库", MaterialDocumentIo.IN, "调拨入库"),
|
||||
// TRANSFER_OUT("TRANSFER_OUT", "调拨出库", MaterialDocumentIo.OUT, "调拨出库"),
|
||||
// PURCHASE_IN("PURCHASE_IN", "采购入库", MaterialDocumentIo.IN, "采购入库"),
|
||||
// SUBCONTRACT_IN("SUBCONTRACT_IN", "委外入库-成品", MaterialDocumentIo.IN, "采购入库"),
|
||||
// SUBCONTRACT_RETURN_IN("SUBCONTRACT_RETURN_IN", "委外交货退货入库", MaterialDocumentIo.IN, "其他入库"),
|
||||
// OTHER_IN("OTHER_IN", "其他入库", MaterialDocumentIo.IN, "其他入库"),
|
||||
// SALES_OUT("SALES_OUT", "销售出库-原料", MaterialDocumentIo.OUT, "销售出库"),
|
||||
// SALES_RETURN_IN("SALES_RETURN_IN", "销售退库-原料", MaterialDocumentIo.IN, "其他入库"),
|
||||
// OTHER_OUT("OTHER_OUT", "其他出库", MaterialDocumentIo.OUT, "其他出库");
|
||||
//
|
||||
//SUBCONTRACT_OUT委外交货单调用:SapOutboundDelivery
|
||||
//SALES_OUT 原材料销售出库:SapOutboundDelivery
|
||||
//SALES_RETURN_IN 原材料销售退货 SapOutboundDelivery;
|
||||
//TRANSFER_IN 公司间调拨收货 SapOutboundDelivery;
|
||||
return ResponseData.build();
|
||||
public ResponseEntity<Object> sapBillFeedback(@RequestBody SapBillFeedbackRequest request) {
|
||||
JSONObject result = sapBillFeedbackService.feedback(request);
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.wms.ext_manage.sap.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.sap.dto.SapBillFeedbackRequest;
|
||||
import org.nl.wms.pm_manage.sap.materialDocument.enums.MaterialDocumentBillType;
|
||||
import org.nl.wms.pm_manage.sap.materialDocument.service.MaterialDocumentService;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.enums.OutboundDeliveryBillType;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.service.dao.OutboundDelivery;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.service.dao.mapper.OutboundDeliveryMapper;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.strategy.core.impl.sap.SapOutboundDelivery;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 外部系统反馈单据完成。
|
||||
* 物料凭证只关闭原单;委外交货出库、原材料销售出库、原材料销售退货、公司间调拨收货按 SapOutboundDelivery 回传 SAP。
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SapBillFeedbackService {
|
||||
|
||||
private final MaterialDocumentService materialDocumentService;
|
||||
private final OutboundDeliveryMapper outboundDeliveryMapper;
|
||||
private final SapOutboundDelivery sapOutboundDelivery;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject feedback(SapBillFeedbackRequest request) {
|
||||
if (request == null || StrUtil.isBlank(request.getExternalType()) || StrUtil.isBlank(request.getExternalNo())) {
|
||||
throw new BadRequestException("单据反馈失败:单据类型或单据编码为空");
|
||||
}
|
||||
String externalType = request.getExternalType().trim();
|
||||
String externalNo = request.getExternalNo().trim();
|
||||
boolean materialType = MaterialDocumentBillType.ofCode(externalType) != null;
|
||||
boolean callbackType = needsSapCallback(externalType);
|
||||
if (!materialType && !callbackType) {
|
||||
throw new BadRequestException("单据反馈失败:不支持的单据类型" + externalType);
|
||||
}
|
||||
boolean handled = false;
|
||||
if (callbackType) {
|
||||
OutboundDelivery delivery = outboundDeliveryMapper.selectOne(new LambdaQueryWrapper<OutboundDelivery>()
|
||||
.eq(OutboundDelivery::getVbeln, externalNo)
|
||||
.eq(OutboundDelivery::getBilltype, externalType)
|
||||
.last("LIMIT 1"));
|
||||
if (delivery != null) {
|
||||
sapOutboundDelivery.feedbackComplete(delivery.getVbeln(), request.getItem());
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (materialType) {
|
||||
handled = materialDocumentService.completeByExternal(externalType, externalNo) || handled;
|
||||
}
|
||||
if (!handled) {
|
||||
throw new BadRequestException("单据反馈失败:未找到单据" + externalNo + ",类型" + externalType);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("respCode", 0);
|
||||
result.put("respMsg", "单据反馈成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean needsSapCallback(String externalType) {
|
||||
OutboundDeliveryBillType type = OutboundDeliveryBillType.ofCode(externalType);
|
||||
return type == OutboundDeliveryBillType.SUBCONTRACT_OUT
|
||||
|| type == OutboundDeliveryBillType.SALES_OUT
|
||||
|| type == OutboundDeliveryBillType.SALES_RETURN_IN
|
||||
|| type == OutboundDeliveryBillType.TRANSFER_IN;
|
||||
}
|
||||
}
|
||||
@@ -353,32 +353,6 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
.collect(Collectors.joining(","));
|
||||
throw new BadRequestException("下推失败,单据"+collect+"状态不为已分配不能下推");
|
||||
}
|
||||
List<PmDemand> allWorkDemand = this.list(new LambdaQueryWrapper<PmDemand>()
|
||||
.in(PmDemand::getWork_order, pmDemandDtos.stream()
|
||||
.map(PmDemandDto::getWorkOrder)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()))
|
||||
.ne(PmDemand::getStatus, DemandStatus.FINISH.getValue())
|
||||
.ne(PmDemand::getIs_deleted, 1));
|
||||
// if (pmDemandDtos.size() < allWorkDemand.size()) {
|
||||
// // 统计 allWorkDemand 中每个工单的数量
|
||||
// Map<String, Long> sourceCountMap = allWorkDemand.stream()
|
||||
// .collect(Collectors.groupingBy(PmDemand::getWork_order, Collectors.counting()));
|
||||
//
|
||||
// // 统计 pmDemandDtos 中每个工单的数量
|
||||
// Map<String, Long> targetCountMap = pmDemandDtos.stream()
|
||||
// .collect(Collectors.groupingBy(PmDemandDto::getWorkOrder, Collectors.counting()));
|
||||
//
|
||||
// // 找出数量不一致的工单
|
||||
// String collect = sourceCountMap.entrySet().stream()
|
||||
// .filter(entry -> {
|
||||
// Long targetCount = targetCountMap.getOrDefault(entry.getKey(), 0L);
|
||||
// return !entry.getValue().equals(targetCount);
|
||||
// })
|
||||
// .map(Map.Entry::getKey)
|
||||
// .collect(Collectors.joining(","));
|
||||
// throw new BadRequestException("存在未勾选完全的工单" + collect);
|
||||
// }
|
||||
// 一次性分成两组
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -432,13 +406,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
if (CollectionUtils.isEmpty(demands)) {
|
||||
throw new BadRequestException("需求单数据为空");
|
||||
}
|
||||
|
||||
PmDemandDto firstDemand = demands.get(0);
|
||||
|
||||
JSONObject billParam = new JSONObject();
|
||||
billParam.put("stor_code", resolveInventoryWarehouse(firstDemand.getInventoryDis()));
|
||||
billParam.put("biz_date", DateUtil.today());
|
||||
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("库存调拨"));
|
||||
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
billParam.put("remark", "需求单下推生成");
|
||||
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
@@ -463,8 +436,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
detailRow.put("qty_unit_id", codeToIdMap.get(demand.getSkuCode()).getQty_unit_id());
|
||||
detailRow.put("qty", demand.getQty());
|
||||
detailRow.put("source_bill_code", demand.getId());
|
||||
//走调拨回传
|
||||
detailRow.put("callback_strategy", "DealLLDBBillPmDeamndCallBack");
|
||||
//G,D开头的大件需求单走投料,其他小件走转储
|
||||
if (demand.getWorkOrder().startsWith("G")||demand.getWorkOrder().startsWith("D")){
|
||||
detailRow.put("callback_strategy", "sapProductionOutboundDelivery");
|
||||
}else {
|
||||
detailRow.put("callback_strategy", "DealLLDBBillPmDeamndCallBack");
|
||||
}
|
||||
detailRow.put("source_bill_type", "需求单");
|
||||
detailRow.put("source_billdtl_id", demand.getId());
|
||||
detailRow.put("source_bill_table", "pm_demand");
|
||||
|
||||
@@ -30,4 +30,9 @@ public interface MaterialDocumentService {
|
||||
void pushOut(String billType, MaterialDocumentFormDto dto);
|
||||
|
||||
void pushZd(String billType, List<Long> ids);
|
||||
|
||||
/**
|
||||
* 外部系统反馈完成:关闭物料凭证原单。未找到返回 false。
|
||||
*/
|
||||
boolean completeByExternal(String billType, String externalNo);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ public class MaterialDocument implements Serializable {
|
||||
|
||||
private String xabln;
|
||||
|
||||
/** 存储地点,取明细第一条 */
|
||||
private String lgort;
|
||||
|
||||
/** CREATED-已创建 POSTED-已过账 CANCELED-已取消 COMPLETED-已完成 */
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
m.xblnr,
|
||||
m.bktxt,
|
||||
m.xabln,
|
||||
m.lgort,
|
||||
m.status,
|
||||
MAX(i.lifnr) AS lifnr,
|
||||
COUNT(i.id) AS dtl_count,
|
||||
@@ -57,7 +58,7 @@
|
||||
</where>
|
||||
GROUP BY
|
||||
m.id, m.mblnr, m.mjahr, m.billtype, m.io, m.bldat, m.budat,
|
||||
m.usnam, m.xblnr, m.bktxt, m.xabln, m.status, m.created_time, m.updated_time
|
||||
m.usnam, m.xblnr, m.bktxt, m.xabln, m.lgort, m.status, m.created_time, m.updated_time
|
||||
ORDER BY m.created_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -33,6 +33,8 @@ public class MaterialDocumentListVo {
|
||||
|
||||
private String xabln;
|
||||
|
||||
private String lgort;
|
||||
|
||||
private String status;
|
||||
|
||||
private String statusName;
|
||||
|
||||
@@ -57,6 +57,7 @@ import java.util.stream.Collectors;
|
||||
public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
|
||||
private static final int NOT_DELETED = 0;
|
||||
private static final String ZD_LGORT = "R001";
|
||||
|
||||
private final MaterialDocumentMapper documentMapper;
|
||||
private final MaterialDocumentItemMapper itemMapper;
|
||||
@@ -138,6 +139,7 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
document.setBudat(body.getBudat());
|
||||
document.setUsnam(body.getUsnam());
|
||||
document.setBwart(itemsToStore.get(0).getBwart());
|
||||
document.setLgort(StrUtil.trim(itemsToStore.get(0).getLgort()));
|
||||
document.setXblnr(body.getXblnr());
|
||||
document.setBktxt(body.getBktxt());
|
||||
document.setXabln(body.getXabln());
|
||||
@@ -228,6 +230,7 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
document.setMjahr(dto.getMjahr().trim());
|
||||
document.setBilltype(type.getCode());
|
||||
document.setIo(type.getIo().getCode());
|
||||
document.setLgort(firstItemLgort(dto.getItems()));
|
||||
document.setStatus(StrUtil.blankToDefault(dto.getStatus(), MaterialDocumentStatus.CREATED.getCode()));
|
||||
document.setCreated_by(operator);
|
||||
document.setDeleted(NOT_DELETED);
|
||||
@@ -252,6 +255,7 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
document.setXblnr(dto.getXblnr());
|
||||
document.setBktxt(dto.getBktxt());
|
||||
document.setXabln(dto.getXabln());
|
||||
document.setLgort(firstItemLgort(dto.getItems()));
|
||||
if (StrUtil.isNotBlank(dto.getStatus())) {
|
||||
document.setStatus(dto.getStatus());
|
||||
}
|
||||
@@ -327,6 +331,9 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
if (!StrUtil.equals(document.getBilltype(), type.getCode())) {
|
||||
throw new BadRequestException("下推失败:单据类型不匹配");
|
||||
}
|
||||
if (ZD_LGORT.equals(StrUtil.trim(document.getLgort()))) {
|
||||
throw new BadRequestException("下推失败:单据" + document.getMblnr() + "存储地点为R001,不能下推出库");
|
||||
}
|
||||
List<MaterialDocumentItem> items = listItems(document.getId());
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
throw new BadRequestException("下推失败:单据明细不存在");
|
||||
@@ -365,6 +372,9 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
if (!MaterialDocumentStatus.CREATED.getCode().equals(document.getStatus())) {
|
||||
throw new BadRequestException("下推失败:单据" + document.getMblnr() + "不是已创建状态");
|
||||
}
|
||||
if (!ZD_LGORT.equals(StrUtil.trim(document.getLgort()))) {
|
||||
throw new BadRequestException("下推失败:单据" + document.getMblnr() + "存储地点不是R001,不能下推中鼎WMS");
|
||||
}
|
||||
List<MaterialDocumentItem> items = listItems(document.getId());
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
throw new BadRequestException("下推失败:单据" + document.getMblnr() + "明细不存在");
|
||||
@@ -378,6 +388,33 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean completeByExternal(String billType, String externalNo) {
|
||||
if (StrUtil.isBlank(billType) || StrUtil.isBlank(externalNo)) {
|
||||
return false;
|
||||
}
|
||||
List<MaterialDocument> documents = documentMapper.selectList(new LambdaQueryWrapper<MaterialDocument>()
|
||||
.eq(MaterialDocument::getMblnr, externalNo.trim())
|
||||
.eq(MaterialDocument::getBilltype, billType.trim())
|
||||
.eq(MaterialDocument::getDeleted, NOT_DELETED));
|
||||
if (CollectionUtils.isEmpty(documents)) {
|
||||
return false;
|
||||
}
|
||||
for (MaterialDocument document : documents) {
|
||||
if (MaterialDocumentStatus.CANCELED.getCode().equals(document.getStatus())) {
|
||||
throw new BadRequestException("单据" + document.getMblnr() + "已取消,不能完成");
|
||||
}
|
||||
if (MaterialDocumentStatus.COMPLETED.getCode().equals(document.getStatus())) {
|
||||
continue;
|
||||
}
|
||||
document.setStatus(MaterialDocumentStatus.COMPLETED.getCode());
|
||||
document.setUpdated_by("EXTERNAL");
|
||||
documentMapper.updateById(document);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Integer zdBillType(MaterialDocumentBillType type) {
|
||||
if (type == MaterialDocumentBillType.PURCHASE_IN) {
|
||||
return 1;
|
||||
@@ -433,6 +470,13 @@ public class MaterialDocumentServiceImpl implements MaterialDocumentService {
|
||||
return billParam;
|
||||
}
|
||||
|
||||
private String firstItemLgort(List<MaterialDocumentItem> items) {
|
||||
if (CollectionUtils.isEmpty(items) || items.get(0) == null) {
|
||||
return null;
|
||||
}
|
||||
return StrUtil.trim(items.get(0).getLgort());
|
||||
}
|
||||
|
||||
private void saveFormItems(MaterialDocument document, List<MaterialDocumentItem> items, String operator) {
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,9 @@ public class OutboundDelivery implements Serializable {
|
||||
|
||||
private String lifnr;
|
||||
|
||||
/** 存储地点,取明细第一条 */
|
||||
private String lgort;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate wadat;
|
||||
|
||||
|
||||
@@ -378,6 +378,7 @@ public class OutboundDeliveryServiceImpl extends ServiceImpl<OutboundDeliveryMap
|
||||
}
|
||||
OutboundDelivery order = new OutboundDelivery();
|
||||
fillHeader(order, dto);
|
||||
order.setLgort(firstItemLgort(dto.getItems()));
|
||||
order.setStatus(StrUtil.blankToDefault(dto.getStatus(), OutboundDeliveryStatus.CREATED.getCode()));
|
||||
orderMapper.insert(order);
|
||||
saveItems(order.getVbeln(), dto.getItems());
|
||||
@@ -404,6 +405,7 @@ public class OutboundDeliveryServiceImpl extends ServiceImpl<OutboundDeliveryMap
|
||||
itemMapper.delete(new LambdaQueryWrapper<OutboundDeliveryItem>()
|
||||
.eq(OutboundDeliveryItem::getHeader_vbeln, order.getVbeln()));
|
||||
fillHeader(order, dto);
|
||||
order.setLgort(firstItemLgort(dto.getItems()));
|
||||
if (StrUtil.isNotBlank(dto.getStatus())) {
|
||||
order.setStatus(dto.getStatus());
|
||||
}
|
||||
@@ -683,6 +685,7 @@ public class OutboundDeliveryServiceImpl extends ServiceImpl<OutboundDeliveryMap
|
||||
order.setLfdat(parseDate(body.getLfdat()));
|
||||
order.setLfart(body.getLfart());
|
||||
order.setBilltype(resolveBilltypeCode(body.getLfart()));
|
||||
order.setLgort(firstSyncItemLgort(body.getBody()));
|
||||
order.setWadat_ist(parseDate(body.getWadatIst()));
|
||||
order.setStatus(OutboundDeliveryStatus.CREATED.getCode());
|
||||
if (header != null) {
|
||||
@@ -797,6 +800,20 @@ public class OutboundDeliveryServiceImpl extends ServiceImpl<OutboundDeliveryMap
|
||||
return billParam;
|
||||
}
|
||||
|
||||
private String firstSyncItemLgort(List<SapItemBody> items) {
|
||||
if (CollectionUtils.isEmpty(items) || items.get(0) == null) {
|
||||
return null;
|
||||
}
|
||||
return StrUtil.trim(items.get(0).getLgort());
|
||||
}
|
||||
|
||||
private String firstItemLgort(List<OutboundDeliveryItemDto> items) {
|
||||
if (CollectionUtils.isEmpty(items) || items.get(0) == null) {
|
||||
return null;
|
||||
}
|
||||
return StrUtil.trim(items.get(0).getLgort());
|
||||
}
|
||||
|
||||
private void saveItems(String headerVbeln, List<OutboundDeliveryItemDto> items) {
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,9 @@ public class SalesReturnOut implements Serializable {
|
||||
|
||||
private String lifnr;
|
||||
|
||||
/** 存储地点,取明细第一条 */
|
||||
private String lgort;
|
||||
|
||||
private String zterm;
|
||||
|
||||
private String ekorg;
|
||||
|
||||
@@ -130,6 +130,7 @@ public class SalesReturnOutServiceImpl implements SalesReturnOutService {
|
||||
}
|
||||
SalesReturnOut order = new SalesReturnOut();
|
||||
fillHeader(order, dto);
|
||||
order.setLgort(firstItemLgort(dto.getItems()));
|
||||
order.setStatus(StrUtil.blankToDefault(dto.getStatus(), SalesReturnOutStatus.CREATED.getCode()));
|
||||
orderMapper.insert(order);
|
||||
saveItems(order.getEbeln(), dto.getItems());
|
||||
@@ -155,6 +156,7 @@ public class SalesReturnOutServiceImpl implements SalesReturnOutService {
|
||||
}
|
||||
deleteItems(order.getEbeln());
|
||||
fillHeader(order, dto);
|
||||
order.setLgort(firstItemLgort(dto.getItems()));
|
||||
if (StrUtil.isNotBlank(dto.getStatus())) {
|
||||
order.setStatus(dto.getStatus());
|
||||
}
|
||||
@@ -224,6 +226,7 @@ public class SalesReturnOutServiceImpl implements SalesReturnOutService {
|
||||
order.setBstyp(body.getBstyp());
|
||||
order.setBsart(body.getBsart());
|
||||
order.setLifnr(body.getLifnr());
|
||||
order.setLgort(firstSyncItemLgort(body.getBody()));
|
||||
order.setZterm(body.getZterm());
|
||||
order.setEkorg(body.getEkorg());
|
||||
order.setEkgrp(body.getEkgrp());
|
||||
@@ -336,6 +339,20 @@ public class SalesReturnOutServiceImpl implements SalesReturnOutService {
|
||||
return billParam;
|
||||
}
|
||||
|
||||
private String firstSyncItemLgort(List<SalesReturnOutSyncItem> items) {
|
||||
if (CollectionUtils.isEmpty(items) || items.get(0) == null) {
|
||||
return null;
|
||||
}
|
||||
return StrUtil.trim(items.get(0).getLgort());
|
||||
}
|
||||
|
||||
private String firstItemLgort(List<SalesReturnOutItemDto> items) {
|
||||
if (CollectionUtils.isEmpty(items) || items.get(0) == null) {
|
||||
return null;
|
||||
}
|
||||
return StrUtil.trim(items.get(0).getLgort());
|
||||
}
|
||||
|
||||
private void saveItems(String headerEbeln, List<SalesReturnOutItemDto> items) {
|
||||
if (CollectionUtils.isEmpty(items)) {
|
||||
return;
|
||||
|
||||
@@ -14,6 +14,8 @@ import org.nl.wms.ext_manage.sap.api.dto.SubcontractConfirmItem;
|
||||
import org.nl.wms.ext_manage.sap.api.dto.SubcontractConfirmRequest;
|
||||
import org.nl.wms.ext_manage.sap.enums.SapConstant;
|
||||
import org.nl.wms.pm_manage.SourceBillTypeEnum;
|
||||
import org.nl.wms.ext_manage.sap.dto.SapBillFeedbackItem;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.enums.OutboundDeliveryBillType;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.enums.OutboundDeliveryStatus;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.service.dao.OutboundDelivery;
|
||||
import org.nl.wms.pm_manage.sap.outBoundDelivery.service.dao.OutboundDeliveryItem;
|
||||
@@ -35,6 +37,7 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -125,6 +128,130 @@ public class SapOutboundDelivery implements CallbackStrategy {
|
||||
outboundDeliveryMapper.updateById(delivery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部系统反馈交货单完成:按主明细回传 SAP MM064,并写入回传记录。
|
||||
*/
|
||||
public void feedbackComplete(String vbeln, List<SapBillFeedbackItem> feedbackItems) {
|
||||
if (StrUtil.isBlank(vbeln)) {
|
||||
throw new BadRequestException("交货回传失败:交货单号为空");
|
||||
}
|
||||
OutboundDelivery delivery = outboundDeliveryMapper.selectOne(new LambdaQueryWrapper<OutboundDelivery>()
|
||||
.eq(OutboundDelivery::getVbeln, vbeln.trim()));
|
||||
if (delivery == null) {
|
||||
throw new BadRequestException("交货回传失败:交货单" + vbeln + "不存在");
|
||||
}
|
||||
if (OutboundDeliveryStatus.CANCELED.getCode().equals(delivery.getStatus())) {
|
||||
throw new BadRequestException("交货回传失败:交货单" + vbeln + "已取消");
|
||||
}
|
||||
if (OutboundDeliveryStatus.COMPLETED.getCode().equals(delivery.getStatus())) {
|
||||
return;
|
||||
}
|
||||
List<OutboundDeliveryItem> sapItems = outboundDeliveryItemMapper.selectList(
|
||||
new LambdaQueryWrapper<OutboundDeliveryItem>()
|
||||
.eq(OutboundDeliveryItem::getHeader_vbeln, delivery.getVbeln()));
|
||||
List<OutboundDeliveryItem> mainItems = sapItems.stream()
|
||||
.filter(this::isMainItem)
|
||||
.collect(Collectors.toList());
|
||||
if (mainItems.isEmpty()) {
|
||||
throw new BadRequestException("交货回传失败:交货单" + vbeln + "明细不存在");
|
||||
}
|
||||
SubcontractConfirmRequest request = buildFeedbackRequest(delivery, mainItems, feedbackQty(feedbackItems));
|
||||
PmStockReturn stockReturn = new PmStockReturn();
|
||||
stockReturn.setRequest_Id(delivery.getVbeln());
|
||||
stockReturn.setRequest_type(feedbackRequestType(delivery));
|
||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode());
|
||||
stockReturn.setCreate_time(DateUtil.now());
|
||||
stockReturn.setRequest_data(JSON.toJSONString(request));
|
||||
try {
|
||||
JSONObject sapResult = sapApi.subcontractDeliveryConfirm(request);
|
||||
stockReturn.setStatus(StockReturnStatusEnum.SUCESS.getCode());
|
||||
stockReturn.setProcess_time(DateUtil.now());
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("request", request);
|
||||
record.put("response", sapResult);
|
||||
stockReturn.setRequest_data(record.toJSONString());
|
||||
} catch (Exception e) {
|
||||
log.error("交货单{}回传SAP失败", delivery.getVbeln(), e);
|
||||
stockReturn.setError_msg(e.getMessage());
|
||||
stockReturn.setStatus(StockReturnStatusEnum.FAIL.getCode());
|
||||
stockReturn.setProcess_time(DateUtil.now());
|
||||
}
|
||||
iPmStockReturnService.save(stockReturn);
|
||||
delivery.setStatus(OutboundDeliveryStatus.COMPLETED.getCode());
|
||||
outboundDeliveryMapper.updateById(delivery);
|
||||
}
|
||||
|
||||
private String feedbackRequestType(OutboundDelivery delivery) {
|
||||
OutboundDeliveryBillType billType = OutboundDeliveryBillType.ofCode(delivery.getBilltype());
|
||||
if (billType == null) {
|
||||
return SourceBillTypeEnum.SAP_OUTBOUND_DELIVERY.getDesc();
|
||||
}
|
||||
return billType.getName();
|
||||
}
|
||||
|
||||
private Map<String, BigDecimal> feedbackQty(List<SapBillFeedbackItem> feedbackItems) {
|
||||
Map<String, BigDecimal> qtyByItemNo = new HashMap<>();
|
||||
if (feedbackItems == null) {
|
||||
return qtyByItemNo;
|
||||
}
|
||||
for (SapBillFeedbackItem item : feedbackItems) {
|
||||
if (item == null || StrUtil.isBlank(item.getExternalItemNo()) || item.getActualQty() == null) {
|
||||
continue;
|
||||
}
|
||||
qtyByItemNo.merge(item.getExternalItemNo().trim(), BigDecimal.valueOf(item.getActualQty()), BigDecimal::add);
|
||||
}
|
||||
return qtyByItemNo;
|
||||
}
|
||||
|
||||
private SubcontractConfirmRequest buildFeedbackRequest(OutboundDelivery delivery,
|
||||
List<OutboundDeliveryItem> mainItems,
|
||||
Map<String, BigDecimal> qtyByItemNo) {
|
||||
SubcontractConfirmRequest request = new SubcontractConfirmRequest();
|
||||
SubcontractConfirmHeader header = new SubcontractConfirmHeader();
|
||||
header.setIntfId(SapConstant.INTF_MM064);
|
||||
header.setSrcSystem(SapConstant.MM064_SRC_SYSTEM);
|
||||
header.setDestSystem(SapConstant.DEST_SYSTEM);
|
||||
header.setSrcMsgid(StrUtil.blankToDefault(delivery.getSrc_msgid(), ""));
|
||||
header.setRequesttime(DateUtil.now());
|
||||
header.setBackup1("");
|
||||
header.setBackup2("");
|
||||
request.setHeader(header);
|
||||
|
||||
SubcontractConfirmBody body = new SubcontractConfirmBody();
|
||||
body.setVbeln(delivery.getVbeln());
|
||||
body.setLifex(String.valueOf(delivery.getId()));
|
||||
body.setLifnr(StrUtil.blankToDefault(delivery.getLifnr(), ""));
|
||||
body.setWadat(formatSapDate(delivery.getWadat()));
|
||||
body.setWadatIst(formatSapDate(delivery.getWadat_ist() != null ? delivery.getWadat_ist() : LocalDate.now()));
|
||||
List<SubcontractConfirmItem> items = new ArrayList<>();
|
||||
for (OutboundDeliveryItem sapItem : mainItems) {
|
||||
BigDecimal qty = qtyByItemNo.get(StrUtil.trim(sapItem.getPosnr()));
|
||||
if (qty == null) {
|
||||
qty = sapItem.getDeliv_qty();
|
||||
}
|
||||
items.add(toFeedbackItem(delivery.getVbeln(), sapItem, qty));
|
||||
}
|
||||
body.setItems(items);
|
||||
request.setBody(Collections.singletonList(body));
|
||||
return request;
|
||||
}
|
||||
|
||||
private SubcontractConfirmItem toFeedbackItem(String vbeln, OutboundDeliveryItem sapItem, BigDecimal qty) {
|
||||
SubcontractConfirmItem item = new SubcontractConfirmItem();
|
||||
item.setVbeln(vbeln);
|
||||
item.setPosnr(StrUtil.blankToDefault(sapItem.getPosnr(), ""));
|
||||
item.setLifexpos(String.valueOf(sapItem.getId()));
|
||||
item.setMaterial(StrUtil.blankToDefault(sapItem.getMaterial(), ""));
|
||||
item.setMatlDesc(StrUtil.blankToDefault(sapItem.getMatl_desc(), ""));
|
||||
item.setDelivQty(formatQty(qty));
|
||||
item.setUnit(StrUtil.blankToDefault(sapItem.getUnit(), ""));
|
||||
item.setPoNumber(StrUtil.blankToDefault(sapItem.getPo_number(), ""));
|
||||
item.setPoItem(StrUtil.blankToDefault(sapItem.getPo_item(), ""));
|
||||
item.setWerks(StrUtil.isNotBlank(sapItem.getWerks()) ? sapItem.getWerks() : SapConstant.WERKS);
|
||||
item.setLgort(sapItem.getLgort());
|
||||
return item;
|
||||
}
|
||||
|
||||
private SubcontractConfirmRequest buildRequest(IOStorInvDtl param, OutboundDelivery delivery,
|
||||
List<IOStorInvDtl> billItems,
|
||||
Map<String, OutboundDeliveryItem> sapItemByPosnr) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.wms.ext_manage.sap.api.dto.ProductionOutboundBody;
|
||||
import org.nl.wms.ext_manage.sap.api.dto.ProductionOutboundHeader;
|
||||
import org.nl.wms.ext_manage.sap.api.dto.ProductionOutboundRequest;
|
||||
import org.nl.wms.ext_manage.sap.enums.SapConstant;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
|
||||
@@ -103,6 +104,111 @@ public class SapProductionOutboundDelivery implements CallbackStrategy {
|
||||
iPmStockReturnService.save(stockReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中鼎反馈需求单完成:按反馈数量做 SAP 生产领料出库(PP055),并写入回传记录。
|
||||
*/
|
||||
public void feedbackDemand(PmDemand demand, BigDecimal qty) {
|
||||
if (demand == null || StrUtil.isBlank(demand.getId())) {
|
||||
throw new BadRequestException("生产领料回传失败:需求单为空");
|
||||
}
|
||||
if (qty == null || qty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new BadRequestException("生产领料回传失败:需求单" + demand.getId() + "反馈数量无效");
|
||||
}
|
||||
String orderCode = StrUtil.blankToDefault(StrUtil.trim(demand.getWork_order()), StrUtil.trim(demand.getOrder_code()));
|
||||
if (StrUtil.isBlank(orderCode)) {
|
||||
throw new BadRequestException("生产领料回传失败:需求单" + demand.getId() + "工单号为空");
|
||||
}
|
||||
WorkOrderDao workOrder = iWorkOrderService.getWorkOrder(orderCode);
|
||||
if (workOrder == null) {
|
||||
throw new BadRequestException("生产领料回传失败:工单" + orderCode + "不存在");
|
||||
}
|
||||
if (StrUtil.isBlank(demand.getSku_code())) {
|
||||
throw new BadRequestException("生产领料回传失败:需求单" + demand.getId() + "物料为空");
|
||||
}
|
||||
String lgort = resolveLgort(demand);
|
||||
if (StrUtil.isBlank(lgort)) {
|
||||
throw new BadRequestException("生产领料回传失败:需求单" + demand.getId() + "存储地点为空");
|
||||
}
|
||||
List<WorkOrderBomDao> orderBomItem = iWorkOrderService.getOrderBomItem(workOrder.getOrder_code());
|
||||
WorkOrderBomDao matchedBom = matchBomItem(orderBomItem, demand.getSku_code());
|
||||
ProductionOutboundRequest request = buildDemandRequest(demand, orderCode, lgort, qty, matchedBom);
|
||||
|
||||
PmStockReturn stockReturn = new PmStockReturn();
|
||||
stockReturn.setRequest_Id(demand.getId());
|
||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode());
|
||||
stockReturn.setCreate_time(DateUtil.now());
|
||||
stockReturn.setRequest_data(JSON.toJSONString(request));
|
||||
try {
|
||||
JSONObject sapResult = sapApi.productionOutbound(request);
|
||||
stockReturn.setStatus(StockReturnStatusEnum.SUCESS.getCode());
|
||||
stockReturn.setProcess_time(DateUtil.now());
|
||||
JSONObject record = new JSONObject();
|
||||
record.put("request", request);
|
||||
record.put("response", sapResult);
|
||||
stockReturn.setRequest_data(record.toJSONString());
|
||||
} catch (Exception e) {
|
||||
log.error("需求单{}生产领料回传SAP失败", demand.getId(), e);
|
||||
stockReturn.setError_msg(e.getMessage());
|
||||
stockReturn.setStatus(StockReturnStatusEnum.FAIL.getCode());
|
||||
stockReturn.setProcess_time(DateUtil.now());
|
||||
}
|
||||
iPmStockReturnService.save(stockReturn);
|
||||
}
|
||||
|
||||
private ProductionOutboundRequest buildDemandRequest(PmDemand demand, String orderCode, String lgort,
|
||||
BigDecimal qty, WorkOrderBomDao matchedBom) {
|
||||
String today = LocalDate.now().format(DATE_BASIC);
|
||||
ProductionOutboundRequest request = new ProductionOutboundRequest();
|
||||
ProductionOutboundHeader header = new ProductionOutboundHeader();
|
||||
header.setIntfId(SapConstant.INTF_PP055);
|
||||
header.setSrcSystem(SapConstant.SRC_SYSTEM);
|
||||
header.setDestSystem(SapConstant.DEST_SYSTEM);
|
||||
header.setRequesttime(System.currentTimeMillis());
|
||||
request.setHeader(header);
|
||||
|
||||
ProductionOutboundBody body = new ProductionOutboundBody();
|
||||
body.setDocno("FEED" + System.nanoTime());
|
||||
body.setBudat(today);
|
||||
body.setBldat(today);
|
||||
body.setMatnr(demand.getSku_code().trim());
|
||||
body.setWerks(SapConstant.WERKS);
|
||||
body.setLgort(lgort);
|
||||
body.setAufnr(orderCode);
|
||||
body.setErfmg(qty.doubleValue());
|
||||
body.setRsnum(matchedBom != null ? StrUtil.blankToDefault(matchedBom.getRsnum(), "") : "");
|
||||
body.setRspos(matchedBom != null ? StrUtil.blankToDefault(matchedBom.getRspos(), "") : "");
|
||||
body.setTl("");
|
||||
request.setBody(Collections.singletonList(body));
|
||||
return request;
|
||||
}
|
||||
|
||||
private String resolveLgort(PmDemand demand) {
|
||||
String fromInventory = firstWarehouse(demand.getInventory_dis());
|
||||
if (StrUtil.isNotBlank(fromInventory)) {
|
||||
return fromInventory;
|
||||
}
|
||||
return StrUtil.trim(demand.getWarehouse_code());
|
||||
}
|
||||
|
||||
private String firstWarehouse(String raw) {
|
||||
if (StrUtil.isBlank(raw)) {
|
||||
return "";
|
||||
}
|
||||
String text = raw.trim();
|
||||
if (text.startsWith("[")) {
|
||||
try {
|
||||
List<String> values = JSON.parseArray(text, String.class);
|
||||
if (values != null && !values.isEmpty() && StrUtil.isNotBlank(values.get(0))) {
|
||||
return values.get(0).trim();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("解析inventory_dis失败: {}", raw);
|
||||
}
|
||||
}
|
||||
return text.contains(",") ? text.split(",")[0].trim() : text;
|
||||
}
|
||||
|
||||
private ProductionOutboundRequest buildRequest(IOStorInvDtl param, WorkOrderDao workOrder,
|
||||
List<IOStorInvDtl> billItems) {
|
||||
String today = LocalDate.now().format(DATE_BASIC);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
-- 物料凭证主表增加存储地点:已有库执行,库名请按实际修改
|
||||
-- 新增单据由程序写入;历史单据按明细第一条(最小行号)回填
|
||||
|
||||
ALTER TABLE `wms_nlwq`.`material_document`
|
||||
ADD COLUMN `lgort` VARCHAR(20) DEFAULT NULL COMMENT '存储地点(取明细第一条)' AFTER `xabln`;
|
||||
|
||||
UPDATE `wms_nlwq`.`material_document` m
|
||||
INNER JOIN `wms_nlwq`.`material_document_item` i
|
||||
ON i.document_id = m.id AND i.deleted = 0
|
||||
INNER JOIN (
|
||||
SELECT document_id, MIN(zeile) AS min_zeile
|
||||
FROM `wms_nlwq`.`material_document_item`
|
||||
WHERE deleted = 0
|
||||
GROUP BY document_id
|
||||
) t ON t.document_id = i.document_id AND i.zeile = t.min_zeile
|
||||
SET m.lgort = i.lgort
|
||||
WHERE m.deleted = 0;
|
||||
|
||||
-- 委外交货单主表、采购退货出库主表增加存储地点
|
||||
ALTER TABLE `wms_nlwq`.`outbound_delivery`
|
||||
ADD COLUMN `lgort` VARCHAR(20) DEFAULT NULL COMMENT '存储地点(取明细第一条)' AFTER `lifnr`;
|
||||
|
||||
UPDATE `wms_nlwq`.`outbound_delivery` m
|
||||
INNER JOIN `wms_nlwq`.`outbound_delivery_item` i ON i.header_vbeln = m.vbeln
|
||||
INNER JOIN (
|
||||
SELECT header_vbeln, MIN(id) AS min_id
|
||||
FROM `wms_nlwq`.`outbound_delivery_item`
|
||||
WHERE IFNULL(rspos, 0) = 0
|
||||
GROUP BY header_vbeln
|
||||
) t ON t.header_vbeln = i.header_vbeln AND t.min_id = i.id
|
||||
SET m.lgort = i.lgort;
|
||||
|
||||
ALTER TABLE `wms_nlwq`.`sap_sales_return_out`
|
||||
ADD COLUMN `lgort` VARCHAR(20) DEFAULT NULL COMMENT '存储地点(取明细第一条)' AFTER `lifnr`;
|
||||
|
||||
UPDATE `wms_nlwq`.`sap_sales_return_out` m
|
||||
INNER JOIN `wms_nlwq`.`sap_sales_return_out_item` i ON i.header_ebeln = m.ebeln
|
||||
INNER JOIN (
|
||||
SELECT header_ebeln, MIN(id) AS min_id
|
||||
FROM `wms_nlwq`.`sap_sales_return_out_item`
|
||||
GROUP BY header_ebeln
|
||||
) t ON t.header_ebeln = i.header_ebeln AND t.min_id = i.id
|
||||
SET m.lgort = i.lgort;
|
||||
@@ -56,6 +56,7 @@ CREATE TABLE material_document (
|
||||
xblnr VARCHAR(50) COMMENT '参考凭证编号',
|
||||
bktxt VARCHAR(100) COMMENT '凭证抬头文本',
|
||||
xabln VARCHAR(50) COMMENT '收货/发货单编号',
|
||||
lgort VARCHAR(20) COMMENT '存储地点(取明细第一条)',
|
||||
|
||||
-- 状态字段
|
||||
status VARCHAR(20) DEFAULT 'CREATED' COMMENT '状态:CREATED-已创建,POSTED-已过账,CANCELED-已取消,COMPLETED-已完成',
|
||||
@@ -158,12 +159,14 @@ CREATE TABLE material_document_item (
|
||||
-- 已建表补字段时执行:
|
||||
-- ALTER TABLE material_document ADD COLUMN billtype VARCHAR(32) DEFAULT NULL COMMENT '单据类型' AFTER mjahr;
|
||||
-- ALTER TABLE material_document ADD COLUMN io VARCHAR(2) DEFAULT NULL COMMENT '出或入:0出 1入' AFTER billtype;
|
||||
-- ALTER TABLE material_document ADD COLUMN lgort VARCHAR(20) DEFAULT NULL COMMENT '存储地点(取明细第一条)' AFTER xabln;
|
||||
|
||||
CREATE TABLE outbound_delivery (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
vbeln VARCHAR(20) NOT NULL UNIQUE COMMENT '交货单号',
|
||||
bldat DATE COMMENT '单据日期',
|
||||
lifnr VARCHAR(20) COMMENT '供应商/客户编号',
|
||||
lgort VARCHAR(20) COMMENT '存储地点(取明细第一条)',
|
||||
wadat DATE COMMENT '计划发货日期',
|
||||
lfdat DATE COMMENT '交货日期',
|
||||
lfart VARCHAR(10) COMMENT '交货单类型',
|
||||
@@ -222,6 +225,7 @@ CREATE TABLE sap_sales_return_out (
|
||||
bstyp VARCHAR(2) COMMENT '采购凭证类别',
|
||||
bsart VARCHAR(10) COMMENT '采购凭证类型',
|
||||
lifnr VARCHAR(20) COMMENT '供应商科目编号',
|
||||
lgort VARCHAR(20) COMMENT '存储地点(取明细第一条)',
|
||||
zterm VARCHAR(10) COMMENT '付款条件代码',
|
||||
ekorg VARCHAR(10) COMMENT '采购组织',
|
||||
ekgrp VARCHAR(10) COMMENT '采购组',
|
||||
|
||||
Reference in New Issue
Block a user