wms过账修改1

master
mengjiao 1 month ago
parent 94f03c3d39
commit dd2a34c57c

@ -1120,11 +1120,11 @@ public class SapItemSyncImpl implements SapItemSyncService {
}else {
continue;
}
JCoFunction func2 = repository.getFunction("ZMES_106_MIGO");//105冲销
JCoFunction func2 = repository.getFunction("ZMES_106_MIGO");//105冲销--冲销
if (func2 == null) {
throw new RuntimeException("Function does not exist in SAP");
}
log.info("105参数-------" + mapList.toString());
log.info("106参数-------" + mapList.toString());
JCoTable L_ITEM = func2.getTableParameterList().getTable("L_ITEM");
L_ITEM.appendRow();
L_ITEM.setValue("LFBJA",map.get("LFBJA"));//参考凭证会计年度
@ -1143,7 +1143,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
MESSAGE = func2.getExportParameterList().getString("L_MSG");
MATERIALDOCUMENT = func2.getExportParameterList().getString("MATERIALDOCUMENT");
MATDOCUMENTYEAR = func2.getExportParameterList().getString("MATDOCUMENTYEAR");
log.info("105冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR);
log.info("106冲销结果结果-----" + RETCODE+"/" +MESSAGE+"/" +MATERIALDOCUMENT+"/" +MATDOCUMENTYEAR);
}
if((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
return R.fail(MESSAGE);

@ -351,6 +351,18 @@ public class OdsProcureOrderController extends BaseController {
odsProcureOrderService.OutboundPostingzcSAP(orderList);
return success();
}
/**
* 退
*
* @param orderList
* @return
*/
@PostMapping("/OutboundPostingzcSAPTH")
public AjaxResult OutboundPostingzcSAPTH(@RequestBody List<OdsProcureOutOrder> orderList) {
odsProcureOrderService.OutboundPostingzcSAPTH(orderList);
return success();
}
/**
*
*

@ -171,4 +171,6 @@ public interface OdsProcureOutOrderMapper {
void updateWmsRawMissionOutById(WmsOdsMateStorageNews wmsOdsMateStorageNews);
String selectwmsFpStorageNewsTS(String formattedDate);
List<OdsProcureOutOrder> selectWmsOdsProcureReturnOrderByproduceCode(@Param("order")OdsProcureOutOrder order);
}

@ -156,4 +156,6 @@ public interface IOdsProcureOrderService {
void OutboundPostingzcSAPTS(List<OdsProcureOutOrder> orderList);
void OutboundPostingzcSAPTH(List<OdsProcureOutOrder> orderList);
}

@ -1673,6 +1673,82 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
}
}
@Override
public void OutboundPostingzcSAPTH(List<OdsProcureOutOrder> orderList) {
//先根据出库单获取
// * 退料的移动类型为 262
// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3'
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByID(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.getReturnNumber().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.setUmlgo("0013");
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("262");
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.updateWMSOdsProcureReturnOrderByids(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.updateWMSOdsProcureReturnOrderByids(order, orderList2);
}
}
}
@Override
@DS("#header.poolName")
@ -2868,7 +2944,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
}
OdsProcureOutOrder order=new OdsProcureOutOrder();
order.setProduceCode(produceCode);
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderStatus(order);
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByproduceCode(order);
String fx="";
for(OdsProcureOutOrder order1:orderList1){
if(order1.getProduceCode().length()<=11){
@ -3714,7 +3790,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
public void OutboundPostingzcSAPGYTH(List<OdsProcureOutOrder> orderList){
//先根据出库单获取
// * 退料的移动类型为 262
// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3'
// * 领料的移动类型为 261-- and wms_ods_procure_out_order.Order_Status='3'
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureReturnOrderByID(orderList);
List<OdsProcureOutOrder> orderList2 = new ArrayList<>();//非反冲
List<Map<String, Object>> mapList = new ArrayList<>();//非反冲

Loading…
Cancel
Save