|
|
@@ -57,30 +57,46 @@ public class ivtOrderProcessAfterComplete extends ExecuteListener {
|
|
|
BO cost = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_COST", orderProduct.getString("CONTRACT_COST_ID"));
|
|
|
|
|
|
cost.set("STATUS_ID", "1235");//更新状态 采购中
|
|
|
-
|
|
|
SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_COST", cost);
|
|
|
|
|
|
//排除重复提交
|
|
|
+ /*
|
|
|
String sql = "SELECT ID FROM BO_EU_DNCTT_CONTRACT_COST_PRODUCT WHERE ORDER_ID=? AND CONTRACT_COST_ID=?";
|
|
|
String id = DBSql.getString(sql, new Object[]{purchaseOrder.getId(), cost.getId()});
|
|
|
SDK.getBOAPI().remove("BO_EU_DNCTT_CONTRACT_COST_PRODUCT", id);//删除旧数据
|
|
|
-
|
|
|
- ProcessInstance processInstance = SDK.getProcessAPI().createBOProcessInstance("obj_6bc913271069455abbd516c556b26d31", processExecutionContext.getUserContext().getUID(), "合同产品物流管理");
|
|
|
-
|
|
|
- //提交采购订单添加成本产品
|
|
|
- BO costProduct = new BO();
|
|
|
- costProduct.setBindId(processInstance.getId());
|
|
|
- costProduct.set("ORDER_ID", purchaseOrder.getId());
|
|
|
- costProduct.set("CONTRACT_COST_ID", cost.getString("ID"));
|
|
|
- costProduct.set("STATUS_ID", "2156");//采购中
|
|
|
- costProduct.set("QUANTITY", orderProduct.get("QUANTITY"));
|
|
|
- costProduct.set("WAREHOUSE_ID", orderProduct.get("WAREHOUSE_ID"));
|
|
|
- costProduct.set("SN", DBSql.getString("SELECT GROUP_CONCAT(SN) FROM BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT WHERE ORDER_PRODUCT_ID=?", new Object[]{costProduct.getId()}));
|
|
|
- costProduct.set("OLD_QUANTITY", costProduct.get("QUANTITY"));//配送数量
|
|
|
-
|
|
|
- costProduct.set("SHIPPING_TYPE_ID", null);
|
|
|
- dn.recordFormChanges.record(uc, costProduct, "采购产品审批后新增");
|
|
|
- SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_COST_PRODUCT", costProduct, processInstance, uc);
|
|
|
+ */
|
|
|
+
|
|
|
+ String costProductID = DBSql.getString("SELECT ID FROM BO_EU_DNCTT_CONTRACT_COST_PRODUCT WHERE ORDER_ID=? AND CONTRACT_COST_ID=?", new Object[]{purchaseOrder.getId(), cost.getId()});
|
|
|
+ if (StringUtils.isBlank(costProductID)) {
|
|
|
+ ProcessInstance processInstance = SDK.getProcessAPI().createBOProcessInstance("obj_6bc913271069455abbd516c556b26d31", processExecutionContext.getUserContext().getUID(), "合同产品物流管理");
|
|
|
+
|
|
|
+ //提交采购订单添加成本产品
|
|
|
+ BO costProduct = new BO();
|
|
|
+ costProduct.setBindId(processInstance.getId());
|
|
|
+ costProduct.set("ORDER_ID", purchaseOrder.getId());
|
|
|
+ costProduct.set("CONTRACT_COST_ID", cost.getString("ID"));
|
|
|
+ costProduct.set("STATUS_ID", "2156");//采购中
|
|
|
+ costProduct.set("QUANTITY", orderProduct.get("QUANTITY"));
|
|
|
+ costProduct.set("WAREHOUSE_ID", orderProduct.get("WAREHOUSE_ID"));
|
|
|
+ costProduct.set("SN", DBSql.getString("SELECT GROUP_CONCAT(SN) FROM BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT WHERE ORDER_PRODUCT_ID=?", new Object[]{orderProduct.getId()}));
|
|
|
+ costProduct.set("OLD_QUANTITY", costProduct.get("QUANTITY"));//配送数量
|
|
|
+
|
|
|
+ costProduct.set("SHIPPING_TYPE_ID", null);
|
|
|
+ dn.recordFormChanges.record(uc, costProduct, "采购产品审批后新增");
|
|
|
+ SDK.getBOAPI().create("BO_EU_DNCTT_CONTRACT_COST_PRODUCT", costProduct, processInstance, uc);
|
|
|
+ } else {
|
|
|
+ BO costProduct = SDK.getBOAPI().get("BO_EU_DNCTT_CONTRACT_COST_PRODUCT", costProductID);
|
|
|
+ costProduct.set("ORDER_ID", purchaseOrder.getId());
|
|
|
+ costProduct.set("CONTRACT_COST_ID", cost.getString("ID"));
|
|
|
+ costProduct.set("STATUS_ID", "2156");//采购中
|
|
|
+ costProduct.set("QUANTITY", orderProduct.get("QUANTITY"));
|
|
|
+ costProduct.set("WAREHOUSE_ID", orderProduct.get("WAREHOUSE_ID"));
|
|
|
+ costProduct.set("SN", DBSql.getString("SELECT GROUP_CONCAT(SN) FROM BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT WHERE ORDER_PRODUCT_ID=?", new Object[]{orderProduct.getId()}));
|
|
|
+ costProduct.set("OLD_QUANTITY", costProduct.get("QUANTITY"));//配送数量
|
|
|
+ costProduct.set("SHIPPING_TYPE_ID", null);
|
|
|
+ dn.recordFormChanges.record(uc, costProduct, "采购产品审批后新增");
|
|
|
+ SDK.getBOAPI().update("BO_EU_DNCTT_CONTRACT_COST_PRODUCT", costProduct);
|
|
|
+ }
|
|
|
|
|
|
//已完成拣货或者在采购中
|
|
|
|