|
|
|
@ -14,12 +14,14 @@ 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.exception.ServiceException;
|
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
|
import com.aucma.common.utils.StringUtils;
|
|
|
|
|
import com.aucma.production.domain.CalendarInfo;
|
|
|
|
|
import com.aucma.production.domain.ProductPlanInfo;
|
|
|
|
|
import com.aucma.production.service.ICalendarInfoService;
|
|
|
|
|
import com.aucma.production.service.IProductPlanInfoService;
|
|
|
|
|
import com.aucma.system.utils.PortLogUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -209,6 +211,9 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
} else {
|
|
|
|
|
//更新SAP计划
|
|
|
|
|
BaseOrderInfo baseOrderInfoOld = baseOrderInfos.get(0);
|
|
|
|
|
if (baseOrderInfoOld.getManualUpdateFlag().equals("1")){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
|
|
|
|
|
baseOrderInfo.setObjId(baseOrderInfoOld.getObjId());
|
|
|
|
|
baseOrderInfo.setMaterialCode(baseOrderInfoOld.getMaterialCode());
|
|
|
|
@ -357,4 +362,65 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
|
|
|
|
|
return orderBomInfoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手动更换订单产线
|
|
|
|
|
* @param baseOrderInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int replaceProductionLine(BaseOrderInfo baseOrderInfo) {
|
|
|
|
|
BaseOrderInfo orderInfo = baseOrderInfoService.selectBaseOrderInfoByObjId(baseOrderInfo.getObjId());
|
|
|
|
|
// 订单数量==切换数量 => 修改工作中心
|
|
|
|
|
if (baseOrderInfo.getReplaceAmount() == baseOrderInfo.getOrderAmount().longValue()){
|
|
|
|
|
orderInfo.setManualUpdateFlag("1");
|
|
|
|
|
orderInfo.setWorkCenterCode(baseOrderInfo.getWorkCenterCode());
|
|
|
|
|
int i = baseOrderInfoService.updateBaseOrderInfo(orderInfo);
|
|
|
|
|
if (i > 0){
|
|
|
|
|
ProductPlanInfo productPlanInfo = new ProductPlanInfo();
|
|
|
|
|
productPlanInfo.setOrderCode(orderInfo.getOrderCode());
|
|
|
|
|
//删除旧计划
|
|
|
|
|
List<ProductPlanInfo> productPlanInfoList = productPlanInfoService.selectProductPlanInfoList(productPlanInfo);
|
|
|
|
|
for (ProductPlanInfo planInfo : productPlanInfoList) {
|
|
|
|
|
productPlanInfoService.deleteProductPlanInfoByObjId(planInfo.getObjId());
|
|
|
|
|
}
|
|
|
|
|
productPlanInfoService.releaseOrderPlan(orderInfo);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
// 订单数量 < 切换数量 => 添加一条并且修改工作中心
|
|
|
|
|
try {
|
|
|
|
|
//更新历史SAP订单订单数量
|
|
|
|
|
BaseOrderInfo info = new BaseOrderInfo();
|
|
|
|
|
info.setObjId(orderInfo.getObjId());
|
|
|
|
|
info.setOrderAmount(new BigDecimal(baseOrderInfo.getOrderAmount().longValue() - baseOrderInfo.getReplaceAmount()));
|
|
|
|
|
info.setManualUpdateFlag("1");
|
|
|
|
|
baseOrderInfoService.updateBaseOrderInfo(info);
|
|
|
|
|
//更新历史生产计划订单数量
|
|
|
|
|
ProductPlanInfo productPlanInfo = new ProductPlanInfo();
|
|
|
|
|
productPlanInfo.setOrderCode(orderInfo.getOrderCode());
|
|
|
|
|
List<ProductPlanInfo> productPlanInfoList = productPlanInfoService.selectProductPlanInfoList(productPlanInfo);
|
|
|
|
|
for (ProductPlanInfo planInfo : productPlanInfoList) {
|
|
|
|
|
ProductPlanInfo plan = new ProductPlanInfo();
|
|
|
|
|
plan.setObjId(planInfo.getObjId());
|
|
|
|
|
planInfo.setPlanAmount(baseOrderInfo.getOrderAmount().longValue() - baseOrderInfo.getReplaceAmount());
|
|
|
|
|
productPlanInfoService.updateProductPlanInfo(plan);
|
|
|
|
|
}
|
|
|
|
|
//插入新SAP订单 更换后工作中心
|
|
|
|
|
BaseOrderInfo orderOldInfo = baseOrderInfoService.selectBaseOrderInfoByObjId(orderInfo.getObjId());
|
|
|
|
|
orderOldInfo.setObjId(null);
|
|
|
|
|
orderOldInfo.setCompleteAmount(0L);
|
|
|
|
|
orderOldInfo.setOrderAmount(new BigDecimal(baseOrderInfo.getReplaceAmount()));
|
|
|
|
|
orderOldInfo.setWorkCenterCode(baseOrderInfo.getWorkCenterCode());
|
|
|
|
|
orderOldInfo.setCompleteDate(null);
|
|
|
|
|
baseOrderInfoService.insertBaseOrderInfo(orderOldInfo);
|
|
|
|
|
//新订单下计划
|
|
|
|
|
productPlanInfoService.releaseOrderPlan(orderOldInfo);
|
|
|
|
|
PortLogUtils.savePortLog("1301", "手动更换订单产线" + baseOrderInfo.getOrderCode(),
|
|
|
|
|
"replaceProductionLine", baseOrderInfo.toString(), null, null);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
PortLogUtils.savePortLog("1301", "手动更换订单产线" + baseOrderInfo.getOrderCode(),
|
|
|
|
|
"replaceProductionLine", baseOrderInfo.toString(), null, e.toString());
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|