|
|
|
@ -1176,6 +1176,10 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
}else{
|
|
|
|
|
dtos.addAll(dtos0);
|
|
|
|
|
}
|
|
|
|
|
// for (OdsProcureOrder order1:
|
|
|
|
|
// dtos ) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
String msg= dayin(dtos);
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
|
|
|
@ -1471,7 +1475,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
}
|
|
|
|
|
return orderLists;
|
|
|
|
|
}
|
|
|
|
|
// OdsProcureOutOrder order = odsProcureOutOrderMapper.selectMesPrepareBC(odsProcureOutOrder);
|
|
|
|
|
// OdsProcureOutOrder order = odsProcureOutOrderMapper.selectMesPrepareBC(odsProcureOutOrder);
|
|
|
|
|
List<OdsProcureOutOrder> orderList= odsProcureOutOrderMapper.selectPreDetailHzList(odsProcureOutOrder);
|
|
|
|
|
//根据订单号查询对应的最大批次号
|
|
|
|
|
Integer orderItem = 0;
|
|
|
|
@ -1660,9 +1664,122 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
|
|
|
|
|
wmsOdsEmStorageNews.setLastModifiedBy(createBy);
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatekdd(wmsOdsEmStorageNews);//库存调整
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
OdsProcureOutOrder order=new OdsProcureOutOrder();
|
|
|
|
|
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByOrderStatus(order);
|
|
|
|
|
if (orderList1.size()>0){
|
|
|
|
|
OutboundPostingzcSAPGY(orderList1);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OutboundPostingzcSAPGY(List<OdsProcureOutOrder> orderList) {
|
|
|
|
|
//先根据出库单获取
|
|
|
|
|
// * 退料的移动类型为 262
|
|
|
|
|
// * 领料的移动类型为 261
|
|
|
|
|
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByIDs(orderList);
|
|
|
|
|
List<OdsProcureOutOrder> orderList2 = new ArrayList<>();//非反冲
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();//非反冲
|
|
|
|
|
List<SapBackflushMPQuery> sapMaterialPostingFCList = new ArrayList<>();//反冲
|
|
|
|
|
List<OdsProcureOutOrder> orderList2FC = new ArrayList<>();//反冲
|
|
|
|
|
for (OdsProcureOutOrder odsProcureOutOrder :
|
|
|
|
|
orderList1) {
|
|
|
|
|
if (!"X".equals(odsProcureOutOrder.getUserDefined3())){
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("AUFNR", odsProcureOutOrder.getProduceCode());
|
|
|
|
|
map.put("PLANT", odsProcureOutOrder.getSiteCode());
|
|
|
|
|
String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
map.put("LGORT", lgort);
|
|
|
|
|
map.put("MATNR", odsProcureOutOrder.getMaterialCode());
|
|
|
|
|
map.put("QUANTITY", odsProcureOutOrder.getOutNumber().toString());
|
|
|
|
|
map.put("MEINS", odsProcureOutOrder.getUnit());
|
|
|
|
|
mapList.add(map);
|
|
|
|
|
orderList2.add(odsProcureOutOrder);
|
|
|
|
|
}else {
|
|
|
|
|
SapBackflushMPQuery sapBackflushMPQuery = new SapBackflushMPQuery();
|
|
|
|
|
sapBackflushMPQuery.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
|
|
|
|
|
String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
|
|
|
|
|
sapBackflushMPQuery.setLgort(lgort);//库存地点
|
|
|
|
|
sapBackflushMPQuery.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
|
|
|
|
|
sapBackflushMPQuery.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
|
|
|
|
|
sapBackflushMPQuery.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
|
|
|
|
|
sapBackflushMPQuery.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
|
|
|
|
|
sapMaterialPostingFCList.add(sapBackflushMPQuery);
|
|
|
|
|
orderList2FC.add(odsProcureOutOrder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mapList.size() > 0) {
|
|
|
|
|
//非反冲过账
|
|
|
|
|
SapMaterialPosting sapMaterialPosting = new SapMaterialPosting();
|
|
|
|
|
sapMaterialPosting.setPostingType("261");
|
|
|
|
|
sapMaterialPosting.setMapList(mapList);
|
|
|
|
|
R result = remoteSapService.sapMaterialPosting(sapMaterialPosting);
|
|
|
|
|
OdsProcureOutOrder order = new OdsProcureOutOrder();
|
|
|
|
|
int code = result.getCode();
|
|
|
|
|
String msg = result.getMsg();
|
|
|
|
|
//order.setSapMaterialPostingList(sapMaterialPostingList);
|
|
|
|
|
order.setUserDefined11(msg);
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
//过账成功
|
|
|
|
|
Map map = new HashMap();
|
|
|
|
|
map = (Map) result.getData();
|
|
|
|
|
String userDefined9 = (String) map.get("MATERIALDOCUMENT");
|
|
|
|
|
order.setUserDefined9(userDefined9);
|
|
|
|
|
order.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2);
|
|
|
|
|
for (OdsProcureOutOrder order1:
|
|
|
|
|
orderList2) {
|
|
|
|
|
//过账成功--减库存
|
|
|
|
|
List<WmsOdsMateStorageNews> odsEmStorageNews= odsProcureOutOrderMapper.selectWmsRawMissionOutByPrdAndMa(order1);
|
|
|
|
|
for (WmsOdsMateStorageNews wmsOdsMateStorageNews:
|
|
|
|
|
odsEmStorageNews) {
|
|
|
|
|
//wmsOdsMateStorageNews
|
|
|
|
|
wmsOdsMateStorageNews.setLastModifiedBy(SecurityUtils.getUsername());
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatesub(wmsOdsMateStorageNews);//库存调整
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//
|
|
|
|
|
order.setUserDefined9("");
|
|
|
|
|
order.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sapMaterialPostingFCList.size() > 0) {
|
|
|
|
|
//反冲过账
|
|
|
|
|
R result2 = remoteSapService.sapBackflushMP(sapMaterialPostingFCList);//x
|
|
|
|
|
int code = result2.getCode();
|
|
|
|
|
OdsProcureOutOrder order = new OdsProcureOutOrder();
|
|
|
|
|
String msg = result2.getMsg();
|
|
|
|
|
order.setUserDefined11(msg);
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
//过账成功
|
|
|
|
|
Map map = new HashMap();
|
|
|
|
|
map = (Map) result2.getData();
|
|
|
|
|
String userDefined9 = (String) map.get("MATERIALDOCUMENT");
|
|
|
|
|
order.setUserDefined9(userDefined9);
|
|
|
|
|
order.setUserDefined10("2");//成功
|
|
|
|
|
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2FC);
|
|
|
|
|
for (OdsProcureOutOrder order1:
|
|
|
|
|
orderList2FC) {
|
|
|
|
|
//过账成功--减库存
|
|
|
|
|
List<WmsOdsMateStorageNews> odsEmStorageNews= odsProcureOutOrderMapper.selectWmsRawMissionOutByPrdAndMa(order1);
|
|
|
|
|
for (WmsOdsMateStorageNews wmsOdsMateStorageNews:
|
|
|
|
|
odsEmStorageNews) {
|
|
|
|
|
//wmsOdsMateStorageNews
|
|
|
|
|
wmsOdsMateStorageNews.setLastModifiedBy(SecurityUtils.getUsername());
|
|
|
|
|
wmsOdsMateStorageNewsSnMapper.updatesub(wmsOdsMateStorageNews);//库存调整
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {//
|
|
|
|
|
order.setUserDefined9("");
|
|
|
|
|
order.setUserDefined10("3");//失败
|
|
|
|
|
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2FC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param orderList
|
|
|
|
|