Răsfoiți Sursa

Merge branch 'master' of http://62.234.61.92:3000/wjm/mec-cloud_IntelligentManufacturing_CLIENT

lph 1 an în urmă
părinte
comite
db9b2c14f9

+ 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");

+ 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>
 
 

+ 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