|
|
|
@ -8,9 +8,13 @@ import com.op.common.core.utils.StringUtils;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
|
|
|
|
|
import com.op.sap.domain.vo.SapOrderReceiptQuery;
|
|
|
|
|
import com.op.system.api.domain.sap.SapPurchaseOrderQuery;
|
|
|
|
|
import com.op.sap.service.SapOrderService;
|
|
|
|
|
|
|
|
|
|
import com.op.system.api.domain.sap.*;
|
|
|
|
|
import com.op.system.api.domain.sap.SapCloseOrderQuery;
|
|
|
|
|
import com.op.system.api.domain.sap.SapCreateOrder;
|
|
|
|
|
import com.op.system.api.domain.sap.SapRFW;
|
|
|
|
|
import com.op.system.api.domain.sap.SapShopOrderQuery;
|
|
|
|
|
import com.op.system.api.model.SapProOrder;
|
|
|
|
|
import com.sap.conn.jco.*;
|
|
|
|
|
|
|
|
|
@ -478,62 +482,40 @@ public class SapOrderServiceImpl implements SapOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R sapOrderReceipt(SapOrderReceiptQuery sapOrderReceiptQuery) {
|
|
|
|
|
public R sapOrderReceipt(List<Map<String, Object>> mapList) {
|
|
|
|
|
try {
|
|
|
|
|
log.info("智慧工厂101类型订单收货入参-------"+sapOrderReceiptQuery.toString());
|
|
|
|
|
log.info("智慧工厂101类型订单收货入参-------"+mapList.toString());
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_101_MIGO");
|
|
|
|
|
|
|
|
|
|
//System.out.println(jCoParameterList);
|
|
|
|
|
if (func == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(sapOrderReceiptQuery.getAufnr()))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("订单号为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(sapOrderReceiptQuery.getLgort()))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("库位为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(sapOrderReceiptQuery.getErfmg()))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("数量为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(sapOrderReceiptQuery.getCharg()))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("批号为空!");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(sapOrderReceiptQuery.getHsdat()))
|
|
|
|
|
{
|
|
|
|
|
return R.fail("生产日期为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 配置传入参数
|
|
|
|
|
JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM");
|
|
|
|
|
L_ITEM.appendRow();
|
|
|
|
|
|
|
|
|
|
// System.out.println(L_ITEM);
|
|
|
|
|
L_ITEM.setValue("AUFNR",sapOrderReceiptQuery.getAufnr());
|
|
|
|
|
L_ITEM.setValue("WERKS","1000");
|
|
|
|
|
L_ITEM.setValue("LGORT",sapOrderReceiptQuery.getLgort());
|
|
|
|
|
L_ITEM.setValue("QUANTITY",sapOrderReceiptQuery.getErfmg());
|
|
|
|
|
L_ITEM.setValue("BATCH",sapOrderReceiptQuery.getCharg());
|
|
|
|
|
L_ITEM.setValue("HSDAT",sapOrderReceiptQuery.getHsdat());
|
|
|
|
|
L_ITEM.setValue("ERFME",sapOrderReceiptQuery.getErfme());
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> stringObjectMap:mapList){
|
|
|
|
|
L_ITEM.appendRow();
|
|
|
|
|
L_ITEM.setValue("AUFNR",stringObjectMap.get("AUFNR"));
|
|
|
|
|
L_ITEM.setValue("WERKS",stringObjectMap.get("WERKS"));
|
|
|
|
|
L_ITEM.setValue("LGORT",stringObjectMap.get("LGORT"));
|
|
|
|
|
L_ITEM.setValue("QUANTITY",stringObjectMap.get("QUANTITY"));
|
|
|
|
|
L_ITEM.setValue("BATCH",stringObjectMap.get("BATCH"));
|
|
|
|
|
L_ITEM.setValue("HSDAT",stringObjectMap.get("HSDAT"));
|
|
|
|
|
L_ITEM.setValue("ERFME",stringObjectMap.get("ERFME"));
|
|
|
|
|
}
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
// System.out.println(func.getExportParameterList());
|
|
|
|
|
String RETCODE= func.getExportParameterList().getString("RETCODE");
|
|
|
|
|
String MESSAGE= func.getExportParameterList().getString("L_MSG");
|
|
|
|
|
String MATERIALDOCUMENT= func.getExportParameterList().getString("MATERIALDOCUMENT");
|
|
|
|
|
if ((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
|
|
|
|
|
log.error("订单收货结果-----"+MESSAGE);
|
|
|
|
|
return R.fail(null,"订单号:"+sapOrderReceiptQuery.getAufnr()+MESSAGE);
|
|
|
|
|
return R.fail(MESSAGE);
|
|
|
|
|
}else {
|
|
|
|
|
log.info("订单收货结果-----"+MESSAGE);
|
|
|
|
|
return R.ok(MATERIALDOCUMENT,"订单号:"+sapOrderReceiptQuery.getAufnr()+MESSAGE);
|
|
|
|
|
return R.ok(MATERIALDOCUMENT,MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
@ -615,17 +597,6 @@ public class SapOrderServiceImpl implements SapOrderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public static void main(String[] args) {
|
|
|
|
|
// List<SapBackflushMPQuery> sapBackflushMPQueryList=new ArrayList<>();
|
|
|
|
|
// SapBackflushMPQuery sapBackflushMPQuery=new SapBackflushMPQuery();
|
|
|
|
|
// sapBackflushMPQuery.setMatnr("000000020000000280");
|
|
|
|
|
// sapBackflushMPQuery.setPlant("1000");
|
|
|
|
|
// sapBackflushMPQuery.setLgort("0013");
|
|
|
|
|
// sapBackflushMPQuery.setQuantity("3600");
|
|
|
|
|
// sapBackflushMPQuery.setMeins("ST");
|
|
|
|
|
// sapBackflushMPQueryList.add(sapBackflushMPQuery);
|
|
|
|
|
// System.out.println(JSONObject.toJSONString(sapBackflushMPQueryList));
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|