|
|
@ -116,7 +116,7 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
} else { |
|
|
} else { |
|
|
line.put("needCheck", "Y"); |
|
|
line.put("needCheck", "Y"); |
|
|
} |
|
|
} |
|
|
line.put("needHandlingUnit", "Y"); |
|
|
|
|
|
|
|
|
//line.put("needHandlingUnit", "Y"); |
|
|
} |
|
|
} |
|
|
return poLineData; |
|
|
return poLineData; |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@ -158,23 +158,29 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
// 创建采购接收记录 - 在库存更新之前创建 |
|
|
// 创建采购接收记录 - 在库存更新之前创建 |
|
|
createPoReceiptRecords(inData); |
|
|
createPoReceiptRecords(inData); |
|
|
// 免检更新库存 待检验的出入库记录状态为待检验 |
|
|
// 免检更新库存 待检验的出入库记录状态为待检验 |
|
|
//if ("N".equals(inData.getNeedCheck())) { |
|
|
|
|
|
|
|
|
if ("N".equals(inData.getNeedCheck())) { |
|
|
headerService.save(transHeader); |
|
|
headerService.save(transHeader); |
|
|
inData.setTransNo(transHeader.getTransNo()); |
|
|
inData.setTransNo(transHeader.getTransNo()); |
|
|
inData.setDirection("+"); |
|
|
inData.setDirection("+"); |
|
|
detailService.save(inData); |
|
|
detailService.save(inData); |
|
|
genInventoryStock(inData, transHeader); |
|
|
genInventoryStock(inData, transHeader); |
|
|
//} |
|
|
|
|
|
|
|
|
} |
|
|
// 同步到IFS 免检和待检验是同一个吗? |
|
|
// 同步到IFS 免检和待检验是同一个吗? |
|
|
syncToIFS(inData); |
|
|
syncToIFS(inData); |
|
|
// 如果工厂是立体仓库,则需处理托盘和AGV调度逻辑 |
|
|
// 如果工厂是立体仓库,则需处理托盘和AGV调度逻辑 |
|
|
List<Map<String, Object>> sites = accessSiteMapper.getSiteById(inData.getSite()); |
|
|
List<Map<String, Object>> sites = accessSiteMapper.getSiteById(inData.getSite()); |
|
|
if (!sites.isEmpty() && sites.getFirst().get("verticalWarehouseFlag")!=null |
|
|
if (!sites.isEmpty() && sites.getFirst().get("verticalWarehouseFlag")!=null |
|
|
&& "Y".equals(sites.getFirst().get("verticalWarehouseFlag").toString())) { |
|
|
&& "Y".equals(sites.getFirst().get("verticalWarehouseFlag").toString())) { |
|
|
|
|
|
try { |
|
|
handlePalletAndAGVDispatch(inData, transHeader); |
|
|
handlePalletAndAGVDispatch(inData, transHeader); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.warn("托盘和AGV调度失败,但不影响主流程,PO号: {}, 错误: {}", inData.getPoNo(), e.getMessage()); |
|
|
|
|
|
// 托盘和AGV调度失败不回滚主事务,只记录警告日志 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("采购入库失败,PO号: {}, 错误: {}", inData.getPoNo(), e.getMessage()); |
|
|
log.error("采购入库失败,PO号: {}, 错误: {}", inData.getPoNo(), e.getMessage()); |
|
|
|
|
|
log.info("由于异常,PO号: {} 的所有数据库操作将被回滚", inData.getPoNo()); |
|
|
throw new XJException("采购入库失败: " + e.getMessage()); |
|
|
throw new XJException("采购入库失败: " + e.getMessage()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -522,10 +528,15 @@ public class PoServiceImpl extends ServiceImpl<PoMapper, PurchaseOrder> implemen |
|
|
} else { |
|
|
} else { |
|
|
log.error("IFS同步失败,PO号: {}, 响应: {}", inData.getOrderNo(), ifsResponse); |
|
|
log.error("IFS同步失败,PO号: {}, 响应: {}", inData.getOrderNo(), ifsResponse); |
|
|
// 同步失败需要回滚前面所有的数据库操作 |
|
|
// 同步失败需要回滚前面所有的数据库操作 |
|
|
|
|
|
throw new XJException("IFS同步失败,响应: " + ifsResponse); |
|
|
} |
|
|
} |
|
|
|
|
|
} catch (XJException e) { |
|
|
|
|
|
// 重新抛出业务异常,确保事务回滚 |
|
|
|
|
|
throw e; |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("IFS同步异常,PO号: {}, 错误: {}", inData.getOrderNo(), e.getMessage()); |
|
|
log.error("IFS同步异常,PO号: {}, 错误: {}", inData.getOrderNo(), e.getMessage()); |
|
|
// 同步异常需要回滚前面所有的数据库操作 |
|
|
// 同步异常需要回滚前面所有的数据库操作 |
|
|
|
|
|
throw new XJException("IFS同步异常: " + e.getMessage()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|