|
|
|
@ -9,6 +9,7 @@ import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.utils.StringUtils;
|
|
|
|
|
import com.op.common.core.utils.bean.BeanValidators;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO;
|
|
|
|
|
import com.op.system.api.domain.sap.SapBackflushMPQuery;
|
|
|
|
|
import com.op.sap.domain.vo.SapItemQuery;
|
|
|
|
|
import com.op.system.api.domain.sap.SapMaterialPosting;
|
|
|
|
@ -68,7 +69,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
S_MATKL 物料组
|
|
|
|
|
S_ERSDA 创建日期
|
|
|
|
|
S_LAEDA 最后更改日期*/
|
|
|
|
|
|
|
|
|
|
sapItemQuery.setMatnr("000000040000005209");
|
|
|
|
|
if (!StringUtils.isNull(sapItemQuery.getMatnr())) {
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
S_MATNR.appendRow();
|
|
|
|
@ -93,14 +94,14 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
S_ERSDA.setValue(Constants.LOW, sapItemQuery.getErsda());
|
|
|
|
|
S_ERSDA.setValue("HIGH", END_DATE);
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isNull(sapItemQuery.getLaeda())) {
|
|
|
|
|
JCoTable S_LAEDA = func.getTableParameterList().getTable("S_LAEDA");
|
|
|
|
|
S_LAEDA.appendRow();
|
|
|
|
|
S_LAEDA.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_LAEDA.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_LAEDA.setValue(Constants.LOW, sapItemQuery.getLaeda());
|
|
|
|
|
S_LAEDA.setValue("HIGH", END_DATE);
|
|
|
|
|
}
|
|
|
|
|
// if (!StringUtils.isNull(sapItemQuery.getLaeda())) {
|
|
|
|
|
// JCoTable S_LAEDA = func.getTableParameterList().getTable("S_LAEDA");
|
|
|
|
|
// S_LAEDA.appendRow();
|
|
|
|
|
// S_LAEDA.setValue(Constants.SIGN, "I");
|
|
|
|
|
// S_LAEDA.setValue(Constants.OPTION, "BT");
|
|
|
|
|
// S_LAEDA.setValue(Constants.LOW, sapItemQuery.getLaeda());
|
|
|
|
|
// S_LAEDA.setValue("HIGH", END_DATE);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 获取调用 RFC 函数对象
|
|
|
|
|
func.execute(dest);
|
|
|
|
@ -211,6 +212,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
baseProduct.setGrossWeight(BRGEW);
|
|
|
|
|
baseProduct.setNetWeight(NTGEW);
|
|
|
|
|
baseProduct.setVolume(VOLUM);
|
|
|
|
|
baseProduct.setMeins(MEINS);
|
|
|
|
|
baseProduct.setDelFlag("0");
|
|
|
|
|
baseProduct.setActiveFlag("1");
|
|
|
|
|
baseProduct.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
@ -352,6 +354,8 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String importProducts(List<SapBaseProduct> sapBaseProductList) {
|
|
|
|
|
if (StringUtils.isNull(sapBaseProductList) || sapBaseProductList.size() == 0) {
|
|
|
|
|
throw new ServiceException("同步物料数据为空!");
|
|
|
|
@ -394,4 +398,71 @@ public class SapItemSyncImpl implements SapItemSyncService {
|
|
|
|
|
}
|
|
|
|
|
return successMsg.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R inComingCheck(Map<String, Object> mapList) {
|
|
|
|
|
try {
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_MSEG_MKPF");
|
|
|
|
|
if (func == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
log.info("来料检验-------" + mapList.toString());
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_LLZJ");
|
|
|
|
|
System.out.println(maraTable);
|
|
|
|
|
List<QcCheckTaskIncomeDTO> qcCheckTaskIncomeDTOList=new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
|
|
|
|
maraTable.setRow(i);
|
|
|
|
|
QcCheckTaskIncomeDTO qcCheckTaskIncomeDTO=new QcCheckTaskIncomeDTO();
|
|
|
|
|
qcCheckTaskIncomeDTO.setOrderNo(maraTable.getString("EBELN"));
|
|
|
|
|
qcCheckTaskIncomeDTO.setMaterialCode(maraTable.getString("MATNR"));
|
|
|
|
|
qcCheckTaskIncomeDTO.setMaterialName(maraTable.getString("MAKTX"));
|
|
|
|
|
System.out.println(maraTable);
|
|
|
|
|
qcCheckTaskIncomeDTOList.add(qcCheckTaskIncomeDTO);
|
|
|
|
|
}
|
|
|
|
|
return R.ok();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public R FPinventory(Map<String, Object> mapList) {
|
|
|
|
|
try {
|
|
|
|
|
JCoRepository repository = dest.getRepository();
|
|
|
|
|
JCoFunction func = repository.getFunction("ZMES_ZSDR29");
|
|
|
|
|
if (func == null) {
|
|
|
|
|
throw new RuntimeException("Function does not exist in SAP");
|
|
|
|
|
}
|
|
|
|
|
log.info("成品备货单参数-------" + mapList.toString());
|
|
|
|
|
JCoTable S_TDDAT = func.getTableParameterList().getTable("S_TDDAT");
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
S_TDDAT.appendRow();
|
|
|
|
|
S_TDDAT.setValue(Constants.SIGN, "I");
|
|
|
|
|
S_TDDAT.setValue(Constants.OPTION, "BT");
|
|
|
|
|
S_TDDAT.setValue(Constants.LOW, "20231201");
|
|
|
|
|
S_TDDAT.setValue("HIGH", END_DATE);
|
|
|
|
|
System.out.println(S_TDDAT);
|
|
|
|
|
System.out.println(S_MATNR);
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_CP");
|
|
|
|
|
System.out.println(maraTable);
|
|
|
|
|
// List<QcCheckTaskIncomeDTO> qcCheckTaskIncomeDTOList=new ArrayList<>();
|
|
|
|
|
// for (int i = 0; i < maraTable.getNumRows(); i++) {
|
|
|
|
|
// maraTable.setRow(i);
|
|
|
|
|
// QcCheckTaskIncomeDTO qcCheckTaskIncomeDTO=new QcCheckTaskIncomeDTO();
|
|
|
|
|
// qcCheckTaskIncomeDTO.setOrderNo(maraTable.getString("EBELN"));
|
|
|
|
|
// qcCheckTaskIncomeDTO.setMaterialCode(maraTable.getString("MATNR"));
|
|
|
|
|
// qcCheckTaskIncomeDTO.setMaterialName(maraTable.getString("MAKTX"));
|
|
|
|
|
// System.out.println(maraTable);
|
|
|
|
|
// qcCheckTaskIncomeDTOList.add(qcCheckTaskIncomeDTO);
|
|
|
|
|
// }
|
|
|
|
|
return R.ok();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|