update - SAP接口

master
yinq 11 months ago
parent 4470afbf33
commit e43a8e3963

@ -13,6 +13,7 @@ import com.aucma.base.service.IBaseDeviceLedgerService;
import com.aucma.base.service.IBaseMaterialInfoService;
import com.aucma.base.service.IBaseOrderInfoService;
import com.aucma.base.service.IOrderBomInfoService;
import com.aucma.base.utils.MaterialConstants;
import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.StringUtils;
import com.aucma.production.domain.CalendarInfo;
@ -112,26 +113,45 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
String dispo = materialInfo.getDISPO();
if (StringUtils.isNotEmpty(dispo)) {
//100=成品;200=箱体;300=门体)
if (dispo.equals("100") || dispo.equals("200") || dispo.equals("300")) {
if (dispo.equals(MaterialConstants.FP_MATERIAL_TYPE)) {
materialInfo.setMaterialSubclass(dispo);
return materialInfo;
}
if (dispo.equals(MaterialConstants.BOX_MATERIAL_TYPE)) {
materialInfo.setMaterialSubclass(dispo);
return materialInfo;
}
if (dispo.equals(MaterialConstants.DOOR_MATERIAL_TYPE) && materialInfo.getMaterialName().contains("门体")) {
materialInfo.setMaterialSubclass(dispo);
return materialInfo;
}
}
//400=围板;500=内胆
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("内胆部件")) {
materialInfo.setMaterialSubclass("500");
//400=围板;500=内胆;600=前板;700=后板
if (materialInfo.getMaterialType().equals(MaterialConstants.SAP_BCP_MATERIAL) && materialInfo.getMaterialName().contains("预装箱体")) {
materialInfo.setMaterialSubclass(MaterialConstants.COAMING_MATERIAL_TYPE);
return materialInfo;
}
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("预装箱体")) {
materialInfo.setMaterialSubclass("400");
if (materialInfo.getMaterialType().equals(MaterialConstants.SAP_BCP_MATERIAL) && materialInfo.getMaterialName().contains("箱壳部件")) {
materialInfo.setMaterialSubclass(MaterialConstants.COAMING_MATERIAL_TYPE);
return materialInfo;
}
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass()) && materialInfo.getMaterialName().contains("箱壳部件")) {
materialInfo.setMaterialSubclass("400");
if (materialInfo.getMaterialType().equals(MaterialConstants.SAP_BCP_MATERIAL) && materialInfo.getMaterialName().contains("内胆部件")) {
materialInfo.setMaterialSubclass(MaterialConstants.LINER_MATERIAL_TYPE);
return materialInfo;
}
if (materialInfo.getMaterialType().equals(MaterialConstants.SAP_BCP_MATERIAL) && materialInfo.getMaterialName().contains("箱体前板")) {
materialInfo.setMaterialSubclass(MaterialConstants.FORMER_MATERIAL_TYPE);
return materialInfo;
}
if (materialInfo.getMaterialType().equals(MaterialConstants.SAP_BCP_MATERIAL) && materialInfo.getMaterialName().contains("箱体后板")) {
materialInfo.setMaterialSubclass(MaterialConstants.AFTER_MATERIAL_TYPE);
return materialInfo;
}
//其他
if (StringUtils.isEmpty(materialInfo.getMaterialSubclass())) {
materialInfo.setMaterialSubclass("900");
materialInfo.setMaterialSubclass(MaterialConstants.OTHER_MATERIAL_TYPE);
}
return materialInfo;
}
/**
@ -275,6 +295,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
bomInfo.setParentId(map.get("MATNR"));
bomInfo.setFactoryCode(map.get("WERKS"));
List<OrderBomInfo> orderBomInfos = orderBomInfoService.selectOrderBomInfoList(bomInfo);
// 添加产品BOM
if (orderBomInfos.isEmpty()) {
OrderBomInfo orderBomInfo = new OrderBomInfo();
orderBomInfo.setFactoryCode(map.get("WERKS"));
@ -292,9 +313,23 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
e.printStackTrace();
}
orderBomInfoList.add(orderBomInfo);
}else {
//修改产品BOM
OrderBomInfo bom = orderBomInfos.get(0);
if (!map.get("MENGE").isEmpty()) {
bom.setStandardAmount(new BigDecimal(map.get("MENGE")));
}
bom.setSort(map.get("SORTF"));
bom.setVbeln(map.get("VBELN"));
bom.setVbpos(map.get("VBPOS"));
try {
orderBomInfoService.updateOrderBomInfo(bom);
} catch (Exception e) {
e.printStackTrace();
}
orderBomInfoList.add(bom);
}
}
return orderBomInfoList;
}

@ -185,7 +185,7 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService {
BaseBomInfo bomInfo = new BaseBomInfo();
bomInfo.setMaterialCode(baseMaterialInfo.getMaterialCode());
List<BaseBomInfo> baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(bomInfo);
if (StringUtils.isNull(baseBomInfos)){
if (baseBomInfos.size() == 0){
BaseBomInfo info = new BaseBomInfo();
info.setBomCode(baseMaterialInfo.getMaterialCode());
info.setMaterialCode(baseMaterialInfo.getMaterialCode());

Loading…
Cancel
Save