فهرست منبع

Merge remote-tracking branch 'origin/master'

hmc 1 سال پیش
والد
کامیت
307651f593

+ 10 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/SaleProductsMapper.java

@@ -119,6 +119,16 @@ public interface SaleProductsMapper
      */
     List<ProductInvoiceVO.SaleProductInfo> selectSaleProductsInfo1(String saleOrderNo);
 
+    /**
+     * 查询销售单货品信息(根据出库记录获取库存等级信息)
+     */
+    List<ProductInvoiceVO.SaleProductInfo> selectSaleProductsInfo2(String noticeNumber);
+
+    /**
+     * 查询销售单货品信息(根据手持机出库记录获取库存等级信息)
+     */
+    List<ProductInvoiceVO.SaleProductInfo> selectSaleProductsInfo3(String noticeNumber);
+
 
     /***
      * 查询销售出库单详情

+ 33 - 12
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java

@@ -5,6 +5,8 @@ import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
 
 import com.zkqy.business.domain.ProductWarehousingRecord;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
@@ -13,6 +15,7 @@ import com.zkqy.business.mapper.ProductWarehousingRecordMapper;
 import com.zkqy.business.service.IProductInventoryService;
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.core.domain.entity.SysDictData;
+import com.zkqy.common.core.redis.RedisCache;
 import com.zkqy.common.utils.DateUtils;
 import com.zkqy.common.utils.SecurityUtils;
 import com.zkqy.common.utils.StringUtils;
@@ -48,6 +51,9 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
     @Autowired
     private IProductInventoryService iProductInventoryService;
 
+    @Autowired
+    private RedisCache redisCache;
+
 
     /**
      * 查询产品码单
@@ -104,8 +110,7 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
         productCodeList.setCreateById(SecurityUtils.getUserId());
         productCodeListMapper.insertProductCodeList(productCodeList);
         // 直接入库--
-        vo.getMachineTool();  // 当前机台
-
+        // vo.getMachineTool();  // 当前机台
         String bumen = vo.getMachineToolNo().split("-")[0];
         List<SysDictData> dictDataList = dictDataMapper.selectDictDataByType("section_stash");
         dictDataList.forEach(item -> {
@@ -115,8 +120,6 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
         });
         List<ProductCodeListVO> productCodeListVOList = new ArrayList<>();
         productCodeListVOList.add(vo);
-
-
         iProductInventoryService.productStorage(productCodeListVOList);
         return productCodeList.getId();
     }
@@ -204,18 +207,36 @@ public class ProductCodeListServiceImpl implements IProductCodeListService {
         return productCodeListMapper.selectFinishedProduct(productCodeList);
     }
 
-
+    private ReentrantLock reentrantLock = new ReentrantLock();
 
     @Override
     public String selectMaxCodeList() {
-        String maxCodeList = productCodeListMapper.selectMaxCodeList();
-        LocalDate now = LocalDate.now();
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMdd");
-        String nowCodeList = now.format(formatter) + "00001";
-        if (StringUtils.isNotEmpty(maxCodeList) && Long.parseLong(maxCodeList) >= Long.parseLong(nowCodeList)) {
-            return Long.parseLong(maxCodeList) + 1L + "";
+        try {
+            if (reentrantLock.tryLock(200, TimeUnit.MILLISECONDS)) {
+                String code = redisCache.getCacheObject("huaxianmadanweiyibianhao");
+                if (code == null || code.isEmpty()) {
+                    String maxCodeList = productCodeListMapper.selectMaxCodeList();
+                    LocalDate now = LocalDate.now();
+                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMdd");
+                    String nowCodeList = now.format(formatter) + "00001";
+                    if (StringUtils.isNotEmpty(maxCodeList) && Long.parseLong(maxCodeList) >= Long.parseLong(nowCodeList)) {
+                        nowCodeList = Long.parseLong(maxCodeList) + 1L + "";
+                    }
+                    redisCache.setCacheObject("huaxianmadanweiyibianhao", nowCodeList);
+                    return nowCodeList;
+                } else {
+                    Long nowCode = Long.valueOf(code) + 1;
+                    redisCache.setCacheObject("huaxianmadanweiyibianhao", nowCode.toString());
+                    return String.valueOf(nowCode);
+                }
+            } else {
+                return "";
+            }
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        } finally {
+            reentrantLock.unlock();
         }
-        return nowCodeList;
     }
 
     @Override

+ 1 - 5
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java

@@ -142,7 +142,6 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
             productWarehousingRecord.setWarehouseId(vo.getWarehouseId());//入库仓库编号
             productWarehousingRecord.setRemark(productCodeList.getRemark());
             productWarehousingRecordMapper.insertProductWarehousingRecord(productWarehousingRecord);
-
             // 库存
             //查询当前库存是否存在,如果存在则更新,如果不存在则新增
             ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(vo.getQrCode());
@@ -156,7 +155,6 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
                 DecimalFormat df = new DecimalFormat("0.00");
                 String suttle1 = df.format(suttle);
                 editProductInventory.setTotalSuttle(Double.parseDouble(suttle1));//合计净重
-
                 Double grossWeight = productInventory.getTotalGrossWeight() == null ? vo.getGrossWeight() : productInventory.getTotalGrossWeight() + vo.getGrossWeight();
                 String grossWeight1 = df.format(grossWeight);
                 editProductInventory.setTotalGrossWeight(Double.parseDouble(grossWeight1));//合计毛重
@@ -177,9 +175,7 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
                 addProductInventory.setCreateById(SecurityUtils.getUserId());
                 productInventoryMapper.insertProductInventory(addProductInventory);
             }
-
         }
-
     }
 
     @Override
@@ -309,7 +305,7 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
         ProductInvoice productInvoice2 = productInvoiceMapper.selectProductInvoiceById(productInvoice.getId());
         //判断当前订单是否为零售单
         SaleOrder saleOrder1 = saleOrderMapper.selectSaleOrderBySaleNo(productInvoice2.getSaleOrderNo());
-        if(saleOrder1.getSaleOrderTechnologyNo().equals("retailOrder")){
+        if (saleOrder1.getSaleOrderTechnologyNo().equals("retailOrder")) {
             SaleOrder saleOrder = new SaleOrder();
             saleOrder.setSaleNo(productInvoice2.getSaleOrderNo());
             saleOrder.setStatus("6");

+ 119 - 114
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInvoiceServiceImpl.java

@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import com.zkqy.business.domain.*;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
@@ -137,130 +138,106 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
         // 查询销售单信息
         SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleOrderNo);
 
-        if(saleOrder.getOrderType().equals("1")){
+//        if(saleOrder.getOrderType().equals("1")){
+//            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
+//            if(productInvoice != null){
+//                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+//
+//                    //获取已出库箱数和重量
+//                    ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
+//                            .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
+//
+//                    if(productOutboundRecord != null){
+//                        saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
+//                        saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
+//                    }else {
+//                        saleProductInfo.setBoxNum(0);
+//                        saleProductInfo.setWeight(0.0);
+//                    }
+//                }
+//            }else {
+//                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+//                    saleProductInfo.setBoxNum(0);
+//                    saleProductInfo.setWeight(0.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);
+//            }
+//
+//            //客户编号
+//            vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
+//            vo.setSaleProductInfoList(saleProductInfoList);
+//
+//
+//        }else {
+
+            //表格数据
+
+            //查询所有订单货品信息
             List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
+
             if(productInvoice != null){
-                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+                //根据通知单号查询货品信息
+                List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
 
-                    //获取已出库箱数和重量
-                    ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
-                            .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
+                List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
+                saleProductInfoList2.addAll(saleProductInfoList);
 
-                    if(productOutboundRecord != null){
-                        saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
-                        saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
-                    }else {
-                        saleProductInfo.setBoxNum(0);
-                        saleProductInfo.setWeight(0.0);
+                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
+                    for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
+                        if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
+                            saleProductInfoList.remove(saleProductInfo);
+                        }
                     }
                 }
-            }else {
-                for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
-                    saleProductInfo.setBoxNum(0);
-                    saleProductInfo.setWeight(0.0);
+                if(saleProductInfoList.size() > 0){
+                    saleProductInfoList.forEach(saleProductInfo -> {
+                        saleProductInfo.setBoxNum(0);
+                        saleProductInfo.setWeight(0.0);
+                    });
+                    saleProductInfoList1.addAll(saleProductInfoList);
                 }
-            }
-            //查询当前批号库存箱数,重量
-            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);
-            }
 
-            //客户编号
-            vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
-            vo.setSaleProductInfoList(saleProductInfoList);
-
-
-        }else {
-            //表格数据
-            //根据销售单编号查询货品信息
-//            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(saleOrderNo);
-            List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
-
-            for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
-                //查询库存信息
-                if(saleProductInfo.getLotNum() != null){
+                vo.setSaleProductInfoList(saleProductInfoList1);
+                if(saleProductInfoList1.size() > 0){
                     ProductInventory productInventory1 = new ProductInventory();
-                    productInventory1.setProductId(saleProductInfo.getProductId());
-                    productInventory1.setLotNum(saleProductInfo.getLotNum());
-                    productInventory1.setProductColour(saleProductInfo.getProductColor());
-
-                    ProductInventory productInventory = productInventoryMapper.selectProductInventoryInfo(productInventory1);
-
+                    productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
+                    productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
+                    ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(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());
-
-                    if(productOutboundRecord != null){
-                        saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
-                        saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
+                        vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
+                        vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
                     }else {
-                        saleProductInfo.setBoxNum(0);
-                        saleProductInfo.setWeight(0.0);
+                        vo.setInventoryBoxNum(0);
+                        vo.setInventoryWeight(0.0);
                     }
                 }
+
             }else {
                 for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
                     saleProductInfo.setBoxNum(0);
                     saleProductInfo.setWeight(0.0);
                 }
-            }
-            //查询当前批号库存箱数,重量
-            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.setSaleProductInfoList(saleProductInfoList);
             }
 
 
             //客户编号
             vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
-            vo.setSaleProductInfoList(saleProductInfoList);
-        }
+
+//        }
 
         return vo;
     }
@@ -332,28 +309,56 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
 
         // 查询销售单信息
         SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(productInvoice.getSaleOrderNo());
-        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = new ArrayList<>();
 
-        if(saleOrder.getOrderType().equals("1")){
-            //查询发货单货品详情,循环得到货品实发箱数、重量
-            saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(productInvoice.getSaleOrderNo());
-        }else {
-            saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(productInvoice.getSaleOrderNo());
-        }
+        //查询所有订单货品信息
+        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrder.getSaleNo());
+
+        //根据通知单号查询货品信息
+        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo3(productInvoice.getNoticeNumber());
+        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
+        saleProductInfoList2.addAll(saleProductInfoList);
 
-        for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
-            //实发箱数、重量
-            ProductHandsetOutboundRecord productHandsetOutboundRecord =
-                    productHandsetOutboundRecordMapper.selectBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
-            if(productHandsetOutboundRecord != null){
-                saleProductInfo.setBoxNum(productHandsetOutboundRecord.getBoxNum());
-                saleProductInfo.setWeight(handlingWeight(productHandsetOutboundRecord.getSuttle() == null ? 0 : productHandsetOutboundRecord.getSuttle()));
+        for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
+            for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
+                if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
+                    saleProductInfoList.remove(saleProductInfo);
+                }
             }
         }
+        if(saleProductInfoList.size() > 0){
+            saleProductInfoList.forEach(saleProductInfo -> {
+                saleProductInfo.setBoxNum(0);
+                saleProductInfo.setWeight(0.0);
+            });
+            saleProductInfoList1.addAll(saleProductInfoList);
+        }
+
+
+
+//        List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = new ArrayList<>();
+//
+//        if(saleOrder.getOrderType().equals("1")){
+//            //查询发货单货品详情,循环得到货品实发箱数、重量
+//            saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(productInvoice.getSaleOrderNo());
+//        }else {
+//
+//
+//            saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(productInvoice.getSaleOrderNo());
+//        }
+//
+//        for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
+//            //实发箱数、重量
+//            ProductHandsetOutboundRecord productHandsetOutboundRecord =
+//                    productHandsetOutboundRecordMapper.selectBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
+//            if(productHandsetOutboundRecord != null){
+//                saleProductInfo.setBoxNum(productHandsetOutboundRecord.getBoxNum());
+//                saleProductInfo.setWeight(handlingWeight(productHandsetOutboundRecord.getSuttle() == null ? 0 : productHandsetOutboundRecord.getSuttle()));
+//            }
+//        }
 
         //客户编号
         vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(productInvoice.getSaleOrderNo()));
-        vo.setSaleProductInfoList(saleProductInfoList);
+        vo.setSaleProductInfoList(saleProductInfoList1);
         return vo;
     }
 

+ 5 - 1
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -242,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             pi.product_colour,
             pi.levels
         <if test="lotNum != null and lotNum != ''">HAVING GROUP_CONCAT( DISTINCT pi.lot_num SEPARATOR '、' ) like concat('%', #{lotNum}, '%')</if>
+        order by pi.qr_code  desc
     </select>
 
     <select id="selectComprehensiveInventoryListTwo" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
@@ -261,7 +262,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN {DBNAME}.production p ON pi.product_id = p.id
         WHERE
         pi.del_flag = '0'
-        <if test="productColor != null and productColor != ''">and pi.product_colour like concat('%', #{productColor}, '%')</if>
+        <if test="productColor != null and productColor != ''">and pi.product_colour like concat('%', #{productColor},
+            '%')
+        </if>
         <if test="productId != null">and pi.product_id = #{productId}</if>
         <if test="levels != null and levels != ''">and pi.levels = #{levels}</if>
         <if test="lotNum != null and lotNum != ''">and pi.lot_num like concat('%', #{lotNum}, '%')</if>
@@ -270,6 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         pi.product_colour,
         pi.levels,
         pi.lot_num
+        order by pi.qr_code desc
     </select>
 
 

+ 79 - 0
zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml

@@ -402,6 +402,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     </select>
 
+
+    <select id="selectSaleProductsInfo2" resultType="com.zkqy.business.domain.vo.ProductInvoiceVO$SaleProductInfo">
+        SELECT
+            a.*,
+            IFNULL( sp.product_unit_price, 0 ) AS unitPrice,
+            sp.remark AS productRemark,
+            sp.product_number AS actualWeight
+        FROM
+            (
+                SELECT
+                    p.id AS productId,
+                    p.product_no AS productCode,
+                    p.product_name AS productName,
+                    p.product_specifications AS productSpecifications,
+                    r.lot_num AS lotNum,
+                    r.levels,
+                    count( r.id ) AS boxNum,
+                    TRUNCATE ( sum( r.suttle ), 2 ) AS weight,
+                    r.product_colour AS productColor,
+                    p.product_type AS productType,
+                    pi.sale_order_no
+                FROM
+                    {DBNAME}.product_outbound_record r
+                        LEFT JOIN {DBNAME}.production p ON r.product_id = p.id
+                        LEFT JOIN {DBNAME}.product_invoice pi ON r.notice_number = pi.notice_number
+                        AND pi.del_flag = '0'
+                WHERE
+                    r.del_flag = '0'
+                  AND r.notice_number = #{noticeNumber}
+                GROUP BY
+                    r.lot_num,
+                    r.product_id,
+                    r.product_colour,
+                    r.levels
+            ) AS a
+                LEFT JOIN {DBNAME}.sale_products sp ON sp.sale_order_no = a.sale_order_no
+                AND sp.product_no = a.productCode
+
+    </select>
+
+    <select id="selectSaleProductsInfo3" resultType="com.zkqy.business.domain.vo.ProductInvoiceVO$SaleProductInfo">
+        SELECT
+            a.*,
+            IFNULL( sp.product_unit_price, 0 ) AS unitPrice,
+            sp.remark AS productRemark,
+            sp.product_number AS actualWeight
+        FROM
+            (
+                SELECT
+                    p.id AS productId,
+                    p.product_no AS productCode,
+                    p.product_name AS productName,
+                    p.product_specifications AS productSpecifications,
+                    r.lot_num AS lotNum,
+                    r.levels,
+                    count( r.id ) AS boxNum,
+                    TRUNCATE ( sum( r.suttle ), 2 ) AS weight,
+                    r.product_colour AS productColor,
+                    p.product_type AS productType,
+                    pi.sale_order_no
+                FROM
+                    {DBNAME}.product_handset_outbound_record r
+                        LEFT JOIN {DBNAME}.production p ON r.product_id = p.id
+                    LEFT JOIN {DBNAME}.product_invoice pi ON r.notice_number = pi.notice_number
+                    AND pi.del_flag = '0'
+                WHERE
+                    r.del_flag = '0'
+                  AND r.notice_number = #{noticeNumber}
+                GROUP BY
+                    r.lot_num,
+                    r.product_id,
+                    r.product_colour,
+                    r.levels
+            ) AS a
+                LEFT JOIN {DBNAME}.sale_products sp ON sp.sale_order_no = a.sale_order_no
+            AND sp.product_no = a.productCode
+
+    </select>
+
     <select id="selectOutboundOrderInfo" resultType="com.zkqy.business.domain.vo.SaleProductsVo">
         SELECT
             p.product_name as productName,

+ 97 - 73
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -270,6 +270,7 @@
                     clearable
                     filterable
                     size="mini"
+                    @change="levelChangeHandler"
                   >
                     <el-option
                       v-for="item in dropDownData.level"
@@ -491,6 +492,7 @@ import {
 import codeListPrint from "@/utils/print/codeListPrint";
 import { getServerPrintData } from "@/utils/print/printUtils";
 import { v4 as uuidv4 } from "uuid";
+import moment from "moment";
 
 export default {
   name: "ProductCodeList",
@@ -690,10 +692,26 @@ export default {
       deep: true,
       immediate: true,
     },
+    "dict.type.packaging_type": {
+      handler(newValue, oldValue) {
+        if (newValue?.length > 0 && this.excuteType == 1) {
+          this.form.packaging = newValue[0].value;
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+    "dict.type.coding_list_format": {
+      handler(newValue, oldValue) {
+        if (newValue?.length > 0 && this.excuteType == 1) {
+          this.form.printFormat = newValue[0].value;
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
   },
   mounted() {
-    // console.log(this.dict.type.packaging_type);
-    console.log("mounted");
     let { excuteType, qrCode } = this.$route.query;
     if (excuteType == 2) {
       //修改
@@ -717,6 +735,16 @@ export default {
   },
 
   methods: {
+    // 等级改变回调
+    async levelChangeHandler() {
+      // 等级发生变化,重新获取码单号
+      let res = await getQrCode();
+      if (res.code == 200) {
+        this.qrCode = res.msg;
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
     // 机台改变回调
     machineToolChange(id) {
       if (id) {
@@ -735,7 +763,6 @@ export default {
     },
     async readStateChange() {
       if (this.isStartReadNum) {
-        console.log("当前等待次数:", this.waiting);
         //正在读
         this.closeWebSocket();
         this.isStartReadNum = false;
@@ -756,7 +783,12 @@ export default {
         this.initWebSocket();
       }
     },
-    initWebSocket() {
+    async initWebSocket() {
+      // let res = await this.addIsValidate();
+      // if (!res) {
+      //   this.$message.warning("请完善表单数据");
+      //   return;
+      // }
       const getConfigValue = (label, defaultValue) => {
         let value = this.dict.type.automatic_printing.find(
           (item) => item.label === label
@@ -771,7 +803,6 @@ export default {
       const wsUrl = `ws:${process.env.VUE_APP_BASE_WS_API}/currentWeight`;
       this.websocket = new WebSocket(wsUrl);
       this.websocket.addEventListener("open", (event) => {
-        console.log("建立WebSocket连接");
         this.isStartReadNum = true;
         this.$message.success("已开启读数");
       });
@@ -781,7 +812,6 @@ export default {
       let shouldPrint = false; // 用于控制是否应该打印
 
       this.websocket.addEventListener("message", async (event) => {
-        console.log(event);
         if (!this.printAuto) return;
 
         const weightData = JSON.parse(event.data);
@@ -828,17 +858,12 @@ export default {
         }
       });
 
-      this.websocket.addEventListener("on", (e) => {
-        console.log(e, "连接已建立");
-      });
+      this.websocket.addEventListener("on", (e) => {});
       this.websocket.addEventListener("error", (event) => {
-        console.error("WebSocket错误:", event);
         this.$message.error("WebSocket错误,请重试");
       });
 
-      this.websocket.addEventListener("close", () => {
-        console.log("关闭WebSocket连接");
-      });
+      this.websocket.addEventListener("close", () => {});
     },
     // 用于重置与重量相关的状态
     resetWeightStatus() {
@@ -858,12 +883,10 @@ export default {
 
     // 表单重量改变回调
     changeGrossWeightForm(val) {
-      // console.log(val);
       this.nowWeight = val;
     },
     // 开始设置新的重量
     async setWeight(weight) {
-      console.log("设置新的重量", weight);
       let newData = {};
       let {
         machineTool,
@@ -881,7 +904,6 @@ export default {
         remark,
         machineToolNo,
       } = this.form;
-      console.log(this.currentRow);
       let {
         productName,
         productSpecifications,
@@ -942,7 +964,6 @@ export default {
             }
           },
           (error) => {
-            console.log(error);
             this.$message.warning("请完善表单数据");
             resolve(false);
           }
@@ -951,7 +972,6 @@ export default {
     },
     // 新的后端打印逻辑
     async newPrintHandler() {
-      console.log("newPrintHandler");
       let printRow = this.printTableData[0];
       let payload = {
         qrCodeVal: "",
@@ -983,13 +1003,11 @@ export default {
         qrCode;
       // payload.qrCodeVal = encodeURIComponent(temp);
       payload.qrCodeVal = temp;
-      console.log("二维码数据", temp);
       payload.remark = remark || "注:不同批号,请勿混用";
       payload.mapList = getServerPrintData(printRow);
       payload.printType = printFormat == 3 ? "export" : "normal";
       try {
         let res = await AutoPrinting(payload);
-        console.log(res);
         if (res.code == 200 && res.status == "success") {
           this.$message.success(res.msg);
           if (this.excuteType == 1) {
@@ -999,7 +1017,6 @@ export default {
           this.$message.error(res.msg);
         }
       } catch (error) {
-        console.log(error);
         this.$message.error(error);
       }
     },
@@ -1014,27 +1031,19 @@ export default {
     },
     // 毛重改变回调
     changeGrossWeight(row) {
-      console.log(row);
       let { boxWeight, grossWeight, canisterWeight, canisterNum } = row;
       if (!Number(grossWeight)) {
         row.suttle = 0;
         return;
       }
-      console.log(
-        Number(grossWeight),
-        Number(boxWeight),
-        Number(canisterWeight) * Number(canisterNum)
-      );
       row.suttle = (
         Number(grossWeight) -
         Number(boxWeight) -
         Number(canisterWeight) * Number(canisterNum)
       ).toFixed(2);
-      console.log(row);
     },
     // 删除表格一条数据回调
     async handleDeleteOne(index, row) {
-      console.log(row);
       this.$modal
         .confirm("是否确认该条打印记录?")
         .then(function () {
@@ -1078,12 +1087,9 @@ export default {
           // this.printShow = false;
           // this.getList();
         } else {
-          console.log(res);
           this.$message.error(`${msg}失败`);
         }
-      } catch (error) {
-        console.error(error);
-      }
+      } catch (error) {}
     },
     // 确认打印回调
     printConfirmHandler(printData) {
@@ -1092,7 +1098,6 @@ export default {
       //   return;
       // }
 
-      console.log("打印", this.printTableData);
       this.printTableData.forEach((item) => {
         item.qrCodeData = printData + "-" + item.boxNum;
       });
@@ -1104,7 +1109,6 @@ export default {
         this.tableData.push(this.printTableData[0]);
       }
       // 后端打印
-      console.log("newPrintHandler");
       // this.newPrintHandler();
     },
     // 获取机台选项数据
@@ -1116,13 +1120,13 @@ export default {
         let res = await getLineOptionLsit(payLoad);
         if (res.code == 200) {
           this.lineOptions = res.rows;
-          console.log(this.lineOptions);
+          if (this.lineOptions.length > 0 && this.excuteType == 1) {
+            this.form.machineTool = this.lineOptions[0].id;
+            this.machineToolChange(this.form.machineTool);
+          }
         } else {
-          console.log(res);
         }
-      } catch (error) {
-        console.error(error);
-      }
+      } catch (error) {}
     },
     // 补码打印回调
     handleSuppleOne(row) {
@@ -1139,10 +1143,22 @@ export default {
             let rowData = newData.machineTool
               ? JSON.parse(JSON.stringify(newData))
               : this.tableData[0];
-            console.log(rowData);
+            let timeStemp = new Date().getTime();
             this.printTableData = [rowData];
+            this.printTableData[0].id = timeStemp;
+            // 先打印
+            this.changeGrossWeight(this.printTableData[0]);
+            // 后端打印
+            // await this.newPrintHandler();
+            // 前端打印
+            codeListPrint(this.printTableData, "printDom");
+            if (this.excuteType == 1) {
+              this.tableData.push(this.printTableData[0]);
+            }
+            // 后保存数据
             let payLoad = {
               ...this.form,
+              id: timeStemp, //前端生成id
               qrCodeId: rowData.qrCodeId,
               qrCode: rowData.qrCode,
               lotNum: rowData.lotNum,
@@ -1161,7 +1177,7 @@ export default {
             let tempApiFun = productCodeList;
             if (this.excuteType == 3 || this.excuteType == 2) {
               //补码||修改
-              this.printConfirmHandler(this.tableData[0].id);
+              // this.printConfirmHandler(this.tableData[0].id);
               return;
             }
             this.changeGrossWeight(payLoad);
@@ -1174,16 +1190,12 @@ export default {
               //   return;
               // }
               // this.tableData[0].id = res.data;
-              this.printTableData[0].id = res.data;
-              console.log("printConfirmHandler");
-              this.printConfirmHandler(res.data);
+              // this.printTableData[0].id = res.data;
+              // this.printConfirmHandler(res.data);
             } else {
-              console.log(res);
               this.$message.error(`${msg}箱单失败`);
             }
-          } catch (error) {
-            console.error(error);
-          }
+          } catch (error) {}
         }
       });
     },
@@ -1219,12 +1231,9 @@ export default {
               this.printShow = false;
               this.getList();
             } else {
-              console.log(res);
               this.$message.error(`${msg}箱单失败`);
             }
-          } catch (error) {
-            console.error(error);
-          }
+          } catch (error) {}
         }
       });
     },
@@ -1238,7 +1247,6 @@ export default {
       }
     },
     supplementCodeHandler() {
-      console.log(this.form.id);
       this.printConfirmHandler(this.form.id);
     },
     // 箱单号生成函数
@@ -1283,7 +1291,6 @@ export default {
             levels,
             remark,
           } = this.form;
-          console.log(this.currentRow);
           let {
             productName,
             productSpecifications,
@@ -1330,7 +1337,6 @@ export default {
             productId,
           });
         } else {
-          console.log("error submit!!");
           return false;
         }
       });
@@ -1342,7 +1348,6 @@ export default {
     },
     // 表格点击回调
     async handleCurrentChange(val) {
-      console.log("row", val);
       if (!val) return;
       if (this.isStartReadNum || this.excuteType != 1) {
         this.$refs.proTableRef.setCurrentRow(this.currentRow);
@@ -1370,7 +1375,6 @@ export default {
     },
     // 选择打印数据回调
     handlePrintOneChange(row) {
-      console.log(row);
       if (!this.chooseState) return;
       this.$alert("是否确定打印该数据", "确认打印", {
         confirmButtonText: "确定",
@@ -1417,12 +1421,9 @@ export default {
                     row.id = res.data;
                     this.printConfirmHandler(res.data);
                   } else {
-                    console.log(res);
                     this.$message.error(`${msg}箱单失败`);
                   }
-                } catch (error) {
-                  console.error(error);
-                }
+                } catch (error) {}
               }
             });
           }
@@ -1438,11 +1439,8 @@ export default {
           this.batchData = res.data;
           this.batchTableData = res.data;
         } else {
-          console.log(res);
         }
-      } catch (error) {
-        console.error(res);
-      }
+      } catch (error) {}
     },
     // 批号查询接口
     batchNumChange() {
@@ -1459,13 +1457,40 @@ export default {
       try {
         let res = await getOptionLsit();
         if (res.code == 200) {
-          this.dropDownData = res.data;
+          this.dropDownData = res.data || {};
+          // 初始化默认值
+          if (
+            this.dropDownData.work_shifts?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.workShifts = this.dropDownData.work_shifts[0].codeName;
+          }
+          if (this.dropDownData.level?.length > 0 && this.excuteType == 1) {
+            this.form.levels = this.dropDownData.level[0].codeName;
+          }
+          if (
+            this.dropDownData.drum_weight?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.canisterWeight =
+              this.dropDownData.drum_weight[0].codeName;
+          }
+          if (
+            this.dropDownData.box_weight?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.boxWeight = this.dropDownData.box_weight[0].codeName;
+          }
+          if (
+            this.dropDownData.tube_color?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.tubeColor = this.dropDownData.tube_color[0].codeName;
+          }
         } else {
           this.$message.error("网络异常!");
         }
-      } catch (error) {
-        console.log(error);
-      }
+      } catch (error) {}
     },
     /** 查询产品码单列表 */
     getList() {
@@ -1548,6 +1573,8 @@ export default {
       this.excuteType = 1;
       this.reset();
 
+      this.form.productionDate = new Date();
+
       await this.getAllBatchData(); //获取所有产品数据
       await this.getLineOptionLsit(); //获取机台选项数据
       await this.getSelectOptions();
@@ -1555,7 +1582,6 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(qrCode) {
-      console.log(qrCode);
       this.reset();
       const id = qrCode;
       getPrintDataNew(id).then(async (response) => {
@@ -1570,7 +1596,6 @@ export default {
           this.initProductData();
           this.printShow = true;
         } else {
-          console.log(response);
         }
       });
     },
@@ -1596,7 +1621,6 @@ export default {
     initProductData() {
       this.batchNum = this.form.lotNum;
       this.batchNumChange();
-      console.log(this.batchTableData);
       if (this.batchTableData.length) {
         let {
           machineTool,

+ 3 - 0
zkqy-ui/src/views/orderMange/components/dialogForm/Deliver.vue

@@ -351,6 +351,9 @@ export default {
                 return prev;
               }
             }, 0);
+            if (index == 6 || index == 8) {
+              sums[index] = sums[index].toFixed(2);
+            }
           } else {
             sums[index] = "";
           }

+ 1 - 2
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -84,8 +84,7 @@ export default {
       }
       let {saleNo} = this.row;
       // 出库明细导出
-      this.download(
-        process.env.VUE_APP_BASE_API1 + "system/ProductOutboundRecord/importDataOutboundDetails",
+      this.download("system/ProductOutboundRecord/importDataOutboundDetails",
         {
           saleOrderNo: saleNo,
           isEnablePaging: false

+ 9 - 9
zkqy-ui/src/views/orderMange/components/dialogForm/RetailProvide.vue

@@ -253,14 +253,14 @@ export default {
           id: "productSpecifications",
           label: "规格",
         },
-        // {
-        //   id: "lotNum",
-        //   label: "批号",
-        // },
-        // {
-        //   id: "levels",
-        //   label: "等级",
-        // },
+        {
+          id: "lotNum",
+          label: "批号",
+        },
+        {
+          id: "levels",
+          label: "等级",
+        },
         {
           // id: "actualWeight",
           id: "boxNum",
@@ -310,7 +310,7 @@ export default {
         }
         const values = data.map((item) => Number(item[column.property]));
         if (!values.every((value) => isNaN(value))) {
-          if (index == 3 || index == 4 || index == 5) {
+          if (index == 5 || index == 6 || index == 7) {
             sums[index] = values.reduce((prev, curr) => {
               const value = Number(curr);
               if (!isNaN(value)) {

+ 22 - 3
zkqy-ui/src/views/orderMange/outStock/index.vue

@@ -2,14 +2,23 @@
   <el-card shadow="always" :body-style="{ padding: '10px' }">
     <div class="app-container">
       <div class="table-area">
+        <el-button
+          type="success"
+          size="small"
+          @click="handleRefresh"
+          :icon="loading ? 'el-icon-loading' : 'el-icon-refresh'"
+          :disabled="loading"
+          >刷新</el-button
+        >
+
         <el-table
           :data="leftTableData"
           border
           stripe
-          @selection-change="handleSelectionChange"
           @cell-click="cellClick"
+          highlight-current-row
         >
-          <el-table-column type="selection" width="55" />
+          <!-- <el-table-column type="selection" width="55" /> -->
           <el-table-column type="index" label="序号" width="50" />
           <el-table-column align="center" prop="customerName" label="客户名称">
           </el-table-column>
@@ -168,6 +177,7 @@ export default {
   components: {},
   data() {
     return {
+      loading: false,
       currentIndex: "",
       form: {
         noticeNumber: "", //通知单号
@@ -201,8 +211,14 @@ export default {
       },
     };
   },
-  computed: {},
   methods: {
+    // 刷新回调
+    async handleRefresh() {
+      this.loading = true;
+      await this.initData();
+      await this.initWarehouse();
+      this.loading = false;
+    },
     // 左侧表格点击回调
     cellClick(row, column, cell, event) {
       this.currentIndex = this.leftTableData.findIndex(
@@ -389,4 +405,7 @@ export default {
     flex: 1;
   }
 }
+::v-deep .el-table__body tr.current-row > td.el-table__cell {
+  background-color: #55e905 !important;
+}
 </style>