|
|
@ -6,6 +6,7 @@ import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.common.core.utils.StringUtils;
|
|
|
|
import com.op.common.core.utils.StringUtils;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.op.sap.domain.vo.SapPurchaseOrderQuery;
|
|
|
|
import com.op.sap.service.SapOrderService;
|
|
|
|
import com.op.sap.service.SapOrderService;
|
|
|
|
|
|
|
|
|
|
|
|
import com.op.sap.util.SAPConnUtils;
|
|
|
|
import com.op.sap.util.SAPConnUtils;
|
|
|
@ -296,6 +297,98 @@ public class SapOrderServiceImpl implements SapOrderService {
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public R sapPurchaseOrderSync(SapPurchaseOrderQuery sapPurchaseOrderQuery) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// 获取调用 RFC 函数对象
|
|
|
|
|
|
|
|
//获取连接
|
|
|
|
|
|
|
|
//JCoDestination dest = SAPConnUtils.connect();
|
|
|
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_GET_PROCURE");
|
|
|
|
|
|
|
|
JCoParameterList jCoParameterList= func.getTableParameterList();
|
|
|
|
|
|
|
|
System.out.println(jCoParameterList);
|
|
|
|
|
|
|
|
if (func == null) {
|
|
|
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/** S_EBELN 采购订单号
|
|
|
|
|
|
|
|
* S_EBELP 行项目
|
|
|
|
|
|
|
|
* S_MATNR 物料号
|
|
|
|
|
|
|
|
* S_PWERK 工厂
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!StringUtils.isNull(sapPurchaseOrderQuery.getEbeln())){
|
|
|
|
|
|
|
|
JCoTable S_EBELN = func.getTableParameterList().getTable("S_EBELN");
|
|
|
|
|
|
|
|
S_EBELN.appendRow();
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.SIGN, "I");
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.OPTION, "EQ");
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.LOW, sapPurchaseOrderQuery.getEbeln());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isNull(sapPurchaseOrderQuery.getEbeln())){
|
|
|
|
|
|
|
|
JCoTable S_EBELN = func.getTableParameterList().getTable("S_EBELP");
|
|
|
|
|
|
|
|
S_EBELN.appendRow();
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.SIGN, "I");
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.OPTION, "EQ");
|
|
|
|
|
|
|
|
S_EBELN.setValue(Constants.LOW, sapPurchaseOrderQuery.getEbeln());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isNull(sapPurchaseOrderQuery.getMatnr())){
|
|
|
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
|
|
|
S_MATNR.appendRow();
|
|
|
|
|
|
|
|
S_MATNR.setValue(Constants.SIGN, "I");
|
|
|
|
|
|
|
|
S_MATNR.setValue(Constants.OPTION, "EQ");
|
|
|
|
|
|
|
|
S_MATNR.setValue(Constants.LOW, sapPurchaseOrderQuery.getMatnr());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isNull(sapPurchaseOrderQuery.getPwerk())){
|
|
|
|
|
|
|
|
JCoTable S_PWERK = func.getTableParameterList().getTable("S_PWERK");
|
|
|
|
|
|
|
|
S_PWERK.appendRow();
|
|
|
|
|
|
|
|
S_PWERK.setValue(Constants.SIGN, "I");
|
|
|
|
|
|
|
|
S_PWERK.setValue(Constants.OPTION, "EQ");
|
|
|
|
|
|
|
|
S_PWERK.setValue(Constants.LOW, sapPurchaseOrderQuery.getPwerk());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
|
|
|
// 获取 内表 - LT_PROCURE
|
|
|
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_PROCURE");
|
|
|
|
|
|
|
|
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
|
|
|
|
|
|
|
|
System.out.println("###" + metaData.toString());
|
|
|
|
|
|
|
|
return R.ok();
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public R shopUpdateSync(SapShopOrderQuery sapProOrder) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
|
|
|
JCoFunction func = repository.getFunction("ZPPR_MES_PRODORD_CHANGE");
|
|
|
|
|
|
|
|
// 配置传入参数
|
|
|
|
|
|
|
|
JCoParameterList jCoParameterList = func.getImportParameterList();
|
|
|
|
|
|
|
|
System.out.println(jCoParameterList);
|
|
|
|
|
|
|
|
if (func == null) {
|
|
|
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(sapProOrder.getAufnr()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return R.fail("订单号为空!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(sapProOrder.getQuantity()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return R.fail("数量为空!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jCoParameterList.setValue("P_AUFNR",sapProOrder.getAufnr());
|
|
|
|
|
|
|
|
jCoParameterList.setValue("P_QUANTITY",sapProOrder.getQuantity());
|
|
|
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
|
|
|
JCoParameterList J= func.getExportParameterList();
|
|
|
|
|
|
|
|
System.out.println(J);
|
|
|
|
|
|
|
|
String MESSAGE= func.getExportParameterList().getString("MESSAGE");
|
|
|
|
|
|
|
|
System.out.println(MESSAGE);
|
|
|
|
|
|
|
|
return R.ok(MESSAGE);
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|