change - SAP订单同步更新

master
yinq 8 months ago
parent 2da89fdb62
commit b3f8727e9c

@ -8,8 +8,11 @@ import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.production.domain.CalendarInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -103,5 +106,15 @@ public class SAPPortController extends BaseController {
return AjaxResult.success(BaeeBomVoList);
}
/**
*
* @param calendarInfo
* @return
*/
@Log(title = "生产工单" , businessType = BusinessType.INSERT)
@PostMapping("/addSAPCalendar")
public AjaxResult addSAPCalendar(@RequestBody CalendarInfo calendarInfo) {
return toAjax(sapPortService.addSAPCalendar(calendarInfo));
}
}

@ -7,6 +7,7 @@ import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.production.domain.BaseBomInfo;
import com.aucma.production.domain.CalendarInfo;
import org.springframework.stereotype.Service;
import java.util.List;
@ -47,4 +48,11 @@ public interface ISAPPortService {
*/
List<OrderBomInfo> getSapOrderBomInfo(SAPBOMPortDto sapPortDto);
/**
* SAP
*
* @param calendarInfo
* @return
*/
public int addSAPCalendar(CalendarInfo calendarInfo);
}

@ -16,7 +16,9 @@ import com.aucma.base.domain.BaseMaterialInfo;
import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.domain.OrderBomInfo;
import com.aucma.common.exception.base.BaseException;
import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.StringUtils;
import com.aucma.production.domain.CalendarInfo;
import com.aucma.system.utils.PortLogUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -24,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
@ -212,5 +215,28 @@ public class SAPPortServiceImpl implements ISAPPortService {
return orderBomInfosVos;
}
/**
* SAP
* @param calendarInfo
* @return
*/
@Override
public int addSAPCalendar(CalendarInfo calendarInfo) {
if (StringUtils.isNull(calendarInfo.getPlanStartDate())
|| StringUtils.isNull(calendarInfo.getPlanEndDate())){
return 0;
}
SAPPortDto sapPortDto = new SAPPortDto();
WERKSDto werksDto = new WERKSDto();
List<HashMap<String, String>> factoryList = new ArrayList<>();
HashMap<String, String> hashMap = new HashMap<>();
sapPortDto.setStartDate(DateUtils.dateTime(calendarInfo.getPlanStartDate()));
sapPortDto.setEndDate(DateUtils.dateTime(calendarInfo.getPlanEndDate()));
hashMap.put("WERKS", "1301");
factoryList.add(hashMap);
werksDto.setItem(factoryList);
sapPortDto.setFactoryCodes(werksDto);
this.getSapBaseOrderInfo(sapPortDto);
return 1;
}
}

@ -17,7 +17,9 @@ import com.aucma.base.utils.MaterialConstants;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -52,6 +54,9 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
@Autowired
private ICalendarInfoService calendarInfoService;
@Autowired
private IProductPlanInfoService productPlanInfoService;
/**
*
*
@ -202,15 +207,29 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
baseOrderInfoList.add(baseOrderInfo);
} else {
//更新SAP计划
BaseOrderInfo baseOrderInfo = baseOrderInfos.get(0);
baseOrderInfo.setOrderStatus(map.get("STTXT"));
BaseOrderInfo baseOrderInfoOld = baseOrderInfos.get(0);
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
baseOrderInfo.setObjId(baseOrderInfoOld.getObjId());
baseOrderInfo.setMaterialCode(baseOrderInfoOld.getMaterialCode());
baseOrderInfo.setOrderCode(baseOrderInfoOld.getOrderCode());
baseOrderInfo.setSaleOrderCode(map.get("KDAUF"));
baseOrderInfo.setMaterialName(map.get("MAKTX"));
baseOrderInfo.setOrderStatus(map.get("STTXT"));
baseOrderInfo.setOrderType(map.get("AUART"));
if (baseOrderInfo.getIsRelease() == 1) {
//SAP计划已下达到生产计划工位不更新数量
if (!map.get("GAMNG").equals(null)) {
baseOrderInfo.setOrderAmount(new BigDecimal(map.get("GAMNG")));
BigDecimal newOrderAmount = new BigDecimal(map.get("GAMNG"));
if (!newOrderAmount.equals(baseOrderInfo.getOrderAmount())){
baseOrderInfo.setOrderAmount(new BigDecimal(map.get("GAMNG")));
baseOrderInfo.setUpdatedBy("SAP");
//同步生产计划数量
ProductPlanInfo planInfo = new ProductPlanInfo();
planInfo.setOrderCode(baseOrderInfo.getOrderCode());
List<ProductPlanInfo> productPlanInfos = productPlanInfoService.selectProductPlanInfoList(planInfo);
for (ProductPlanInfo info : productPlanInfos) {
ProductPlanInfo planInfoIn = new ProductPlanInfo();
planInfoIn.setObjId(info.getObjId());
planInfoIn.setUpdatedBy("SAP");
planInfoIn.setPlanAmount(baseOrderInfo.getOrderAmount().longValue());
productPlanInfoService.updateProductPlanInfo(planInfoIn);
}
}
//产线变动 重新生成生成计划

@ -86,8 +86,12 @@
<if test="completeDate != null ">and oi.complete_date = #{completeDate}</if>
<if test="isRelease != null ">and oi.is_release = #{isRelease}</if>
<if test="workCenterCode != null ">and oi.work_center_code = #{workCenterCode}</if>
<if test="params.beginEndTime != null and params.beginEndTime != '' and params.endEndTime != null and params.endEndTime != ''">
and oi.begin_date between to_date(#{params.beginEndTime}, 'yyyy-mm-dd') and
to_date(#{params.endEndTime}, 'yyyy-mm-dd')
</if>
</where>
order by order_code desc
order by oi.material_name, order_code desc
</select>
<select id="selectBaseOrderInfoByObjId" parameterType="Long" resultMap="BaseOrderInfoResult">

@ -102,14 +102,4 @@ public class CalendarInfoController extends BaseController {
}
/**
*
* @param calendarInfo
* @return
*/
@Log(title = "生产日历" , businessType = BusinessType.INSERT)
@PostMapping("/addSAPCalendar")
public AjaxResult addSAPCalendar(@RequestBody CalendarInfo calendarInfo) {
return toAjax(calendarInfoService.addSAPCalendar(calendarInfo));
}
}

@ -59,11 +59,5 @@ public interface ICalendarInfoService
*/
public int deleteCalendarInfoByObjId(Long objId);
/**
* SAP
*
* @param calendarInfo
* @return
*/
public int addSAPCalendar(CalendarInfo calendarInfo);
}

@ -95,16 +95,6 @@ public class CalendarInfoServiceImpl implements ICalendarInfoService
return calendarInfoMapper.deleteCalendarInfoByObjId(objId);
}
/**
* SAP
* @param calendarInfo
* @return
*/
@Override
public int addSAPCalendar(CalendarInfo calendarInfo) {
return 1;
}
}

@ -12,7 +12,7 @@
boi.MATERIAL_NAME,
boi.ORDER_AMOUNT,
NVL(boi.COMPLETE_AMOUNT, 0) COMPLETE_AMOUNT,
ROUND(NVL(boi.COMPLETE_AMOUNT, 0) / boi.ORDER_AMOUNT, 2) * 100 || '%' ORDER_RATE,
ROUND(NVL(boi.COMPLETE_AMOUNT, 0) / boi.ORDER_AMOUNT * 100, 2) || '%' ORDER_RATE,
PL.WORK_CENTER_CODE,
PL.PRODUCT_LINE_NAME
FROM BASE_ORDERINFO boi
@ -124,7 +124,7 @@
STATION_NAME,
COUNT(*) INSPECTION_NUMBER,
SUM(REWORK_NUMBER) REWORK_NUMBER,
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 0) || '%' RATE
ROUND((1 - SUM(REWORK_NUMBER) / COUNT(*)) * 100, 2) || '%' RATE
FROM (
SELECT FY.FACTORY_NAME,
BPP.PRODUCT_LINE_NAME,
@ -334,7 +334,7 @@
</select>
<select id="productTraceabilityDetailList" resultType="java.util.HashMap">
SELECT PO.BOX_CODE,
SELECT RQI.BAR_CODE,
PL.EXECUTION_SORT,
PL.PRODUCT_LINE_CODE,
PL.PRODUCT_LINE_NAME,
@ -343,13 +343,13 @@
RQI.INSPECTOR_TIME,
U.NICK_NAME USER_NAME
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE PO
JOIN REPORT_QUALITY_INSPECTION RQI ON RQI.BAR_CODE = PO.BOX_CODE
LEFT JOIN (SELECT BOX_CODE, LINER_CODE
FROM C##AUCMA_SCADA.CODE_BINDING
WHERE LINER_CODE IS NOT NULL) CB ON RQI.BAR_CODE = CB.LINER_CODE
LEFT JOIN C##AUCMA_SCADA.CODE_BINDING CB ON PO.BOX_CODE = CB.BOX_CODE
JOIN REPORT_QUALITY_INSPECTION RQI ON ((RQI.BAR_CODE = PO.BOX_CODE) OR (RQI.BAR_CODE = CB.LINER_CODE))
LEFT JOIN BASE_PRODUCTLINE PL on RQI.STATION_CODE = PL.PRODUCT_LINE_CODE
LEFT JOIN SYS_USER U on U.USER_NAME = RQI.INSPECTOR_CODE
WHERE PO.BOX_CODE = #{BOX_CODE}
GROUP BY RQI.BAR_CODE, PL.EXECUTION_SORT, PL.PRODUCT_LINE_CODE, PL.PRODUCT_LINE_NAME, RQI.TREATMENT_MEASURE,
RQI.PROCESS_RESULT, RQI.INSPECTOR_TIME, U.NICK_NAME
ORDER BY PL.EXECUTION_SORT, RQI.INSPECTOR_TIME
</select>

@ -35,7 +35,7 @@
po.product_factory_code,
BF.FACTORY_NAME,
po.product_sncode,
po.product_order_no,
substr(po.product_order_no,5) product_order_no,
po.product_sale_no,
po.product_sale_line_no,
po.product_code,

Loading…
Cancel
Save