zhangyao před 4 měsíci
rodič
revize
5afbc8f1e2

+ 7 - 4
com.awspaas.user.apps.donenow_ctt/src/com/awspaas/user/apps/donenow_ctt/controller/contractCostController.java

@@ -49,9 +49,11 @@ public class contractCostController {
         int warehouseProductAvailableQuantity = ObjToInt(DBSql.getString("SELECT SUM(AVAILABLE) FROM VIEW_EU_DNINVT_PRODUCT_INVENTORY where ID=?", new Object[]{warehouseProductId}));
         logger.info("可用库存数量:" + warehouseProductAvailableQuantity);
 
-        if (warehouseProductAvailableQuantity <= 0) return ResponseObject.newErrResponse("库存数量不足");
+        if (warehouseProductAvailableQuantity <= 0)
+            return ResponseObject.newErrResponse("库存数量不足");
 
-        if (warehouseProductQuantity <= 0) return ResponseObject.newErrResponse("库存数量不足");
+        if (warehouseProductQuantity <= 0)
+            return ResponseObject.newErrResponse("库存数量不足");
 
         if (warehouseProductAvailableQuantity <= warehouseProductQuantity)//可用库存数量
             warehouseProductQuantity = warehouseProductAvailableQuantity;
@@ -69,7 +71,8 @@ public class contractCostController {
         newBO.setBindId(processInstance.getId());
         int quantity = contractCostQuantity - contractProductPickQuantity;//待拣货数量
 
-        if (quantity <= 0) return ResponseObject.newErrResponse("无需拣货");
+        if (quantity <= 0) return
+                ResponseObject.newErrResponse("无需拣货");
 
         if (quantity > warehouseProductQuantity) {
             newBO.set("PICK_QUANTITY", warehouseProductQuantity);
@@ -200,7 +203,7 @@ public class contractCostController {
 
         String OUT_RULE = DBSql.getString("SELECT OUT_RULE FROM BO_EU_DNIVT_PRODUCT WHERE ID=?", new Object[]{stockMap.getString("PRODUCT_ID")});
         //1031 FIFO先进先出  1032 LIFO后进先出
-        List<RowMap> lotList = DBSql.getMaps("SELECT b.* FROM bo_eu_dnivt_warehouse_product a JOIN BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT b ON a.BINDID=b.BINDID WHERE b.QUANTITY>0 AND a.ID=? ORDER BY b.CREATEDATE " + (OUT_RULE.equals("1032") ? "DESC" : "ASC"), new Object[]{warehouseProductId});
+        List<RowMap> lotList = DBSql.getMaps("SELECT b.* FROM bo_eu_dnivt_warehouse_product a JOIN BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT b ON a.BINDID=b.BINDID WHERE b.QUANTITY>0 AND a.ID=? ORDER BY b.CREATEDATE " + (OUT_RULE!=null&&OUT_RULE.equals("1032") ? "DESC" : "ASC"), new Object[]{warehouseProductId});
 
         //已被拣货数量
         List<RowMap> pickList = DBSql.getMaps("SELECT a.* from BO_EU_DNCTT_CONTRACT_COST_PRODUCT a JOIN BO_EU_DNCTT_CONTRACT_COST b ON a.CONTRACT_COST_ID=b.ID WHERE a.WAREHOUSE_ID=? AND b.PRODUCT_ID=?", new Object[]{stockMap.getString("WAREHOUSE_ID"), stockMap.getString("PRODUCT_ID")});

+ 25 - 5
com.awspaas.user.apps.donenow_ctt/src/com/awspaas/user/apps/donenow_ctt/controller/contractCreateController.java

@@ -231,13 +231,33 @@ public class contractCreateController {
     public ResponseObject deleteContractService(UserContext uc, String serviceIds) {
         String[] costIdArr = serviceIds.split(",");
 
-
-        String delSql = "DELETE FROM BO_EU_DNCTT_CONTRACT_SERVICE WHERE ID IN(";
+        String selSql = "DELETE FROM BO_EU_DNCTT_CONTRACT_SERVICE WHERE ID IN(";
         for (int i = 0; costIdArr.length > i; i++) {
-            delSql += "?,";
+            selSql += "?,";
         }
-        delSql = delSql.substring(0, delSql.length() - 1) + ")";
-        DBSql.update(delSql, Arrays.stream(costIdArr).toArray());
+        selSql = selSql.substring(0, selSql.length() - 1) + ")";
+        List<RowMap> serviceList = DBSql.getMaps(selSql, Arrays.stream(costIdArr).toArray());
+        for (RowMap service : serviceList) {
+            //删除关联的服务调整
+            List<String> csaIdList = DBSql.getList("select ID from BO_EU_DNCTT_CONTRACT_SERVICE_ADJUST where CONTRACT_ID=? and CONTRACT_SERVICE_ID=?", String.class, new Object[]{service.get("CONTRACT_ID"), service.get("ID")});
+
+            for (String csaId : csaIdList) {
+                DBSql.update("delete from BO_EU_DNCTT_CONTRACT_SERVICE_ADJUST_BUNDLE_SERVICE where CONTRACT_SERVICE_ADJUST_ID=? ", new Object[]{csaId});
+            }
+
+            DBSql.update("delete from BO_EU_DNCTT_CONTRACT_SERVICE_ADJUST where  CONTRACT_ID=? and CONTRACT_SERVICE_ID=?", new Object[]{service.get("CONTRACT_ID"), service.get("ID")});
+
+            //删除关联的服务周期
+            List<String> cspIdList = DBSql.getList("select ID from BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD where  CONTRACT_ID=? and OBJECT_ID=? and CONTRACT_SERVICE_ID=?", String.class, new Object[]{service.get("CONTRACT_ID"), service.get("OBJECT_ID"), service.get("ID")});
+            for (String cspId : cspIdList) {
+                DBSql.update("delete from BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD_BUNDLE_SERVICE where CONTRACT_SERVICE_PERIOD_ID=? ", new Object[]{cspId});
+            }
+            DBSql.update("delete from BO_EU_DNCTT_CONTRACT_SERVICE_PERIOD where CONTRACT_ID=? and OBJECT_ID=? and CONTRACT_SERVICE_ID=?", new Object[]{service.get("CONTRACT_ID"), service.get("OBJECT_ID"), service.get("ID")});
+
+
+            DBSql.update("delete from BO_EU_DNCTT_CONTRACT_SERVICE where CONTRACT_ID=? and OBJECT_ID=? and ID=?", new Object[]{service.get("CONTRACT_ID"), service.get("OBJECT_ID"), service.get("ID")});
+        }
+
 
         return ResponseObject.newOkResponse();
     }

+ 1 - 1
com.awspaas.user.apps.donenow_ctt/src/com/awspaas/user/apps/donenow_ctt/event/costPickFormBeforeSave.java

@@ -57,7 +57,7 @@ public class costPickFormBeforeSave extends InterruptListener {
         if (PICK_QUANTITY <= 0)
             throw new BPMNError("pickError3", "拣货数量不能小于0");
 
-        if (snCnt != PICK_QUANTITY) {
+        if (snCnt > 0 && snCnt != PICK_QUANTITY) {
             //拣货数量和序列号个数不一致
             if (DBSql.getString("SELECT IS_SERIALIZED FROM BO_EU_DNIVT_PRODUCT WHERE ID=?", new Object[]{formData.getString("PRODUCT_ID")}).equals("1")) {
                 throw new BPMNError("pickError4", "请填写序列号");

+ 5 - 2
com.awspaas.user.apps.donenow_ctt/src/com/awspaas/user/apps/donenow_ctt/service/contractService.java

@@ -499,7 +499,7 @@ public class contractService {
             BigDecimal periodRate = divideToBigDecimal(GetPeriodDays(EFFECTIVE_DATE, end), GetPeriodDays(start, periodEnd));    // 首周期占整周期比例
             BO csa = new BO();//合同服务调整
             csa.set("CONTRACT_ID", contract.get("ID"));
-            csa.set("OBJECT_ID", service.get("ID"));
+            csa.set("OBJECT_ID", service.get("OBJECT_ID"));
             csa.set("OBJECT_TYPE", service.get("OBJECT_TYPE"));
             csa.set("QUANTITY_CHANGE", service.get("QUANTITY"));
             csa.set("CONTRACT_SERVICE_ID", service.get("ID"));
@@ -657,6 +657,7 @@ public class contractService {
                             Map<String, String> contractCost = new HashMap<String, String>();
                             contractCost.put("ID", contractCostId);
                             contractCost.put("SERVICE_ID", service.getString("ID"));
+                            contractCost.put("SERVICE_NAME", service.getString("NAME"));
                             contractCost.put("serviceID", serviceID);
                             contractCost.put("CONTRACT_ID", contract.getString("ID"));
                             contractCost.put("QUANTITY", service.getString("QUANTITY"));
@@ -678,6 +679,7 @@ public class contractService {
                         Map<String, String> contractCost = new HashMap<String, String>();
                         contractCost.put("ID", contractCostId);
                         contractCost.put("SERVICE_ID", service.getString("ID"));
+                        contractCost.put("SERVICE_NAME", service.getString("NAME"));
                         contractCost.put("serviceID", service.getString("OBJECT_ID"));
                         contractCost.put("CONTRACT_ID", contract.getString("ID"));
                         contractCost.put("QUANTITY", service.getString("QUANTITY"));
@@ -729,6 +731,7 @@ public class contractService {
         contractCost.set("CONTRACT_ID", service.get("CONTRACT_ID"));
         contractCost.set("SERVICE_ID", service.get("SERVICE_ID"));
         contractCost.set("QUANTITY", service.get("QUANTITY"));
+        contractCost.set("NAME", service.get("SERVICE_NAME"));
 
         contractCost.set("PRODUCT_ID", DBSql.getString(conn, "select PRODUCT_ID from BO_EU_DNIVT_SERVICE where ID=?", new Object[]{service.get("serviceID")}));
 
@@ -736,7 +739,7 @@ public class contractService {
             BO product = SDK.getBOAPI().get("BO_EU_DNIVT_PRODUCT", contractCost.getString("PRODUCT_ID"));
 
             if (product != null) {
-                contractCost.set("NAME", product.getString("NAME"));
+
                 contractCost.set("DESCRIPTION", product.getString("DESCRIPTION"));
                 contractCost.set("COST_CODE_ID", product.getString("COST_CODE_ID"));
                 contractCost.set("UNIT_COST", product.getString("UNIT_COST"));