xian 4 роки тому
батько
коміт
f6ae7e0b55

+ 16 - 0
watero-common-core/src/main/resources/rebel.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
+  Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
+-->
+<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
+
+	<id>watero-common-core</id>
+
+	<classpath>
+		<dir name="E:/code/idea-code/rst/iamberry-common-parent/watero-common-core/target/classes">
+		</dir>
+	</classpath>
+
+</application>

+ 16 - 0
watero-common-tool/src/main/resources/rebel.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
+  Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
+-->
+<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
+
+	<id>watero-common-tool</id>
+
+	<classpath>
+		<dir name="E:/code/idea-code/rst/iamberry-common-parent/watero-common-tool/target/classes">
+		</dir>
+	</classpath>
+
+</application>

+ 10 - 1
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/SalesOrder.java

@@ -152,7 +152,16 @@ public class SalesOrder implements Serializable {
     private Integer feeCharges;             //维修收费
     private Date salesSignTime;             // 签收时间
     private Integer salesIsErrorSign;       // 是否签收,1:异常签收
-    private Integer salesErrorState;      // 异常状态,1:无异常 2:快递遗失 3:快递破损 4:其他
+    private Integer salesErrorState;        // 异常状态,1:无异常 2:快递遗失 3:快递破损 4:其他
+    private Integer salesQuality;           // 订单产品类型:1:系统自动判断;2:良品;3:不良品
+
+    public Integer getSalesQuality() {
+        return salesQuality;
+    }
+
+    public void setSalesQuality(Integer salesQuality) {
+        this.salesQuality = salesQuality;
+    }
 
     private List<SalesOrderItem> salesOrderItemList = new ArrayList<SalesOrderItem>();
     private List<SalesOrderItem> suSalesOrderItemList = new ArrayList<SalesOrderItem>();

+ 72 - 52
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/SalesOrderServiceImpl.java

@@ -1460,68 +1460,88 @@ public class SalesOrderServiceImpl implements SalesOrderService {
         if(flag < 1){
             throw new RuntimeException("操作失败,订单出/入库失败,请联系技术人员核查。");
         }
-        //是否原机退回
+        SalesOrder temp = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
+        if (temp.getSalesQuality() == 2) {
+            // 指定发良品
+
+        } else if (temp.getSalesQuality() == 3) {
+            // 指定发不良品
+        } else {
+            // 系统自动判断
+        }
+        // 是否原机退回
         boolean isMachineRetuen = false;
-        ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();
-        complaintDetectInfo.setSalesOrderId(salesOrder.getSalesOrderId());
-        List<ComplaintDetectInfo> complaintDetectInfoList = complaintDetectInfoMapper.listComplaintDetectByOrderId(complaintDetectInfo);
-        if(complaintDetectInfoList != null && complaintDetectInfoList.size() > 0) {
-            ComplaintDetectInfo cdinfo = complaintDetectInfoList.get(0);
-            int state = cdinfo.getDetectState();
-            if (state == 32 || state == 33 || state == 36 || state == 39) {
-                isMachineRetuen = true;
+        if (temp.getSalesQuality() == 1) {
+            ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();
+            complaintDetectInfo.setSalesOrderId(salesOrder.getSalesOrderId());
+            List<ComplaintDetectInfo> complaintDetectInfoList = complaintDetectInfoMapper.listComplaintDetectByOrderId(complaintDetectInfo);
+            if(complaintDetectInfoList != null && complaintDetectInfoList.size() > 0) {
+                ComplaintDetectInfo cdinfo = complaintDetectInfoList.get(0);
+                int state = cdinfo.getDetectState();
+                if (state == 33 || state == 39) {
+                    isMachineRetuen = true;
+                }
             }
-        }
-        if(isMachineRetuen){
-            // 减去售后仓库不良品
-            ComplaintDetectInfo cdinfo = complaintDetectInfoList.get(0);
-            InventoryInfo inventoryInfo1 = new InventoryInfo();
-            inventoryInfo1.setInventoryDefectiveProductNum(1);
-            inventoryInfo1.setInventoryProductColorId(cdinfo.getProductColorId());
-            inventoryInfo1.setWarehouseId(salesOrder.getSalesWarehouseId());
-            //产品质量类型 1良品 2 不良品
-            inventoryInfo1.setQualityType(2);
-            inventoryInfo1.setInventoryRecentRecord("维修机器-原机返回(维修ID:" + cdinfo.getDetectNumber() + ")");
-            flag = inventoryService.minusInventory(inventoryInfo1);
-            if (flag < 1) {
-                throw new RuntimeException("出库失败。维修库存调整失败");
+            if (isMachineRetuen) {
+                // 减去售后仓库不良品
+                ComplaintDetectInfo cdinfo = complaintDetectInfoList.get(0);
+                InventoryInfo inventoryInfo1 = new InventoryInfo();
+                inventoryInfo1.setInventoryDefectiveProductNum(1);
+                inventoryInfo1.setInventoryProductColorId(cdinfo.getProductColorId());
+                inventoryInfo1.setWarehouseId(salesOrder.getSalesWarehouseId());
+                // 产品质量类型 1良品 2 不良品
+                inventoryInfo1.setQualityType(2);
+                inventoryInfo1.setInventoryRecentRecord("维修机器-原机返回(维修ID:" + cdinfo.getDetectNumber() + ")");
+                flag = inventoryService.minusInventory(inventoryInfo1);
+                if (flag < 1) {
+                    throw new RuntimeException("出库失败。维修库存调整失败");
+                }
+                return flag;
             }
-        }else{
-            // 正常库存出库(包含正常销售与售后)
-            SalesOrder so = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
-            SalesOrderItem salesOrderItem = new SalesOrderItem();
-            salesOrderItem.setItemOrderId(so.getSalesId());
-            List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
-            // 查询维修编号,并根据维修编号对应的处理结果判断是否从不良品中出库
+        }
+
+        // 正常库存出库(包含正常销售与售后)
+        SalesOrder so = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
+        SalesOrderItem salesOrderItem = new SalesOrderItem();
+        salesOrderItem.setItemOrderId(so.getSalesId());
+        List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
+        // 查询维修编号,并根据维修编号对应的处理结果判断是否从不良品中出库
+        boolean isDefectiveProduct = false;
+        if (temp.getSalesQuality() == 1) {
+            // 凡是(付费维修-维修完成)、(免费维修-维修完成)、(机器无故障,原机退回)都走不良品
             List<ComplaintDetectInfo> listDetect  = complaintDetectInfoMapper.listComplaintDetectBySalesId(so.getSalesOrderId());
-            boolean isDefectiveProduct = false;
             if (listDetect != null && !listDetect.isEmpty()) {
                 int result = listDetect.get(0).getDetectState();
-                if (result == 32 || result == 36 || result == 37 || result == 39) {
-                    // 凡是(付费维修-维修完成)、(免费维修-维修完成)、(机器无故障,原机退回)都走不良品
+                if (result == 32 ||result == 33 || result == 36 || result == 37 || result == 39) {
                     isDefectiveProduct = true;
                 }
             }
-            if(salesOrder.getSalesDeliver() == 2){
-                // 标记出库,修改库存
-                // 如果已出库则返还库存
-                for (SalesOrderItem soi:listOrderitem) {
-                    InventoryInfo inventoryInfo2 = new InventoryInfo();
-                    inventoryInfo2.setInventoryProductBar(soi.getItemColorBar());
-                    inventoryInfo2.setWarehouseId(so.getSalesWarehouseId());
-                    //类型1.采购 2.发货 3.次品
-                    inventoryInfo2.setLogType(2);
-                    //产品质量类型 1良品 2 不良品
-                    if (isDefectiveProduct) {
-                        inventoryInfo2.setInventoryDefectiveProductNum(soi.getItemNum());
-                        inventoryInfo2.setQualityType(2);
-                    } else {
-                        inventoryInfo2.setInventoryGoodProductNum(soi.getItemNum());
-                        inventoryInfo2.setQualityType(1);
-                    }
-                    inventoryInfo2.setInventoryRecentRecord("出库-订单号:"+ so.getSalesDealCode());
-                    inventoryService.minusInventory(inventoryInfo2);
+        } else if (temp.getSalesQuality() == 2) {
+            // 良品
+            isDefectiveProduct = false;
+        } else if (temp.getSalesQuality() == 3) {
+            // 不良品
+            isDefectiveProduct = true;
+        }
+        if(salesOrder.getSalesDeliver() == 2){
+            // 标记出库,修改库存
+            // 如果已出库则返还库存
+            for (SalesOrderItem soi:listOrderitem) {
+                InventoryInfo inventoryInfo2 = new InventoryInfo();
+                inventoryInfo2.setInventoryProductBar(soi.getItemColorBar());
+                inventoryInfo2.setWarehouseId(so.getSalesWarehouseId());
+                //类型1.采购 2.发货 3.次品
+                inventoryInfo2.setLogType(2);
+                //产品质量类型 1良品 2 不良品
+                if (isDefectiveProduct) {
+                    inventoryInfo2.setInventoryDefectiveProductNum(soi.getItemNum());
+                    inventoryInfo2.setQualityType(2);
+                } else {
+                    inventoryInfo2.setInventoryGoodProductNum(soi.getItemNum());
+                    inventoryInfo2.setQualityType(1);
                 }
+                inventoryInfo2.setInventoryRecentRecord("出库-订单号:"+ so.getSalesDealCode());
+                inventoryService.minusInventory(inventoryInfo2);
             }
         }
         return flag;

+ 1 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/salesOrderMapper.xml

@@ -1818,6 +1818,7 @@
           sales_distribution_time = NOW(),
           sales_warehouse_id = #{salesWarehouseId},
           sales_is_sublist = #{salesIsSublist},
+          sales_quality = #{salesQuality},
           sales_belong_orderId = #{salesBelongOrderId}
         WHERE
           sales_shipping_status = 0

+ 7 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AdminSalesOrderController.java

@@ -1047,7 +1047,11 @@ public class AdminSalesOrderController {
     @ResponseBody
     @RequestMapping("/choose_warehouse")
     @RequiresPermissions("salesOrder:distribution:salesOrder")
-    public ResponseJson chooseWarehouse(HttpServletRequest request,String ids,Integer warehouseId,String type) throws Exception {
+    public ResponseJson chooseWarehouse(HttpServletRequest request,
+                                        @RequestParam("ids") String ids,
+                                        @RequestParam("warehouseId") Integer warehouseId,
+                                        @RequestParam("salesQuality") Integer salesQuality,
+                                        @RequestParam("type") String type) throws Exception {
         ResponseJson rj = ResponseJson.getFAILURE();
         Integer flag = 0;
         StringBuilder errorId = new StringBuilder();
@@ -1074,6 +1078,7 @@ public class AdminSalesOrderController {
                    newOrder.setSalesWarehouseId(warehouseId);
                    newOrder.setSalesIsSublist(1);
                    newOrder.setSalesDealCode(salesOrder.getSalesDealCode());
+                   newOrder.setSalesQuality(salesQuality);
                    /*判断主订单是否是其它订单的子订单 2019-10-08新需求     state*/
 
                    newOrder = suSalesOrder(newOrder);
@@ -1105,6 +1110,7 @@ public class AdminSalesOrderController {
                        newOrder.setSalesWarehouseId(warehouseId);
                        newOrder.setSalesIsSublist(1);
                        newOrder.setSalesDealCode(so.getSalesDealCode());
+                       newOrder.setSalesQuality(salesQuality);
                        /*判断主订单是否是其它订单的子订单 2019-10-08新需求     state*/
                        newOrder = suSalesOrder(newOrder);
                        /*判断主订单是否是其它订单的子订单 2019-10-08新需求     end*/

+ 30 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/order/salesOrder/choose_warehouse.ftl

@@ -60,7 +60,7 @@
 <body>
 
 <article class="page-container" style="padding: 10px;">
-    <div class="pd-20 cl" style="width: 450px;margin: 0 auto;">
+    <div class="pd-20 cl" style="width: 450px;margin: 0 auto;padding-top: 0px;">
 
         <#if orderWarehouseList?? &&  (orderWarehouseList?size > 0) >
             <#list orderWarehouseList as warehouse>
@@ -74,6 +74,33 @@
             </#list>
         </#if>
 
+        <div class="row cl">
+            <label class="form-label col-1 col-sm-1" style="font-weight: bold;"><span class="c-red"></span>配货类型:</label>
+
+        </div>
+        <div class="row cl" style="margin-left: -8%;">
+            <div class="formControls col-5 col-sm-5 skin-minimal">
+                <div class="radio-box" style="    margin-bottom: 10px;">
+                    <label for="detect_is_maintain-1">
+                        <input type="radio" id="detect_is_maintain-1" name="salesQuality" value="1" checked>系统自动判断
+                        <div style="font-size: 10px;padding-left: 40px;width: 400px;">注:若是系统自动判断,非售后订单均为良品,售后订单中的原机退回、维修机退回使用不良品,正常情况下选择此项</div>
+                    </label>
+                </div>
+                <div class="radio-box" style="    margin-bottom: 10px;">
+                    <label for="detect_is_maintain-2">
+                        <input type="radio" id="detect_is_maintain-2" name="salesQuality" value="2" >良品
+                        <div style="font-size: 10px;padding-left: 40px;width: 400px;">注:若选择此项,无论是售后、正常订单,都使用良品库存</div>
+                    </label>
+                </div>
+                <div class="radio-box" style="    margin-bottom: 10px;">
+                    <label for="detect_is_maintain-3">
+                        <input type="radio" id="detect_is_maintain-3" name="salesQuality" value="3" >不良品
+                        <div style="font-size: 10px;padding-left: 40px;width: 400px;">注:若选择此项,无论是售后、正常订单,都使用不良品库存</div>
+                    </label>
+                </div>
+            </div>
+        </div>
+
         <div class="row cl" style="padding-top: 30px;">
             <div class="col-3 col-sm-2 col-offset-3" style="float:left;">
                 <button class="btn btn-block btn-primary " type="button" onclick="chooseWarehouseById()">确认</button>
@@ -94,6 +121,7 @@
         var type = "${type!""}";
         var ids = "${ids!""}";
         var warehouseId =  $("input[name='warehouseId']:checked").val();
+        var salesQuality =  $("input[name='salesQuality']:checked").val();
 
         if(!isEmpty(warehouseId) || !isEmpty(ids)){
             layer.msg("通知配货数据有误!", {icon: 5, time: 3000});
@@ -110,6 +138,7 @@
                 data:{
                     "type" : type,  //salesId 标识id为传入订单id(数组)  batchId标识id为批次ID
                     "ids" : ids,
+                    "salesQuality" : salesQuality,
                     "warehouseId" : warehouseId
                 },
                 dataType: 'json',