备料重算后更新请购单

This commit is contained in:
lihao 2025-12-19 14:12:45 +08:00
parent 428a272e5e
commit ca3ab63f5b
1 changed files with 17 additions and 22 deletions

View File

@ -81,35 +81,30 @@ public class AfterPickmRecalUpdateBuyingreqRule implements IRule<PMOAggVO> {
pmoids.add(map2.get("pk_praybill").toString());
}
if (new UFDouble((BigDecimal) map2.get("nnum")).compareTo(new UFDouble((BigDecimal) map.get("nplanoutnum"))) > 0) {
// 更新请购单
String sql = "update po_praybill_b set vbdef33='" + map.get("nplanoutnum") + "' where pk_praybill_b='"
+ map2.get("pk_praybill_b") + "'";
int num = dao.executeUpdate(sql);
if (num > 0 && "C030".equals(orgCode)) {
SyncSrmPrayBillUtil billUtil = new SyncSrmPrayBillUtil();
JSONObject reqData = new JSONObject();
reqData.put("org", "C030");// 组织编码
reqData.put("erpId", map2.get("pk_praybill_b"));// 请购单表体主键
reqData.put("mainNum", map.get("nplanoutnum"));// 主数量
billUtil.reqBIPBill(reqData);
}
// 꿴璂꽃뭔땐데
String ordersql = "select pk_order_b from po_order_b where csourcebid ='" + map2.get("pk_praybill_b") + "' and dr = 0";
List<Map<String, Object>> orders = (List<Map<String, Object>>) dao.executeQuery(ordersql, new MapListProcessor());
for (Map<String, Object> order : orders) {
// 更新采购订单
String updateOrderSql = "update po_order_b set vbdef33='" + map.get("nplanoutnum") + "' where pk_order_b='"
+ order.get("pk_order_b") + "'";
dao.executeUpdate(updateOrderSql);
// 꿴璂돕새데
String arriveordersql = "select pk_arriveorder_b from po_arriveorder_b where csourcebid ='" + order.get("pk_order_b") + "' and dr = 0";
List<Map<String, Object>> arriveorders = (List<Map<String, Object>>) dao.executeQuery(arriveordersql, new MapListProcessor());
for (Map<String, Object> arriveorder : arriveorders) {
// 更新到货单
String updatearriveorderSql = "update po_arriveorder_b set vbdef33='" + map.get("nplanoutnum") + "' where pk_arriveorder_b='"
+ arriveorder.get("pk_arriveorder_b") + "'";
dao.executeUpdate(updatearriveorderSql);
// 已经采购入库的数据不处理
// 20251216 备料重算优化 如果有到货单则不更新最终需求数量
int innum=arriveorders.size();
if ("C030".equals(orgCode) && innum ==0) {
// 更新请购单
String sql = "update po_praybill_b set vbdef33='" + map.get("nplanoutnum") + "' where pk_praybill_b='"
+ map2.get("pk_praybill_b") + "'";
int num = dao.executeUpdate(sql);
// 更新采购订单
String updateOrderSql = "update po_order_b set vbdef33='" + map.get("nplanoutnum") + "' where pk_order_b='"
+ order.get("pk_order_b") + "'";
dao.executeUpdate(updateOrderSql);
SyncSrmPrayBillUtil billUtil = new SyncSrmPrayBillUtil();
JSONObject reqData = new JSONObject();
reqData.put("org", "C030");// 组织编码
reqData.put("erpId", map2.get("pk_praybill_b"));// 请购单表体主键
reqData.put("mainNum", map.get("nplanoutnum"));// 主数量
billUtil.reqBIPBill(reqData);
}
}
}