Эх сурвалжийг харах

feat:核对出库明细,不对就删除明细,回滚库存

hmc 1 жил өмнө
parent
commit
5cbea975c3

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductOutboundRecordController.java

@@ -121,6 +121,13 @@ public class ProductOutboundRecordController extends BaseController {
         return toAjax(productOutboundRecordService.deleteProductOutboundRecordByIds(ids));
     }
 
+    @Log(title = "成品出库记录", businessType = BusinessType.DELETE)
+    @DeleteMapping("/removeErrorOutboundRecord/{id}")
+    @ApiOperation(value = "删除成品出库记录--库存回滚")
+    public AjaxResult removeErrorOutboundRecord(@PathVariable Long id) {
+        return toAjax(productOutboundRecordService.removeErrorOutboundRecord(id));
+    }
+
     /**
      * 是否已出库
      */

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductHandsetOutboundRecordMapper.java

@@ -79,4 +79,9 @@ public interface ProductHandsetOutboundRecordMapper
      */
     ProductHandsetOutboundRecord selectBoxNumSuttle1(@Param("productId") Long productId,@Param("noticeNumber") String noticeNumber,@Param("productColour") String productColour);
 
+    /**
+     * 通过码单号删除手持出库库记录信息
+     * @return
+     */
+    int deleteProductHandsetOutboundRecordByQrCode(String qrCoed);
 }

+ 7 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductOutboundRecordService.java

@@ -83,4 +83,11 @@ public interface IProductOutboundRecordService {
      * @return 结果
      */
     public int deleteProductOutboundRecordByUUID(String qrCodeId);
+
+    /**
+     * 删除错误入库日志信息
+     * @param id
+     * @return
+     */
+    int removeErrorOutboundRecord(Long id);
 }

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

@@ -128,6 +128,7 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
             if (productWarehousingRecord1 != null) {
                 continue;
             }
+            //入库记录信息
             ProductWarehousingRecord productWarehousingRecord = new ProductWarehousingRecord();
             BeanUtils.copyProperties(productCodeList, productWarehousingRecord);
             productWarehousingRecord.setQrCodeId(vo.getQrCodeId());

+ 60 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductOutboundRecordServiceImpl.java

@@ -1,17 +1,24 @@
 package com.zkqy.business.service.impl;
 
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.zkqy.business.domain.ProductHandsetOutboundRecord;
+import com.zkqy.business.domain.ProductInventory;
 import com.zkqy.business.domain.ProductInvoice;
 import com.zkqy.business.domain.vo.ProductCodeListVO;
+import com.zkqy.business.mapper.ProductHandsetOutboundRecordMapper;
+import com.zkqy.business.mapper.ProductInventoryMapper;
 import com.zkqy.business.mapper.ProductInvoiceMapper;
 import com.zkqy.common.utils.DateUtils;
+import com.zkqy.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zkqy.business.mapper.ProductOutboundRecordMapper;
 import com.zkqy.business.domain.ProductOutboundRecord;
 import com.zkqy.business.service.IProductOutboundRecordService;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 成品出库记录Service业务层处理
@@ -27,6 +34,12 @@ public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordS
     @Autowired
     private ProductInvoiceMapper productInvoiceMapper;
 
+    @Autowired
+    private ProductInventoryMapper productInventoryMapper;
+
+    @Autowired
+    private ProductHandsetOutboundRecordMapper productHandsetOutboundRecordMapper;
+
     /**
      * 查询成品出库记录
      *
@@ -105,6 +118,53 @@ public class ProductOutboundRecordServiceImpl implements IProductOutboundRecordS
         return productOutboundRecordMapper.deleteProductOutboundRecordByUUID(qrCodeId);
     }
 
+    /**
+     *         //码单号-货品编号-批号-等级--产品色则
+     *         //筒数-箱数-净重-毛重-筒重-箱子重-管色
+     * @param id
+     * @return
+     */
+    @Override
+    @Transactional
+    public int removeErrorOutboundRecord(Long id) {
+        //查询出库日志信息记录表
+        ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper.selectProductOutboundRecordById(id);
+        //计算合计箱数、筒数、净重、毛重
+        ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(productOutboundRecord.getQrCode());
+        ProductInventory editProductInventory = new ProductInventory();
+        editProductInventory.setId(productInventory.getId());
+        //合计筒数:if 总的通俗等于null 那么就是当前筒数,如果不是空就累加
+        editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() == null ? productOutboundRecord.getCanisterNum() : productInventory.getTotalCanisterNum() + productOutboundRecord.getCanisterNum());//合计筒数数
+        //合计箱数: 原箱数加出库日志中的箱数
+        editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() + productOutboundRecord.getBoxNum());
+        //合计净重
+        Double suttle = productInventory.getTotalSuttle() == null ? productOutboundRecord.getSuttle() : productInventory.getTotalSuttle() + productOutboundRecord.getSuttle();
+        DecimalFormat df = new DecimalFormat("0.00");
+        String suttle1 = df.format(suttle);
+        editProductInventory.setTotalSuttle(Double.parseDouble(suttle1));
+        //合计毛重
+        Double grossWeight = productInventory.getTotalGrossWeight() == null ? productOutboundRecord.getGrossWeight() : productInventory.getTotalGrossWeight() + productOutboundRecord.getGrossWeight();
+        String grossWeight1 = df.format(grossWeight);
+        editProductInventory.setTotalGrossWeight(Double.parseDouble(grossWeight1));
+        //更新库存信息
+        editProductInventory.setUpdateById(SecurityUtils.getUserId());
+        editProductInventory.setUpdateBy(SecurityUtils.getUsername());
+        editProductInventory.setUpdateTime(DateUtils.getNowDate());
+        productInventoryMapper.updateProductInventory(editProductInventory);
+
+        //手持机日志记录-逻辑删
+        ProductHandsetOutboundRecord productHandsetOutboundRecord=new ProductHandsetOutboundRecord();
+        productHandsetOutboundRecord.setQrCode(productOutboundRecord.getQrCode());
+        productHandsetOutboundRecord.setDelFlag("2");
+        productHandsetOutboundRecordMapper.updateProductHandsetOutboundRecord(productHandsetOutboundRecord);
+        //pc端日志记录-逻辑删
+        ProductOutboundRecord productOutboundRecordUpdate=new ProductOutboundRecord();
+        productOutboundRecordUpdate.setId(id);
+        productOutboundRecordUpdate.setDelFlag("2");
+        productOutboundRecordMapper.updateProductOutboundRecord(productOutboundRecordUpdate);
+        return 1;
+    }
+
     @Override
     public List<ProductCodeListVO> outboundDetails(String noticeNumber) {
         return productOutboundRecordMapper.selectOutboundDetails(noticeNumber);

+ 3 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductHandsetOutboundRecordMapper.xml

@@ -208,6 +208,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+    <delete id="deleteProductHandsetOutboundRecordByQrCode" parameterType="String">
+        delete from product_handset_outbound_record where qr_code = #{qrCode}
+    </delete>
 
     <select id="selectWhetherExist" resultType="com.zkqy.business.domain.ProductHandsetOutboundRecord">
         <include refid="selectProductHandsetOutboundRecordVo"/>

+ 6 - 0
zkqy-custom-business/src/main/resources/mapper/business/SaleOrderMapper.xml

@@ -335,6 +335,12 @@
                 and so.sale_order_technology_no != 'retailOrder'
             </otherwise>
         </choose>
+        <if test="status!=null and status!='' and status=='100'">
+            and  so.status!=6
+        </if>
+        <if test="status!=null and status!='' and status=='200'">
+            and  so.status=6
+        </if>
         order by so.id desc
     </select>
 

+ 10 - 1
zkqy-ui/src/api/system/ProductWarehousingRecord.js

@@ -52,7 +52,13 @@ export function ProductOutboundRecord(query) {
     params: query
   })
 }
-
+//删除错误的出库记录表
+export function removeErrorOutboundRecord(ids) {
+  return request({
+    url: `/system/removeErrorOutboundRecord/${ids}`,
+    method: 'delete',
+  })
+}
 
 // 删除成品入库记录
 export function deleteProductInventory(data) {
@@ -62,3 +68,6 @@ export function deleteProductInventory(data) {
     data: data
   })
 }
+
+
+//删除出库记录表

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

@@ -1149,12 +1149,12 @@ export default {
             // 先打印
             this.changeGrossWeight(this.printTableData[0]);
             // 后端打印
-            await this.newPrintHandler();
+            // await this.newPrintHandler();
             // 前端打印
-            // codeListPrint(this.printTableData, "printDom");
-            // if (this.excuteType == 1) {
-            //   this.tableData.push(this.printTableData[0]);
-            // }
+            codeListPrint(this.printTableData, "printDom");
+            if (this.excuteType == 1) {
+              this.tableData.push(this.printTableData[0]);
+            }
             // 后保存数据
             let payLoad = {
               ...this.form,

+ 32 - 3
zkqy-ui/src/views/orderMange/components/dialogForm/OutStock.vue

@@ -43,6 +43,14 @@
       <el-table-column prop="suttle" label="净重"></el-table-column>
       <el-table-column prop="qrCode" label="码单号"></el-table-column>
       <el-table-column prop="boxNum" label="箱号"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="danger"
+            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
     </el-table>
     <pagination
       v-show="total > 0"
@@ -57,6 +65,8 @@
 <script>
 import {outboundDetails} from "@/api/system/retailMange.js";
 import moment from "moment";
+import {removeErrorOutboundRecord} from "@/api/system/ProductWarehousingRecord";
+
 
 export default {
   name: "OutStock",
@@ -66,7 +76,7 @@ export default {
     return {
       tableData: [],
       row: {},
-
+      orderRow:{},
       // 分页相关
       total: 0,
       queryParams: {
@@ -75,8 +85,27 @@ export default {
       },
     };
   },
-  computed: {},
+  computed: {
+
+  },
+  created() {
+    this.orderRow={}
+  },
   methods: {
+    //删除回滚对应产品的库存
+    handleDelete(index,row){
+      removeErrorOutboundRecord(row.id).then(res=>{
+        if (res.code == 200) {
+          this.$message.success("删除成功");
+          this.getOutStockDetail(this.orderRow);
+        } else {
+          this.$message.error("删除失败");
+          throw Error("删除失败");
+        }
+      })
+       //出库
+      console.log("删除出库产品、回滚库存",row)
+    },
     exportOutInfo() {
       if (this.tableData.length == 0) {
         this.$message.warning("没有出库数据!")
@@ -138,6 +167,7 @@ export default {
     },
     // 获取出库详情
     async getOutStockDetail(row) {
+      this.orderRow =row;
       let {saleNo} = row;
       this.row = row;
       try {
@@ -145,7 +175,6 @@ export default {
           ...this.queryParams,
           saleOrderNo: saleNo,
         };
-        console.log(payLoad)
         let res = await outboundDetails(payLoad);
         if (res.code == 200) {
           this.tableData = res.rows;

+ 24 - 13
zkqy-ui/src/views/orderMange/retailMange/index.vue

@@ -120,7 +120,17 @@
           :counts="true"
           @queryTable="pageList"
         ></right-toolbar> -->
+        <el-radio-group
+          style="float: right; margin-right: 100px"
+          v-model="queryParams.status"
+          @change="orderStartChange"
+          size="mini">
+<!--        未提交/和待出库  -->
+          <el-radio-button :label="100">未完成</el-radio-button>
+          <el-radio-button :label="200">已完成</el-radio-button>
+        </el-radio-group>
       </el-row>
+
       <el-table
         v-loading="loading"
         :data="tableList"
@@ -916,6 +926,7 @@ export default {
         orderByColumn: "", // 根据某列排序
         isAsc: "", // desc(降序)或 asc(升序)
         saleOrderOrderType: "",
+        status:100,//订单是否已完成/为完成
         // 基本查询参数
         basicMap: {
           tableName: "drag_form",
@@ -997,6 +1008,9 @@ export default {
     }),
   },
   methods: {
+    orderStartChange(status) {
+      this.getList(false,status );
+    },
     // 出库单回调
     async myPrintOutBoundHandler(row) {
       console.log("row", row);
@@ -1054,15 +1068,15 @@ export default {
       }
     },
 
-    // 出库单回调
-    async myPrintOutBoundHandler(row, data) {
-      console.log("row", row);
-      this.currentRow = row;
-      this.outBoundShow = true;
-      this.$nextTick(() => {
-        this.$refs.outBoundRef.getTableData(row);
-      });
-    },
+    // // 出库单回调
+    // async myPrintOutBoundHandler(row, data) {
+    //   console.log("row", row);
+    //   this.currentRow = row;
+    //   this.outBoundShow = true;
+    //   this.$nextTick(() => {
+    //     this.$refs.outBoundRef.getTableData(row);
+    //   });
+    // },
     // 出库单打印回调
     async outBoundPrintHandler() {
       let res = await this.$refs.outBoundRef.getPrintData();
@@ -1093,10 +1107,7 @@ export default {
       )?.productType;
       this.productionOptions = this.allProductionOptions.slice(0, 500);
     },
-    // 订单类型改变回调
-    orderTypeChange(type) {
-      this.getList(false, type);
-    },
+
     // 重置审计表单数据
     resetFormData() {
       Object.assign(this.formData, {