refactor(int-core): 优化 HTTP 请求处理并更新出库接口逻辑
- 在 FQMiniProgramsHandler 中添加响应体读取,提高错误处理能力 - 修改 OutMaterialSapServiceImpl 中的批次号处理逻辑,固定为 "NO"- 增加库存标记、销售订单号和销售订单行号等字段的处理 - 更新库存状态和生产日期等信息的设置
This commit is contained in:
parent
e341032406
commit
7b8b3e5626
@ -2,6 +2,8 @@ package com.foreverwin.iep.integration.handler.def.fqMiniPrograms;
|
||||
|
||||
import com.foreverwin.iep.integration.dto.FQMiniRequestDto;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@ -46,10 +48,19 @@ public class FQMiniProgramsHandler {
|
||||
|
||||
// 获取响应码
|
||||
int responseCode = connection.getResponseCode();
|
||||
// 读取响应体
|
||||
StringBuilder response = new StringBuilder();
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
String responseLine;
|
||||
while ((responseLine = br.readLine()) != null) {
|
||||
response.append(responseLine.trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
return "Request successful";
|
||||
return "Request successful. Response: " + response.toString();
|
||||
} else {
|
||||
return "Request failed with response code: " + responseCode;
|
||||
return "Request failed with response code: " + responseCode + ". Response: " + response.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -80,7 +80,7 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
jsonObject.put("MATKL", ""); // 物料组
|
||||
jsonObject.put("WERKS", site); // 工厂
|
||||
jsonObject.put("LGORT", completeTransaction.getErpInventory()); // 存储地点
|
||||
jsonObject.put("CHARG", completeTransaction.getSapBatchNo()); // 批次号
|
||||
jsonObject.put("CHARG", "NO"); // 批次号
|
||||
jsonObject.put("BWART", completeTransaction.getProductType()); // 移动类型
|
||||
jsonObject.put("SOBKZ", ""); // 特殊库存标识
|
||||
jsonObject.put("AUFNR", shopOrder); // 订单号
|
||||
@ -411,12 +411,14 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
String barcode = outMaterialCompleteLog.getLotNo();
|
||||
String status = outMaterialCompleteLog.getStatus();
|
||||
String erpItem = outMaterialCompleteLog.getErpItem();
|
||||
String sapBatchNo = outMaterialCompleteLog.getSapBatchNo();
|
||||
BigDecimal qtyDone = outMaterialCompleteLog.getMainQty();
|
||||
String grade = outMaterialCompleteLog.getQcGrade();
|
||||
String uom = outMaterialCompleteLog.getRollType();
|
||||
String subUom = outMaterialCompleteLog.getSubUom();
|
||||
BigDecimal subQty = outMaterialCompleteLog.getSubQty();
|
||||
String inventoryMark = outMaterialCompleteLog.getInventoryMark();
|
||||
String soNo = outMaterialCompleteLog.getSoNo();
|
||||
String soLineNo = outMaterialCompleteLog.getSoLineNo();
|
||||
|
||||
String inventoryBo = Inventory.genHandle(site, barcode);
|
||||
Inventory data = remoteWmsInventoryService.getInventoryDto(inventoryBo).getData();
|
||||
@ -436,10 +438,19 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
inventory.setStatus(status);
|
||||
inventory.setInventoryId(barcode);
|
||||
inventory.setItem(erpItem);
|
||||
inventory.setBatchNo(sapBatchNo);
|
||||
inventory.setBatchNo("NO");
|
||||
inventory.setOriginalQty(qtyDone);
|
||||
inventory.setQtyOnHand(qtyDone);
|
||||
inventory.setProductionDate(pdt);
|
||||
if (!StringUtils.isEmpty(inventoryMark)) {
|
||||
inventory.setInventorySpecialMarking(inventoryMark);
|
||||
}
|
||||
if(!StringUtils.isEmpty(soNo)){
|
||||
inventory.setDnOrder(soNo);
|
||||
}
|
||||
if(!StringUtils.isEmpty(soLineNo)){
|
||||
inventory.setDnOrderSeq(soLineNo);
|
||||
}
|
||||
inventory.setStatus("1001");
|
||||
//根据存储位置获取货格
|
||||
List<OutFqDTO> outFqDTOS = operationOutMapper.selectOutFq(site, erpInventory);
|
||||
@ -481,12 +492,22 @@ public class OutMaterialSapServiceImpl implements OutMaterialSapService {
|
||||
zLotMaterialCompleteTransaction.setItemDesc(outMaterialCompleteLog.getItemDesc());
|
||||
zLotMaterialCompleteTransaction.setMainQty(outMaterialCompleteLog.getMainQty());
|
||||
zLotMaterialCompleteTransaction.setMainUom(outMaterialCompleteLog.getMainUom());
|
||||
if (outMaterialCompleteLog.getInventoryMark() != null) {
|
||||
zLotMaterialCompleteTransaction.setInventoryMark(outMaterialCompleteLog.getInventoryMark());
|
||||
}
|
||||
if (outMaterialCompleteLog.getSubQty() != null) {
|
||||
zLotMaterialCompleteTransaction.setSubQty(outMaterialCompleteLog.getSubQty());
|
||||
}
|
||||
if (outMaterialCompleteLog.getSubUom() != null) {
|
||||
zLotMaterialCompleteTransaction.setSubUom(outMaterialCompleteLog.getSubUom());
|
||||
}
|
||||
if (outMaterialCompleteLog.getSoNo() != null){
|
||||
zLotMaterialCompleteTransaction.setSoNo(outMaterialCompleteLog.getSoNo());
|
||||
}
|
||||
if (outMaterialCompleteLog.getSoLineNo() != null){
|
||||
zLotMaterialCompleteTransaction.setSoLineNo(outMaterialCompleteLog.getSoLineNo());
|
||||
}
|
||||
zLotMaterialCompleteTransaction.setSapBatchNo("NO");
|
||||
zLotMaterialCompleteTransaction.setQcGrade(outMaterialCompleteLog.getQcGrade());
|
||||
zLotMaterialCompleteTransaction.setSyncPostingDate(outMaterialCompleteLog.getSyncPostingDate());
|
||||
zLotMaterialCompleteTransaction.setSyncStatus("S");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user