浏览代码

盘点定时任务 和 盘点任务执行

oyq28 1 年之前
父节点
当前提交
e2c63c88e3

+ 0 - 7
src/main/java/com/imcs/admin/business/dao/WInventoryTransactionTaskDao.java

@@ -38,13 +38,6 @@ public interface WInventoryTransactionTaskDao extends BaseMapper<WInventoryTrans
      */
     long count(WInventoryTransactionTask wInventoryTransactionTask);
 
-    /**
-     * 新增数据
-     *
-     * @param wInventoryTransactionTask 实例对象
-     * @return 影响行数
-     */
-    int insert(WInventoryTransactionTask wInventoryTransactionTask);
 
     /**
      * 批量新增数据(MyBatis原生foreach方法)

+ 17 - 0
src/main/java/com/imcs/admin/business/service/impl/WPInventoryCountPalletServiceImpl.java

@@ -1,6 +1,7 @@
 package com.imcs.admin.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.imcs.admin.business.constants.Status;
 import com.imcs.admin.business.strategy.*;
 import com.imcs.admin.common.Result;
@@ -98,6 +99,22 @@ public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implement
 
         });
 
+        // 开始时间 和 结束时间
+        LambdaQueryWrapper<WPInventoryCountPallet> wrapper= Wrappers.lambdaQuery(WPInventoryCountPallet.class).eq(WPInventoryCountPallet::getStatus,2).eq(WPInventoryCountPallet::getWPInventoryCountTaskId,wPInventoryCountPallet.getTaskId());
+        Long count = wPInventoryCountPalletDao.selectCount(wrapper);
+
+        WPInventoryCountTask wpInventoryCountTask=new WPInventoryCountTask();
+        wpInventoryCountTask.setId(wPInventoryCountPallet.getTaskId());
+        if(count==0){
+            wpInventoryCountTask.setEndTime(new Date());
+        }else if(count==1){
+            wpInventoryCountTask.setStartTime(new Date());
+            wpInventoryCountTask.setStatus(1);
+        }
+
+        wPInventoryCountTaskDao.update(wpInventoryCountTask);
+
+
         //这个状态最适合的位置应该是在 wcs入库完成后去更改任务状态
         /*WPInventoryCountTask wpInventoryCountTask=new WPInventoryCountTask();
         wpInventoryCountTask.setId(wPInventoryCountPallet.getTaskId());

+ 3 - 0
src/main/java/com/imcs/admin/entity/WPInventoryCountTask.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;
@@ -63,6 +64,8 @@ public class WPInventoryCountTask extends PageSize implements Serializable {
      */
     private Long updatedBy;
 
+    @TableField(exist = false)
+    private Integer planType;
 
 }
 

+ 0 - 21
src/main/resources/mapper/WInventoryTransactionTaskDao.xml

@@ -153,28 +153,7 @@
     </select>
 
     <!--新增所有列-->
-    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task(w_inventory_transaction_orders_idtask_codestart_positionend_positionvector_codeerror_infostatustask_typestart_timeend_timeremarkscreated_atcreated_byupdated_atupdated_by)
-        values (#{wInventoryTransactionOrdersId}#{taskCode}#{startPosition}#{endPosition}#{vectorCode}#{errorInfo}#{status}#{taskType}#{startTime}#{endTime}#{remarks}#{createdAt}#{createdBy}#{updatedAt}#{updatedBy})
-    </insert>
 
-    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task(w_inventory_transaction_orders_idtask_codestart_positionend_positionvector_codeerror_infostatustask_typestart_timeend_timeremarkscreated_atcreated_byupdated_atupdated_by)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-        (#{entity.wInventoryTransactionOrdersId}#{entity.taskCode}#{entity.startPosition}#{entity.endPosition}#{entity.vectorCode}#{entity.errorInfo}#{entity.status}#{entity.taskType}#{entity.startTime}#{entity.endTime}#{entity.remarks}#{entity.createdAt}#{entity.createdBy}#{entity.updatedAt}#{entity.updatedBy})
-        </foreach>
-    </insert>
-
-    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task(w_inventory_transaction_orders_idtask_codestart_positionend_positionvector_codeerror_infostatustask_typestart_timeend_timeremarkscreated_atcreated_byupdated_atupdated_by)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-            (#{entity.wInventoryTransactionOrdersId}#{entity.taskCode}#{entity.startPosition}#{entity.endPosition}#{entity.vectorCode}#{entity.errorInfo}#{entity.status}#{entity.taskType}#{entity.startTime}#{entity.endTime}#{entity.remarks}#{entity.createdAt}#{entity.createdBy}#{entity.updatedAt}#{entity.updatedBy})
-        </foreach>
-        on duplicate key update
-w_inventory_transaction_orders_id = values(w_inventory_transaction_orders_id)task_code = values(task_code)start_position = values(start_position)end_position = values(end_position)vector_code = values(vector_code)error_info = values(error_info)status = values(status)task_type = values(task_type)start_time = values(start_time)end_time = values(end_time)remarks = values(remarks)created_at = values(created_at)created_by = values(created_by)updated_at = values(updated_at)updated_by = values(updated_by)
-    </insert>
 
     <!--通过主键修改数据-->
     <update id="update">

+ 0 - 22
src/main/resources/mapper/WInventoryTransactionTaskDetailDao.xml

@@ -137,28 +137,6 @@
     </select>
 
     <!--新增所有列-->
-    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task_detail(inventory_transaction_task_idmaterial_codematerial_nameamountbatch_nounitproduction_dateexpiration_dateremarksstatuscreated_atcreated_byupdated_atupdated_by)
-        values (#{inventoryTransactionTaskId}#{materialCode}#{materialName}#{amount}#{batchNo}#{unit}#{productionDate}#{expirationDate}#{remarks}#{status}#{createdAt}#{createdBy}#{updatedAt}#{updatedBy})
-    </insert>
-
-    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task_detail(inventory_transaction_task_idmaterial_codematerial_nameamountbatch_nounitproduction_dateexpiration_dateremarksstatuscreated_atcreated_byupdated_atupdated_by)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-        (#{entity.inventoryTransactionTaskId}#{entity.materialCode}#{entity.materialName}#{entity.amount}#{entity.batchNo}#{entity.unit}#{entity.productionDate}#{entity.expirationDate}#{entity.remarks}#{entity.status}#{entity.createdAt}#{entity.createdBy}#{entity.updatedAt}#{entity.updatedBy})
-        </foreach>
-    </insert>
-
-    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
-        insert into w_inventory_transaction_task_detail(inventory_transaction_task_idmaterial_codematerial_nameamountbatch_nounitproduction_dateexpiration_dateremarksstatuscreated_atcreated_byupdated_atupdated_by)
-        values
-        <foreach collection="entities" item="entity" separator=",">
-            (#{entity.inventoryTransactionTaskId}#{entity.materialCode}#{entity.materialName}#{entity.amount}#{entity.batchNo}#{entity.unit}#{entity.productionDate}#{entity.expirationDate}#{entity.remarks}#{entity.status}#{entity.createdAt}#{entity.createdBy}#{entity.updatedAt}#{entity.updatedBy})
-        </foreach>
-        on duplicate key update
-inventory_transaction_task_id = values(inventory_transaction_task_id)material_code = values(material_code)material_name = values(material_name)amount = values(amount)batch_no = values(batch_no)unit = values(unit)production_date = values(production_date)expiration_date = values(expiration_date)remarks = values(remarks)status = values(status)created_at = values(created_at)created_by = values(created_by)updated_at = values(updated_at)updated_by = values(updated_by)
-    </insert>
 
     <!--通过主键修改数据-->
     <update id="update">

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

@@ -109,8 +109,8 @@
 
     <!--新增所有列-->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into w_p_inventory_count_plan(plan_name,plan_type,plan_strategy,plan_input,status,remarks,created_at,created_by,updated_at,updated_by,plan_time)
-        values (#{planName},#{planType},#{planStrategy},#{planInput},#{status},#{remarks},#{createdAt},#{createdBy},#{updatedAt},#{updatedBy},#{planTime})
+        insert into w_p_inventory_count_plan(plan_name,plan_type,plan_strategy,plan_input,status,remarks,created_at,created_by,updated_at,updated_by,plan_time,plan_code)
+        values (#{planName},#{planType},#{planStrategy},#{planInput},#{status},#{remarks},#{createdAt},#{createdBy},#{updatedAt},#{updatedBy},#{planTime},#{planCode})
     </insert>
 
     <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

+ 10 - 25
src/main/resources/mapper/WPInventoryCountTaskDao.xml

@@ -14,6 +14,7 @@
         <result property="createdBy" column="created_by" jdbcType="INTEGER"/>
         <result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
         <result property="updatedBy" column="updated_by" jdbcType="INTEGER"/>
+        <result property="planType" column="plan_type" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--查询单个-->
@@ -27,41 +28,29 @@
     <!--查询指定行数据-->
     <select id="queryAllByLimit" resultMap="WPInventoryCountTaskMap">
         select
-*
-        from w_p_inventory_count_task
+        task.*,plan.plan_type
+        from w_p_inventory_count_task task left join w_p_inventory_count_plan plan on task.w_p_inventory_count_plan_id=plan.id
         <where>
             <if test="id != null">
-                and id = #{id}
+                and task.id = #{id}
             </if>
             <if test="wPInventoryCountPlanId != null and wPInventoryCountPlanId != ''">
-                and w_p_inventory_count_plan_id = #{wPInventoryCountPlanId}
+                and task.w_p_inventory_count_plan_id = #{wPInventoryCountPlanId}
             </if>
             <if test="taskCode != null and taskCode != ''">
-                and task_code = #{taskCode}
+                and task.task_code = #{taskCode}
             </if>
             <if test="status != null and status != ''">
-                and status = #{status}
+                and task.status = #{status}
             </if>
             <if test="startTime != null">
-                and start_time = #{startTime}
+                and task.start_time = #{startTime}
             </if>
             <if test="endTime != null">
-                and end_time = #{endTime}
+                and task.end_time = #{endTime}
             </if>
             <if test="planUser != null and planUser != ''">
-                and plan_user = #{planUser}
-            </if>
-            <if test="createdAt != null">
-                and created_at = #{createdAt}
-            </if>
-            <if test="createdBy != null">
-                and created_by = #{createdBy}
-            </if>
-            <if test="updatedAt != null">
-                and updated_at = #{updatedAt}
-            </if>
-            <if test="updatedBy != null">
-                and updated_by = #{updatedBy}
+                and task.plan_user = #{planUser}
             </if>
         </where>
     </select>
@@ -108,10 +97,6 @@
     </select>
 
     <!--新增所有列-->
-    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
-        insert into w_p_inventory_count_task(w_p_inventory_count_plan_id,task_code,status,start_time,end_time,plan_user,created_at,created_by,updated_at,updated_by)
-        values (#{wPInventoryCountPlanId},#{taskCode},#{status},#{startTime},#{endTime},#{planUser},#{createdAt},#{createdBy},#{updatedAt},#{updatedBy})
-    </insert>
 
     <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
         insert into w_p_inventory_count_task(w_p_inventory_count_plan_idtask_codestatusstart_timeend_timeplan_usercreated_atcreated_byupdated_atupdated_by)

+ 51 - 7
src/main/resources/static/wms/plan/taskIndex.html

@@ -30,6 +30,13 @@
                       :default-sort="{prop: 'createDate', order: 'descending'}">
 
                 <el-table-column prop="taskCode" label="盘点任务编码" :show-overflow-tooltip="true"></el-table-column>
+                <el-table-column prop="planType" label="盘点类型" :show-overflow-tooltip="true">
+                    <template slot-scope="{ row }">
+                        <el-tag >
+                            {{ getInOutTypeText(row.planType) }}
+                        </el-tag>
+                    </template>
+                </el-table-column>
                 <el-table-column prop="status" label="状态" :show-overflow-tooltip="true">
                     <template slot-scope="{ row }">
                         <el-tag >
@@ -44,7 +51,8 @@
                     <template #default="scope">
                         <!-- 这里放置操作按钮 -->
                         <div class="button-group">
-                            <el-button type="primary" @click="toDo(scope.row.id)" icon="el-icon-check"  circle>执行</el-button>
+                            <el-button type="primary" @click="toDo(scope.row.id)" icon="el-icon-check"  circle :disabled="scope.row.status === 2">执行</el-button>
+                            <el-button type="danger" @click="orderDelete(scope.row)" icon="el-icon-delete" circle>删除</el-button>
                         </div>
                     </template>
                 </el-table-column>
@@ -327,6 +335,20 @@
                         return '未开始'
                 }
 
+            }, getInOutTypeText(status) {
+                switch (status) {
+                    case 1:
+                        return '物料'; // 第三种类型的文本
+                    case 2:
+                        return '库位'; // 第四种类型的文本
+                    case 2:
+                        return '货架'; // 第四种类型的文本
+                    case 2:
+                        return '库房'; // 第四种类型的文本
+                    default:
+                        return ""
+                }
+
             }, getProfitLossTypeText(status) {
                /* if(status === null){
                     let ag= row.realAmount - row.storeAmount;
@@ -394,6 +416,31 @@
                 this.isViewMode=false;
                 this.selection=row;
                 this.inputDisabled=row.status===2;
+            },orderDelete(row){
+                this.$confirm('确认删除?')
+                    .then(_ => {
+                        axios.delete('/wPInventoryCountTask', {
+                            params:{
+                                id:row.id
+                            }
+                        })
+                            .then(response => {
+                                console.log(response)
+                                if(response.data){
+                                    this.$message({
+                                        message: '删除成功',
+                                        type: "success"
+                                    })
+                                    this.queryClick();
+                                }
+                            })
+                            .catch(error => {
+                                // 处理错误
+                            });
+                        done();
+                    })
+                    .catch(_ => {});
+
             },
             handleInput(row){
                 console.log(row)
@@ -539,11 +586,9 @@
                         return
                     }
                 })
-                // 过滤掉选中的任务
-                const remainingTasks = this.detailListTask.filter(task => !this.selection.includes(task));
+                 /*const remainingTasks = this.detailListTask.filter(task => !this.selection.includes(task));
 
-                // 检查剩余任务的 status 是否都等于 2
-                const allStatusTwo = remainingTasks.every(task => task.status === 2);
+                const allStatusTwo = remainingTasks.every(task => task.status === 2);*/
 
                 axios.post('/wPInventoryCountPallet', {
                     'wPInventoryCountTaskId':this.wPInventoryCountTaskId,
@@ -552,8 +597,7 @@
                     'palletCode':this.selection.palletCode,
                     'storageLocationCode':this.selection.storageLocationCode,
                     'status':2,
-                    'detailList':this.detailList,
-                    'isFinsh':allStatusTwo
+                    'detailList':this.detailList
                 })
                     .then(response => {
                         if(response.data.success){