Переглянути джерело

库内理货(界面) --end

k 2 роки тому
батько
коміт
ca0ef76505

+ 45 - 34
ruoyi-ui/src/views/ams/inv/invLotLocId/index.vue

@@ -38,6 +38,16 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="是否满拖" prop="isFull">
+        <el-select v-model="queryParams.isFull" placeholder="请选择是否满拖" clearable>
+          <el-option
+            v-for="dict in dict.type.sys_yes_no"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item label="入库单号" prop="lotatt08">
         <el-input
           v-model="queryParams.lotatt08"
@@ -65,16 +75,6 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="是否满拖" prop="isFull">
-        <el-select v-model="queryParams.isFull" placeholder="请选择是否满拖" clearable>
-          <el-option
-            v-for="dict in dict.type.sys_yes_no"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          ></el-option>
-        </el-select>
-      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -174,11 +174,21 @@
       <el-table-column label="物料编号" align="center" prop="sku" width="200"/>
       <el-table-column label="物料名称" align="center" prop="skuName" width="200"/>
       <el-table-column label="物料种类" align="center" prop="skuTypeName"/>
-      <el-table-column label="是否满拖" align="center" prop="isFull"/>
+
       <el-table-column label="库存数量" align="center" prop="qty"/>
       <el-table-column label="已分配数量" align="center" prop="qtyallocated" width="200"/>
 <!--      <el-table-column label="托盘号" align="center" prop="lotatt07" width="200"/>-->
 <!--      <el-table-column label="入库单号" align="center" prop="lotatt08" width="200"/>-->
+      <el-table-column label="库位状态" align="center" prop="stockStatus">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.location_status" :value="scope.row.stockStatus"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否满拖" align="center" prop="isFull">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isFull"/>
+        </template>
+      </el-table-column>
       <el-table-column
         v-for="(item, index) in tableOption"
         :key="index"
@@ -275,7 +285,7 @@ import adjDialog from "@/views/ams/inv/invLotLocId/adjDialog";
 export default {
   name: "InvLotLocId",
   components: { adjDialog },
-  dicts: ['sys_yes_no'],
+  dicts: ['sys_yes_no','location_status'],
   data() {
     return {
       // 遮罩层
@@ -306,6 +316,7 @@ export default {
         pageSize: 10,
         sku: null,
         locationNo: null,
+        stockStatus: null,
         palletNo: null,
         isFull: null,
         zoneId: null,
@@ -481,29 +492,29 @@ export default {
       //判断是否都是相同类型
       let preSkuType = ''
       for(let i = 0;i<this.tableSelection.length;i++) {
-        if(preSkuType === '') {
-          preSkuType = this.tableSelection[i].skuTypeName
-        } else {
-          if(preSkuType !== this.tableSelection[i].skuTypeName) {
-            this.$modal.msgError("只能整理同类型的库存");
-            return
-          }
-        }
-
-        if(this.tableSelection[i].qtyallocated !== 0) {
-          this.$modal.msgError("请选择未分配的库存");
-          return
-        }
-
-        if(this.tableSelection[i].qtyallocated === this.tableSelection[i].qty) {
-          this.$modal.msgError("没有可以分配的库存");
-          return
-        }
+        // if(preSkuType === '') {
+        //   preSkuType = this.tableSelection[i].skuTypeName
+        // } else {
+        //   if(preSkuType !== this.tableSelection[i].skuTypeName) {
+        //     this.$modal.msgError("只能整理同类型的库存");
+        //     return
+        //   }
+        // }
 
-        if(this.tableSelection[i].isFull !== 'N') {
-          this.$modal.msgError("请选择未满拖的库存");
-          return
-        }
+        // if(this.tableSelection[i].qtyallocated !== 0) {
+        //   this.$modal.msgError("请选择未分配的库存");
+        //   return
+        // }
+        //
+        // if(this.tableSelection[i].qtyallocated === this.tableSelection[i].qty) {
+        //   this.$modal.msgError("没有可以分配的库存");
+        //   return
+        // }
+        //
+        // if(this.tableSelection[i].isFull !== 'N') {
+        //   this.$modal.msgError("请选择未满拖的库存");
+        //   return
+        // }
       }
       addInvTally({"invLotLocIdLotattVOS": this.tableSelection}).then(response => {
         this.$modal.msgSuccess(response.msg);

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/erp/service/impl/SyncServiceImpl.java

@@ -207,6 +207,10 @@ public class SyncServiceImpl implements ISyncService {
         wmsDocOrderHeader.setEdiSendFlag("N");
         List<WmsDocOrderHeader> wmsDocOrderHeaders = wmsDocOrderHeaderService.selectWmsDocOrderHeaderList(wmsDocOrderHeader);
         for (WmsDocOrderHeader wmsDocOrderHeader1 : wmsDocOrderHeaders) {
+            // 理货不回传
+            if (wmsDocOrderHeader1.getOrderType().equals(Constant.ORDER_TYP.LH.getValue())) {
+                continue;
+            }
             String orderNo = wmsDocOrderHeader1.getOrderNo();
             WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
             wmsDocOrderDetails.setOrderNo(orderNo);

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/form/InvLocIdSearchFrom.java

@@ -8,6 +8,7 @@ import com.ruoyi.ams.config.domain.dto.LotattDTO;
  * Date: 2022/3/14
  */
 public class InvLocIdSearchFrom {
+    private String lotnum;
     private String sku;
     private String zoneId;
     private String locationId;
@@ -20,6 +21,14 @@ public class InvLocIdSearchFrom {
     private String lotatt14;
     private String lotatt15;
 
+    public String getLotnum() {
+        return lotnum;
+    }
+
+    public void setLotnum(String lotnum) {
+        this.lotnum = lotnum;
+    }
+
     public String getSku() {
         return sku;
     }

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/service/IWmsDocOrderHeaderService.java

@@ -61,6 +61,8 @@ public interface IWmsDocOrderHeaderService {
      */
     int insertWmsDocOrderHeader(WmsDocOrderHeader wmsDocOrderHeader);
 
+    int insertWmsDocOrderHeader(WmsDocOrderHeader wmsDocOrderHeader,String orderNo);
+
     /**
      * 修改出库单头
      *

+ 81 - 48
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -182,6 +182,24 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         }*/
         return result;
     }
+    /**
+     * 新增出库单头
+     *
+     * @param wmsDocOrderHeader 出库单头
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int insertWmsDocOrderHeader(WmsDocOrderHeader wmsDocOrderHeader,String orderNo) {
+        wmsDocOrderHeader.setOrderNo(orderNo);
+        wmsDocOrderHeader.setEdiSendFlag("N");
+        int result = wmsDocOrderHeaderMapper.insertWmsDocOrderHeader(wmsDocOrderHeader);
+        /*List<WmsDocOrderDetails> orderDetails = wmsDocOrderHeader.getWmsDocOrderDetailsList();
+        for (WmsDocOrderDetails de : orderDetails) {
+            wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
+        }*/
+        return result;
+    }
 
     /**
      * 修改出库单头
@@ -1346,65 +1364,79 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     @Transactional
     @Override
     public AjaxResult invTally(InvTallyForm invTallyForm) {
+        List<InvLotLocIdLotattVO> endInvList = new ArrayList<>(); //最终操作的库存
+        // 校验
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invTallyForm.getInvLotLocIdLotattVOS();
+        for (InvLotLocIdLotattVO invLotLocIdLotattVO : invLotLocIdLotattVOList) {
+            InvLotLocIdLotattVO locIdLotattVO = null;
+            InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+            invLocIdSearchFrom.setLotnum(invLotLocIdLotattVO.getLotnum());
+            invLocIdSearchFrom.setSku(invLotLocIdLotattVO.getSku());
+            invLocIdSearchFrom.setLocationId(invLotLocIdLotattVO.getLocationId().toString());
+            List<InvLotLocIdLotattVO> lotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+            if (lotLocIdLotattVOList.size() == 0) {
+                continue;
+            }
+            locIdLotattVO = lotLocIdLotattVOList.get(0);
+            // 满托不可理货
+            if (StringUtils.isNotEmpty(locIdLotattVO.getIsFull())
+                    && locIdLotattVO.getIsFull().equals(Constant.IS_YES.Y.getValue())) {
+                return AjaxResult.error("不可选择满托物料!库位号:" + locIdLotattVO.getLocationNo());
+            }
+            // 已经分配的库存不可理货
+            if (StringUtils.isNotEmpty(locIdLotattVO.getLotatt15())) {
+                return AjaxResult.error("不可选择已分配库存!库位号:" + locIdLotattVO.getLocationNo());
+            }
+            // 判断空闲
+            if (!locIdLotattVO.getStockStatus().equals(Constant.STOCK_STATUS.STOCK00.getValue())) {
+                return AjaxResult.error("非空闲库存不可操作!库位号:" + locIdLotattVO.getLocationNo());
+            }
+            endInvList.add(locIdLotattVO);
+        }
+        if (endInvList.size() == 0) {
+            return AjaxResult.error("可操作库存为条数为0!");
+        }
         //生成出库单
-        //生成出库明细
-        //生成分配
         LoginUser loginUser = SecurityUtils.getLoginUser();
-        List<InvLotLocIdLotattVO> invList = invTallyForm.getInvLotLocIdLotattVOS();
         String orderNo = idSequenceUtils.generateId("ORDERNO");
         WmsDocOrderHeader header = new WmsDocOrderHeader();
-        header.setOrderNo(orderNo);
         header.setCustomerId(Constant.CUSTOMER_ID);
-        header.setOrderType("LH");
-        header.setOrderStatus("20");
+        header.setOrderType(Constant.ORDER_TYP.LH.getValue());
+        header.setOrderStatus(Constant.ORDER_STS.STS20.getValue());
+        header.setSoReference1(orderNo);
         header.setCreateBy(loginUser.getUsername());
         header.setCreateTime(new Date());
-        Map<String, WmsDocOrderDetails> mapOrder = new HashMap<>();
-        for (InvLotLocIdLotattVO inv : invList) {
-            BigDecimal current = BigDecimal.valueOf(inv.getQty()).subtract(BigDecimal.valueOf(inv.getQtyallocated()));
-            WmsDocOrderDetails de;
-            if (mapOrder.get(inv.getSku()) == null) {
-                de = new WmsDocOrderDetails();
-                de.setOrderNo(orderNo);
-                de.setOrderLineNo(BigDecimal.valueOf(mapOrder.size() + 1));
-                de.setLineStatus("20");
-                de.setSku(inv.getSku());
-                de.setQtyOrdered(BigDecimal.ZERO);
-                de.setQtyOrderedEach(BigDecimal.ZERO);
-                de.setQtyAllocated(BigDecimal.ZERO);
-                de.setQtyAllocatedEach(BigDecimal.ZERO);
-                de.setQtyPicked(BigDecimal.ZERO);
-                de.setQtyPickedEach(BigDecimal.ZERO);
-                de.setQtyShipped(BigDecimal.ZERO);
-                de.setQtyShippedEach(BigDecimal.ZERO);
-                de.setCustomerId(inv.getCustomerId());
-                de.setLotnum(inv.getLotnum());
-                mapOrder.put(inv.getSku(), de);
-            } else {
-                de = mapOrder.get(inv.getSku());
-            }
-            de.setQtyOrdered(de.getQtyOrdered().add(current));
-            de.setQtyOrderedEach(de.getQtyOrdered());
-            de.setQtyAllocated(de.getQtyAllocated().add(current));
-            de.setQtyAllocatedEach(de.getQtyAllocated());
+        int result = wmsDocOrderHeaderService.insertWmsDocOrderHeader(header,orderNo);
+        if (result <= 0) {
+            return AjaxResult.error("生成出库单头失败!");
+        }
+        for (InvLotLocIdLotattVO inv : endInvList) {
+            WmsDocOrderDetails de = new WmsDocOrderDetails();
+            de.setOrderNo(orderNo);
+            de.setLineStatus(Constant.ORDER_STS.STS20.getValue());
+            de.setSku(inv.getSku());
+            de.setCustomerId(Constant.CUSTOMER_ID);
+            de.setQtyOrdered(new BigDecimal(inv.getQty()));
+            de.setQtyOrderedEach(new BigDecimal(inv.getQty()));
+            de.setQtyAllocated(new BigDecimal(inv.getQty()));
+            de.setQtyAllocatedEach(new BigDecimal(inv.getQty()));
+            de.setQtyPicked(BigDecimal.ZERO);
+            de.setQtyPickedEach(BigDecimal.ZERO);
+            de.setQtyShipped(BigDecimal.ZERO);
+            de.setQtyShippedEach(BigDecimal.ZERO);
+            de.setCustomerId(inv.getCustomerId());
+            de.setLotnum(inv.getLotnum());
             de.setCreateBy(loginUser.getUsername());
             de.setCreateTime(new Date());
+            int i = wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
+            if (i <= 0) {
+                throw new ServiceException("出库单明细生成失败!");
+            }
 
-            //更新已分配
-            invLotLocIdMapper.updateAllocationBy(inv.getLotnum(), inv.getLocationId(), current);
-
-            //生成分配表
-            actAllocationDetailsService.addActAllocationDetails(inv.getLotnum(), inv.getLocationId().toString(), BigDecimal.valueOf(inv.getQty()), de, "00");
-        }
-        for (WmsDocOrderDetails de : mapOrder.values()) {
-            wmsDocOrderHeaderService.insertWmsDocOrderDetails(de);
-        }
-        int result = wmsDocOrderHeaderService.insertWmsDocOrderHeader(header);
-        if (result > 0) {
-            return AjaxResult.success("操作成功");
-        } else {
-            return AjaxResult.error("操作失败");
+            //库位对应所有库存lotatt15记录分配出库单号
+            invLotLocIdService.updateLotatt15ByLocationId(inv.getLocationId().toString(), orderNo);
         }
+       return AjaxResult.success("操作成功");
     }
 
     @Transactional
@@ -1653,6 +1685,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             return actAllocationDetailsService.modifyAssignmentStockTaskStatusPickingComplete(orderNo, locationId, palletNo);
         }
     }
+
     @Transactional
     @Override
     public AjaxResult modifyAssignmentStockTaskStatusComplete(String orderNo, Long locationId, String palletNo, boolean isBH) {

+ 4 - 3
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -346,12 +346,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join base_sku_type skt on sk.sku_type = skt.item_code
         left join (select dict_label,dict_value from sys_dict_data where dict_type = 'ams_inv_quality') lot05_dict on att.lotatt05 = lot05_dict.dict_value
         left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
-        left join (SELECT * from wms_box_info where location_id not in('99997','99998','99999')) w on inv.location_id = w.location_id
+        left join  wms_box_info w on att.lotatt07 = w.box_no
         <where>
             <if test="zoneId != null  and zoneId != ''"> and b.zone_id = #{zoneId}</if>
-            <if test="sku != null  and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
-            <if test="locationNo != null  and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
+            <if test="sku != null  and sku != ''"> and inv.sku = #{sku}</if>
+            <if test="lotnum != null  and lotnum != ''"> and inv.lotnum = #{lotnum}</if>
             <if test="locationId != null  and locationId != ''"> and inv.location_id = #{locationId}</if>
+            <if test="locationNo != null  and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
             <if test="isFull != null  and isFull != ''"> and w.is_full = #{isFull}</if>
             <if test="lotattDTO != null">
                 <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>