Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

hmc 1 éve
szülő
commit
4387f9b0ec

+ 10 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java

@@ -261,6 +261,16 @@ public class ProductCodeListVO extends BaseEntity {
     // 是否累加批次库存
     private boolean isLotNum;
 
+    private String productNo;
+
+    public String getProductNo() {
+        return productNo;
+    }
+
+    public void setProductNo(String productNo) {
+        this.productNo = productNo;
+    }
+
     public boolean getIsLotNum() {
         return isLotNum;
     }

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductInventoryMapper.java

@@ -91,4 +91,11 @@ public interface ProductInventoryMapper {
      */
     int batchInsertProductInventory(List<ProductInventory> productInventoryList);
 
+    /**
+     * 查询库存信息
+     * @param productInventory
+     * @return
+     */
+    ProductInventory selectProductInventoryInfo(ProductInventory productInventory);
+
 }

+ 49 - 8
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -181,10 +181,45 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         }else {
             //表格数据
             //根据销售单编号查询货品信息
-            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(saleOrderNo);
+//            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(saleOrderNo);
+            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
+
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+                //查询库存信息
+                if(saleProductInfo.getLotNum() != null){
+                    ProductInventory productInventory1 = new ProductInventory();
+                    productInventory1.setProductId(saleProductInfo.getProductId());
+                    productInventory1.setLotNum(saleProductInfo.getLotNum());
+                    productInventory1.setProductColour(saleProductInfo.getProductColor());
+
+                    ProductInventory productInventory = productInventoryMapper.selectProductInventoryInfo(productInventory1);
+
+                    if(productInventory != null){
+                        saleProductInfo.setLevels(productInventory.getLevels());
+                        saleProductInfo.setQrCode(productInventory.getQrCode());
+                    }
+                }
+            }
+
             if(productInvoice != null){
                 for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
 
+                    //查询库存信息
+//                    if(saleProductInfo.getLotNum() != null){
+//                        ProductInventory productInventory1 = new ProductInventory();
+//                        productInventory1.setProductId(saleProductInfo.getProductId());
+//                        productInventory1.setLotNum(saleProductInfo.getLotNum());
+//                        productInventory1.setProductColour(saleProductInfo.getProductColor());
+//
+//                        ProductInventory productInventory = productInventoryMapper.selectProductInventoryInfo(productInventory1);
+//
+//                        if(productInventory != null){
+//                            saleProductInfo.setLevels(productInventory.getLevels());
+//                            saleProductInfo.setQrCode(productInventory.getQrCode());
+//                        }
+//                    }
+
+
                     //获取已出库箱数和重量
                     ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
                             .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
@@ -204,18 +239,24 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
                 }
             }
             //查询当前批号库存箱数,重量
-            ProductInventory productInventory1 = new ProductInventory();
-            productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
-            productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
-            ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
-            if(productInventory != null){
-                vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
-                vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
+            if(saleProductInfoList.size() > 0){
+                ProductInventory productInventory1 = new ProductInventory();
+                productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
+                productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
+                ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
+                if(productInventory != null){
+                    vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
+                    vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
+                }else {
+                    vo.setInventoryBoxNum(0);
+                    vo.setInventoryWeight(0.0);
+                }
             }else {
                 vo.setInventoryBoxNum(0);
                 vo.setInventoryWeight(0.0);
             }
 
+
             //客户编号
             vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
             vo.setSaleProductInfoList(saleProductInfoList);

+ 8 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -346,4 +346,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </insert>
 
+    <select id="selectProductInventoryInfo"  resultMap="ProductInventoryResult">
+        <include refid="selectProductInventoryVo"/>
+        where del_flag = '0'
+        and product_id = #{productId} and lot_num = #{lotNum}
+         and product_colour = #{productColour}
+         group by product_id,lot_num,product_colour
+    </select>
+
 </mapper>

+ 5 - 3
zkqy-custom-business/src/main/resources/mapper/business/ProductOutboundRecordMapper.xml

@@ -87,6 +87,7 @@
         <result property="productColour" column="product_colour"/>
         <result property="customName" column="custom_name"/>
         <result property="productUnitPrice" column="product_unit_price"/>
+        <result property="productNo" column="product_no"/>
     </resultMap>
 
     <sql id="selectProductOutboundRecordVo">
@@ -370,13 +371,14 @@
     <select id="selectOutboundProduct" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
         SELECT
             r.*,
+            p.product_no,
             p.product_name,
             p.product_specifications,
             r.product_colour AS product_color,
             c.custom_name,
-            TRUNCATE ( SUM( r.suttle ), 2 ) AS totalSuttle,
-            count(r.id) AS totalBoxNum,
-            sp.product_unit_price as productUnitPrice
+            TRUNCATE ( SUM( r.suttle ), 2 ) AS total_suttle,
+            count(r.id) AS total_box_num,
+            sp.product_unit_price as product_unit_price
         FROM
             {DBNAME}.product_outbound_record r
                 LEFT JOIN {DBNAME}.production p ON r.product_id = p.id

+ 9 - 9
zkqy-ui/src/utils/print/deliverOrderPrint.js

@@ -35,31 +35,31 @@ function receiptDocuments(data, domId) {
             <td width="90px">箱数</td>
             <td width="120px">净重</td>
           </tr>`;
-  let totalBoxNum = 0, totalWeight = 0;
+  let myTotalBoxNum = 0, totalWeight = 0;
   for (let i = 0; i < productCodeListVOList.length; i++) {
     let item = productCodeListVOList[i];
-    if (item.boxNum) {
-      totalBoxNum += Number(item.boxNum);
+    if (item.totalBoxNum) {
+      myTotalBoxNum += Number(item.totalBoxNum);
     }
-    if (item.weight) {
-      totalWeight += Number(item.weight);
+    if (item.totalSuttle) {
+      totalWeight += Number(item.totalSuttle);
     }
 
     printContent += `<tr align="center">
-      <td>${item.productCode}</td>
+      <td>${item.productNo}</td>
       <td>${item.productName}</td>
       <td>${item.productSpecifications}</td>
       <td>${item.productColor}</td>
       <td>${item.lotNum}</td>
       <td>${item.levels}</td>
-      <td>${item.boxNum}</td>
-      <td>${item.weight}</td>
+      <td>${item.totalBoxNum}</td>
+      <td>${item.totalSuttle}</td>
       </tr>`
   }
   totalWeight = totalWeight.toFixed(2);
   printContent += `<tr align="center">
             <td colspan="6" align="left">合计</td>
-            <td>${totalBoxNum}</td>
+            <td>${myTotalBoxNum}</td>
             <td>${totalWeight}</td>
           </tr>`
 

+ 11 - 11
zkqy-ui/src/utils/print/sendOrderPrint.js

@@ -46,18 +46,18 @@ function receiptDocuments(data, domId) {
               <td width="50px">单价</td>
               <td width="100px">金额</td>
             </tr>`;
-  let totalBoxNum = 0, totalWeight = 0, totalPrice = 0;
+  let myTotalBoxNum = 0, totalWeight = 0, totalPrice = 0;
   for (let i = 0; i < productCodeListVOList.length; i++) {
     let item = productCodeListVOList[i];
-    if (item.boxNum) {
-      totalBoxNum += Number(item.boxNum);
+    if (item.totalBoxNum) {
+      myTotalBoxNum += Number(item.totalBoxNum);
     }
-    if (item.weight) {
-      totalWeight += Number(item.weight);
+    if (item.totalSuttle) {
+      totalWeight += Number(item.totalSuttle);
     }
     let price = 0
-    if (item.weight && item.unitPrice) {
-      price = Number(item.weight) * Number(item.unitPrice);
+    if (item.totalSuttle && item.productUnitPrice) {
+      price = Number(item.totalSuttle) * Number(item.productUnitPrice);
       totalPrice += price
     }
     price = price.toFixed(2);
@@ -68,9 +68,9 @@ function receiptDocuments(data, domId) {
       <td>${item.levels}</td>
       <td>${item.productColor}</td>
       <td>${item.lotNum}</td>
-      <td>${item.boxNum}</td>
-      <td>${item.weight}</td>
-      <td>${item.unitPrice}</td>
+      <td>${item.totalBoxNum}</td>
+      <td>${item.totalSuttle}</td>
+      <td>${item.productUnitPrice}</td>
       <td>${price}</td>
       </tr>`
   }
@@ -78,7 +78,7 @@ function receiptDocuments(data, domId) {
   totalPrice = totalPrice.toFixed(2);
   printContent += `<tr align="center">
               <td colspan="5">合计</td>
-              <td>${totalBoxNum}</td>
+              <td>${myTotalBoxNum}</td>
               <td>${totalWeight}</td>
               <td></td>
               <td>${totalPrice}</td>

+ 4 - 1
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -2412,9 +2412,12 @@ export default {
           ...data.formData,
           saleProductInfoList: data.tableData,
         };
-        payLoad.status = 5;
+
         // let res = await addProductInvoice(payLoad);
         let reqAPI = isEdit ? submitProductInvoice : submitRetailOrder;
+        if (!isEdit) {
+          payLoad.status = 5;
+        }
         let res = await reqAPI(payLoad);
         if (res.code == 200) {
           this.$message.success("提交成功");