订单拆分上报sap

highway
zhaoxiaolin 1 year ago
parent 34e131289b
commit 2ce35572f2

@ -24,6 +24,10 @@ public interface RemoteSapService {
@PostMapping("/sap/shopOrderSync")
public R<List<SapProOrder>> shopOrderSync(@RequestBody SapShopOrderQuery sapProOrder);
/**传递母订单号和母订单数量**/
@PostMapping("/sap/shopUpdateSync")
public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder);
@PostMapping("/sap/sapRouterSync")
public R<Boolean> sapRouterSync(@RequestBody SapRouterQuery sapRouterQuery);

@ -7,6 +7,7 @@ import com.op.system.api.model.SapProOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -73,6 +74,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("sap bom同步失败" + throwable.getMessage());
}
@Override
public R shopUpdateSync(SapShopOrderQuery sapProOrder) {
return R.fail("sap shopUpdateSync失败" + throwable.getMessage());
}
};
}

@ -1,5 +1,6 @@
package com.op.plan.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
@ -279,6 +280,20 @@ public class ProOrderServiceImpl implements IProOrderService {
if("0".equals(workOrder.getParentOrder())){
//20231127,加入belongWorkOrder概念
belongWorkOrder = workOrder.getWorkorderCode();
//推送sap订单更新信息
SapShopOrderQuery sapChange = new SapShopOrderQuery();
sapChange.setAufnr(proOrder.getOrderCode());//母订单号
BigDecimal newSapQuantityNum = new BigDecimal(proOrder.getQuantity())
.subtract(new BigDecimal(proOrder.getQuantitySplit()));
sapChange.setQuantity(newSapQuantityNum.toString());//母订单新数量
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更:修改前"+proOrder.getQuantity()+","+
",已拆数量"+proOrder.getQuantitySplit()+","+
"给sap汇报数量"+newSapQuantityNum.toString());
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg());
}
workOrder.setBelongWorkOrder(belongWorkOrder);

@ -23,6 +23,7 @@ import com.op.system.api.domain.dto.MesPrepareDTO;
import com.op.system.api.domain.dto.MesPrepareDetailDTO;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapMaterialPreparation;
import com.op.system.api.domain.sap.SapShopOrderQuery;
import net.bytebuddy.matcher.FilterableList;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang.StringUtils;
@ -36,6 +37,7 @@ 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.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -759,6 +761,23 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
Long conver = 1L;
int index = workOrderList.size();
while (run) {
if(StringUtils.isBlank(proOrder.getParentOrder())){
//推送sap订单更新信息
SapShopOrderQuery sapChange = new SapShopOrderQuery();
sapChange.setAufnr(proOrder.getOrderCode());//母订单号
BigDecimal newSapQuantityNum = new BigDecimal(proOrder.getQuantity())
.subtract(new BigDecimal(proOrder.getAtrr1()));
sapChange.setQuantity(newSapQuantityNum.toString());//母订单新数量
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更:修改前"+proOrder.getQuantity()+","+
"已拆数量"+proOrder.getAtrr1()+","+
"给sap汇报数量"+newSapQuantityNum.toString());
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg());
}
// 获得对应工单
ProOrderWorkorder proOrderWorkorder = workOrderList.get(--index);
// 更新订单

Loading…
Cancel
Save