Ver código fonte

盘点任务执行 前端

oyq28 10 meses atrás
pai
commit
6efb585e12

+ 3 - 2
src/main/java/com/imcs/admin/business/controller/WPInventoryCountPalletController.java

@@ -1,5 +1,6 @@
 package com.imcs.admin.business.controller;
 
+import com.imcs.admin.common.Result;
 import com.imcs.admin.entity.WInventoryManagement;
 import com.imcs.admin.entity.WPInventoryCountPallet;
 import com.imcs.admin.business.service.WPInventoryCountPalletService;
@@ -84,8 +85,8 @@ public class WPInventoryCountPalletController {
     }
 
     @GetMapping("/getPalletList/{id}")
-    public ResponseEntity<List<WInventoryManagement>> getPalletList(@PathVariable("id") Long id) {
-        return ResponseEntity.ok(this.wPInventoryCountPalletService.getPalletList(id));
+    public Result getPalletList(@PathVariable("id") Long id) {
+        return Result.success(this.wPInventoryCountPalletService.getPalletList(id));
     }
 
 }

+ 6 - 0
src/main/java/com/imcs/admin/business/dao/WPInventoryCountPalletDao.java

@@ -1,6 +1,8 @@
 package com.imcs.admin.business.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.imcs.admin.entity.WInventoryManagement;
+import com.imcs.admin.entity.WInventoryManagementDetail;
 import com.imcs.admin.entity.WPInventoryCountPallet;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.data.domain.Pageable;
@@ -80,5 +82,9 @@ public interface WPInventoryCountPalletDao extends BaseMapper<WPInventoryCountPa
      */
     int deleteById(Long id);
 
+
+    List<WInventoryManagement> selectInventoryManagementList(Long id);
+
+    List<WInventoryManagementDetail> selectDetailList(Long id);
 }
 

+ 19 - 9
src/main/java/com/imcs/admin/business/service/impl/WPInventoryCountPalletServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
@@ -29,7 +30,7 @@ import java.util.Map;
 @Service("wPInventoryCountPalletService")
 public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implements WPInventoryCountPalletService {
 
-    private static final Map<Integer, PlanStrategy> strategyMap1=new HashMap<>();
+    private static final Map<Integer, PlanStrategy> strategyMap=new HashMap<>();
     @Autowired
     private MaterialPlanStrategy materialPlanStrategy;
     @Autowired
@@ -41,10 +42,10 @@ public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implement
 
     @PostConstruct
     public void init(){
-        strategyMap1.put(1,materialPlanStrategy);
-        strategyMap1.put(2,storagePlanStrategy);
-        strategyMap1.put(3,shelfPlanStrategy);
-        strategyMap1.put(4,warehousePlanStrategy);
+        strategyMap.put(1,materialPlanStrategy);
+        strategyMap.put(2,storagePlanStrategy);
+        strategyMap.put(3,shelfPlanStrategy);
+        strategyMap.put(4,warehousePlanStrategy);
     }
 
     /**
@@ -108,9 +109,18 @@ public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implement
 
     @Override
     public List<WInventoryManagement> getPalletList(Long id) {
-        WPInventoryCountTask wpInventoryCountTask = wPInventoryCountTaskDao.queryById(id);
-        WPInventoryCountPlan wpInventoryCountPlan = wPInventoryCountPlanDao.queryById(wpInventoryCountTask.getWPInventoryCountPlanId());
-        List<WInventoryManagement> execute = strategyMap1.get(wpInventoryCountPlan.getPlanType()).execute(wpInventoryCountPlan);
-        return execute;
+        List<WInventoryManagement> wInventoryManagementList = wPInventoryCountPalletDao.selectInventoryManagementList(id);
+        if(CollectionUtils.isEmpty(wInventoryManagementList)){
+            WPInventoryCountTask wpInventoryCountTask = wPInventoryCountTaskDao.queryById(id);
+            WPInventoryCountPlan wpInventoryCountPlan = wPInventoryCountPlanDao.queryById(wpInventoryCountTask.getWPInventoryCountPlanId());
+            List<WInventoryManagement> execute = strategyMap.get(wpInventoryCountPlan.getPlanType()).execute(wpInventoryCountPlan);
+            return execute;
+        }else{
+            wInventoryManagementList.forEach(vo->{
+                vo.setDetailList(wPInventoryCountPalletDao.selectDetailList(vo.getId()));
+            });
+        }
+
+        return wInventoryManagementList;
     }
 }

+ 11 - 0
src/main/java/com/imcs/admin/entity/WInventoryManagementDetail.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.io.Serializable;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -71,6 +72,16 @@ public class WInventoryManagementDetail extends PageSize implements Serializable
      */
     private Integer updatedBy;
 
+    @TableField(exist = false)
+    private Integer storeAmount;
+    @TableField(exist = false)
+    private Integer realAmount;
+    @TableField(exist = false)
+    private Integer profitLossQuantity;
+    @TableField(exist = false)
+    private String profitLossType;
+
+
 
 }
 

+ 6 - 0
src/main/java/com/imcs/admin/entity/WPInventoryCountPallet.java

@@ -30,6 +30,10 @@ public class WPInventoryCountPallet implements Serializable {
      * 托盘编码
      */
     private String palletCode;
+    /**
+     * 库位编码
+     */
+    private String storageLocationCode;
 /**
      * 创建时间
      */
@@ -47,6 +51,8 @@ public class WPInventoryCountPallet implements Serializable {
      */
     private Integer updatedBy;
 
+    private Integer status;
+
 
 }
 

+ 2 - 2
src/main/resources/mapper/WInventoryManagementDao.xml

@@ -33,7 +33,7 @@
 
 
     <select id="getStore" resultType="com.imcs.admin.entity.WInventoryManagementDetail">
-        select * from w_inventory_management_detail imd
+        select *,imd.amount as storeAmount from w_inventory_management_detail imd
                           left join w_inventory_management im on imd.inventory_management_id=im.id
         where im.storage_location_code=#{locationCode} and (im.STATUS is null or im.STATUS = 0)
     </select>
@@ -87,7 +87,7 @@
 
     <select id="queryByInventoryManagementId" resultType="com.imcs.admin.entity.WInventoryManagementDetail" >
         select
-            *
+            *,amount as storeAmount
         from w_inventory_management_detail where
             inventory_management_id =#{id}
     </select>

+ 9 - 0
src/main/resources/mapper/WPInventoryCountPalletDao.xml

@@ -80,6 +80,7 @@
         </where>
     </select>
 
+
     <!--新增所有列-->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
         insert into w_p_inventory_count_pallet(w_p_inventory_count_task_idpallet_codecreated_atcreated_byupdated_atupdated_by)
@@ -135,5 +136,13 @@ w_p_inventory_count_task_id = values(w_p_inventory_count_task_id)pallet_code = v
         delete from w_p_inventory_count_pallet where id = #{id}
     </delete>
 
+
+    <select id="selectInventoryManagementList" resultType="com.imcs.admin.entity.WInventoryManagement">
+        select * from w_p_inventory_count_pallet where w_p_inventory_count_task_id=#{id}
+    </select>
+
+    <select id="selectDetailList" resultType="com.imcs.admin.entity.WInventoryManagementDetail">
+        select * from w_p_inventory_count_pallet_detail where w_p_inventory_count_pallet_id=#{id}
+    </select>
 </mapper>
 

+ 91 - 46
src/main/resources/static/wms/plan/taskIndex.html

@@ -57,7 +57,7 @@
                                @current-change="handleCurrentChange"/>
             </div>
             <el-dialog
-                    title="执行出库"
+                    title="盘点"
                     :visible.sync="dialogVisibleTask"
                     :before-close="handleCloseTask" width="80%">
                 <el-form :inline="true" :model="formInline" class="demo-form-inline">
@@ -87,46 +87,50 @@
                 </el-form>
                     <div class="table-container" style="margin-bottom: 80px;margin-top: 20px;">
                         <div class="table-wrapper">
-                            <div class="table-title">需求明细</div>
+                            <div class="table-title">盘点托盘</div>
                             <el-table ref="singleTable" :data="detailListTask" v-loading="loading" :border=true label="需求明细"
                                       tooltip-effect="dark"
                                       highlight-current-row max-height="500" style="width: 100%;margin-right:22px"
-                                      :default-sort="{prop: 'createDate', order: 'descending'}"
+                                      :default-sort="{prop: 'createDate', order: 'descending'}"  @row-click="rowClick"
                                       >
-                                <el-table-column prop="materialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
-                                <el-table-column prop="materialName" label="物料名称" :show-overflow-tooltip="true"></el-table-column>
-                                <el-table-column prop="planAmount" label="计划出库数量" :show-overflow-tooltip="true"></el-table-column>
+                                <el-table-column prop="palletCode" label="托盘编码" :show-overflow-tooltip="true"></el-table-column>
+                                <el-table-column prop="storageLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
+                                <el-table-column prop="status" label="盘点状态" :show-overflow-tooltip="true">
+                                    <template slot-scope="{ row }">
+                                        <el-tag >
+                                            {{ getPlanStatusText(row.status) }}
+                                        </el-tag>
+                                    </template>
+                                </el-table-column>
+                                <el-table-column  label="操作" :show-overflow-tooltip="true">
+                                    <template #default="scope">
+                                        <!-- 这里放置操作按钮 -->
+                                        <div class="button-group">
+                                            <el-button type="primary" icon="el-icon-check"  >出库</el-button>
+                                        </div>
+                                    </template>
+                                </el-table-column>
                             </el-table>
                         </div>
 
                         <div class="table-wrapper">
-                            <div class="table-title">库存明细</div>
-                            <el-table ref="singleTable" :data="detailListTask" v-loading="loading" :border=true label="库存明细"
+                            <div class="table-title">托盘明细</div>
+                            <el-table ref="singleTable" :data="detailList" v-loading="loading" :border=true label="库存明细"
                                       tooltip-effect="dark"
                                       highlight-current-row max-height="500" style="width: 100%;"
                                       :default-sort="{prop: 'createDate', order: 'descending'}"
-                                       ><!--@row-click="rowClick"-->
+                                       >
                                 <el-table-column prop="materialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
-                                <el-table-column prop="storageLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
-                                <el-table-column label="托盘" :show-overflow-tooltip="true">
-                                    <template #default="{ row }">
-                                        <el-select v-model="row.outPalletCode" placeholder="请选择" @change="handleSelectChange(row)">
-                                            <el-option
-                                                    v-for="option in row.inventoryManagementList"
-                                                    :key="option.storageLocationCode"
-                                                    :label="option.palletCode"
-                                                    :value="option.palletCode">
-                                            </el-option>
-                                        </el-select>
+                                <el-table-column prop="storeAmount" label="库存数量" :show-overflow-tooltip="true"></el-table-column>
+                                <el-table-column prop="realAmount" label="盘点数量" :show-overflow-tooltip="true">
+                                    <template slot-scope="scope">
+                                        <el-input v-model="scope.row.realAmount" type="number" @input="handleInput(scope.row)"></el-input>
                                     </template>
                                 </el-table-column>
-                                <el-table-column prop="amount" label="库存数量" :show-overflow-tooltip="true"></el-table-column>
-                                <el-table-column label="操作">
-                                    <template #default="scope">
-                                        <!-- 这里放置操作按钮 -->
-                                        <el-button type="primary" @click="getOutPalletCode(scope.row)">出库</el-button>
-                                        <!-- 可以添加更多的操作按钮 -->
-                                    </template>
+
+                                <el-table-column prop="profitLossType" label="盘库状态" :show-overflow-tooltip="true">
+                                </el-table-column>
+                                <el-table-column prop="profitLossQuantity" label="盘库异常数量" :show-overflow-tooltip="true">
                                 </el-table-column>
                             </el-table>
 
@@ -178,6 +182,8 @@
                 detailListOut: [],
                 options:[],
                 name: '',
+                entryPoint: '',
+                binCode: '',
                 createDate: '',
                 currentPage: 1,
                 total: 0,
@@ -297,17 +303,55 @@
                         return ""
                 }
 
+            }, getPlanStatusText(status) {
+                switch (status) {
+                    case 0:
+                        return '未开始'; // 第三种类型的文本
+                    case 1:
+                        return '进行中'; // 第四种类型的文本
+                    case 2:
+                        return '完成'; // 第四种类型的文本
+                    default:
+                        return '未开始'
+                }
+
+            }, getProfitLossTypeText(status) {
+               /* if(status === null){
+                    let ag= row.realAmount - row.storeAmount;
+                    if(ag > 0){
+                        return '盘盈';
+                    }else if(ag = 0){
+                        return '正常';
+                    }else{
+                        return '盘亏';
+                    }
+                }else{
+                    switch (status) {
+                        case 0:
+                            return '盘亏'; // 第三种类型的文本
+                        case 1:
+                            return '盘盈'; // 第四种类型的文本
+                        case 2:
+                            return '正常'; // 第四种类型的文本
+                        default:
+                            return ''
+                    }
+                }
+                */
+
+            }, getPendingAmount(row) {
+                return row.realAmount - row.storeAmount;
             },handleSelectionChange(selection) {
                 this.selection = selection
             },toDo(row){
                 this.dialogVisibleTask=true;
-                this.wInventoryTransactionOrdersId=row.id;
-                axios.get('/order/getOrderById/'+row.id, {
+
+                axios.get('/wPInventoryCountPallet/getPalletList/'+row.id, {
                 })
                     .then(response => {
                         console.log(response)
                         if(response.data.success){
-                            const res=response.data.data;
+                            this.detailListTask=response.data.data
                         }
                     })
                     .catch(error => {
@@ -330,22 +374,23 @@
                 })
             },
             rowClick(row, column, event){
-                // 处理行点击事件
-                console.log('Row clicked:', row);
-                console.log('Column clicked:', column);
-                console.log('Event:', event);
-                axios.get('/wInventoryManagement/'+row.storageLocationCode, {
-                })
-                    .then(response => {
-                        console.log(response)
-                        if(response.data.success){
-                            const res=response.data.data;
-                            this.detailListPallet=res;
-                        }
-                    })
-                    .catch(error => {
-                        // 处理错误
-                    });
+                console.log(row)
+                this.detailList=row.detailList;
+            },
+            handleInput(row){
+                console.log(row)
+
+                let ag= row.realAmount - row.storeAmount;
+                row.profitLossQuantity=ag
+                if(ag > 0){
+                    row.profitLossType='盘盈';
+                }else if(ag = 0){
+                    row.profitLossType='正常';
+                }else{
+                    row.profitLossType='盘亏';
+                }
+
+
             },handleScan(){
                 console.log(this.inputCode)
                 axios.get('/order/verifyCode/'+this.inputCode, {