sakura 1 рік тому
батько
коміт
6a73eb46d4

+ 17 - 0
manager-admin/src/api/goodsExchange.js

@@ -264,3 +264,20 @@ export function editWarehouseOut(id, parmas) {
   })
 }
 
+/* 扫条形码 /admin/erp/scancode/getProduct/{warehouseId}/{productCode}*/
+
+export function getProduct(warehouseId,productCode) {
+  return request({
+    url: `/admin/erp/scancode/getProduct/${warehouseId}/${productCode}`,
+    method: 'get',
+    loaidng: false
+  })
+}
+/* 扫序列号 /admin/erp/scancode/getsnCode/{sku}/{snCode} */
+export function getSnCode(type,sku,snCode) {
+  return request({
+    url: `/admin/erp/scancode/getsnCode/${type}/${sku}/${snCode}`,
+    method: 'get',
+    loaidng: false
+  })
+}

+ 115 - 72
manager-admin/src/views/setting/serialList.vue

@@ -1,6 +1,10 @@
 <template>
   <div>
-    <en-table-layout :tableData="tableData.data" :loading="loading" @selection-change="handleSelectionChange">
+    <en-table-layout
+      :tableData="tableData.data"
+      :loading="loading"
+      @selection-change="handleSelectionChange"
+    >
       <div slot="toolbar" class="inner-toolbar">
         <div class="toolbar-btns">
           <el-button
@@ -10,7 +14,7 @@
             @click="handleAddWarehouse"
             >新增</el-button
           >
-         <!--  <el-button
+          <!--  <el-button
             size="mini"
             type="delect"
             :disabled="multipleSelection.length === 0"
@@ -25,7 +29,7 @@
             >批量打印</el-button
           >
         </div>
-        <div class="toolbar-search" style="display:flex;align-items: center;">
+        <div class="toolbar-search" style="display: flex; align-items: center">
           <span>商品编号/条码:</span>
           <en-table-search
             @search="searchEvent"
@@ -40,6 +44,8 @@
         <el-table-column prop="goods_vo.name" label="商品名称" />
         <el-table-column prop="product_vo.spec_name" label="规格型号" />
         <el-table-column prop="sn_code" label="序列号" />
+        <el-table-column prop="out_house_id" label="出库单编号" />
+        <el-table-column prop="entry_house_id" label="入库单编号" />
         <el-table-column label="操作" width="260">
           <template slot-scope="scope">
             <el-button
@@ -55,7 +61,9 @@
               @click="handleDeleteWarehouse(scope.$index, scope.row)"
               >删除</el-button
             > -->
-            <el-button size="mini" @click="PrintIng(scope.row)">打印序列号</el-button>
+            <el-button size="mini" @click="PrintIng(scope.row)"
+              >打印序列号</el-button
+            >
           </template>
         </el-table-column>
       </template>
@@ -89,18 +97,33 @@
         <el-button>搜索</el-button>
       </div>
       <div class="center">
-        <el-table :data="snTableData" border ref="table" style="width: 100%" @selection-change="snHandleSelectionChange">
+        <el-table
+          :data="snTableData"
+          border
+          ref="table"
+          style="width: 100%"
+          @selection-change="snHandleSelectionChange"
+        >
           <el-table-column type="selection" width="55" />
           <el-table-column prop="goods_vo.sn" label="商品编号">
           </el-table-column>
           <el-table-column prop="goods_vo.name" label="商品名称" />
-          <el-table-column prop="bar_code" label="商品条码" v-if="title!=='查看序列号'">
+          <el-table-column
+            prop="bar_code"
+            label="商品条码"
+            v-if="title !== '查看序列号'"
+          >
           </el-table-column>
           <el-table-column prop="product_vo.bar_code" label="商品条码" v-else>
           </el-table-column>
-          <el-table-column prop="spec_name" label="规格型号" v-if="title!=='查看序列号'"> </el-table-column>
-          <el-table-column prop="product_vo.spec_name" label="规格型号" v-else> </el-table-column>
-
+          <el-table-column
+            prop="spec_name"
+            label="规格型号"
+            v-if="title !== '查看序列号'"
+          >
+          </el-table-column>
+          <el-table-column prop="product_vo.spec_name" label="规格型号" v-else>
+          </el-table-column>
         </el-table>
       </div>
       <!-- <el-form :model="stockForm" :rules="stockRules" ref="stockForm" label-width="120px">
@@ -118,23 +141,45 @@
         </el-form-item>
       </el-form> -->
       <div class="dialog-footer">
-        <el-input :disabled="title=='查看序列号'" v-model="stockForm.qty" placeholder="请输入要生成序列号的数量"></el-input>
-        <el-button :disabled="title=='查看序列号'" @click="saveQ">生成</el-button>
+        <el-input
+          :disabled="title == '查看序列号'"
+          v-model="stockForm.qty"
+          placeholder="请输入要生成序列号的数量"
+        ></el-input>
+        <el-button :disabled="title == '查看序列号'" @click="saveQ"
+          >生成</el-button
+        >
         <!-- <el-button @click="dialogVisible = false">取 消</el-button>
         <el-button type="primary" @click="submitWarehouseForm">确 定</el-button> -->
       </div>
       <div class="info">
-          <p>生成规则:序号号=商品编号+4位规格编码+当前生成时间+4位自然序号</p>
-          <p>注意:如果没有规格的商品默认规格编码就是0000,单次生成数量不得超过9999</p>
+        <p>生成规则:序号号=商品编号+4位规格编码+当前生成时间+4位自然序号</p>
+        <p>
+          注意:如果没有规格的商品默认规格编码就是0000,单次生成数量不得超过9999
+        </p>
       </div>
     </el-dialog>
-    <el-dialog title="打印预览" :visible.sync="PrintVisible" width="940px" center @close='handleCancle'>
-      <el-button size="mini" type="primary" @click="handlePrintGoodsLend" class="print">打印</el-button>
-      <div id="deliverySheet" style="width:900px">
-        <div class="tips-t" v-for="(item,index) in codeList" :key="index">
+    <el-dialog
+      title="打印预览"
+      :visible.sync="PrintVisible"
+      width="940px"
+      center
+      @close="handleCancle"
+    >
+      <el-button
+        size="mini"
+        type="primary"
+        @click="handlePrintGoodsLend"
+        class="print"
+        >打印</el-button
+      >
+      <div id="deliverySheet" style="width: 900px">
+        <div class="tips-t" v-for="(item, index) in codeList" :key="index">
           <div>
             <!-- <div class="qrcode-pic" ref="codeItem" ></div> -->
-            <div style="margin-top: 10px;  font-size: 20px; text-align: center;">{{ item }}</div>
+            <div style="margin-top: 10px; font-size: 20px; text-align: center">
+              {{ item }}
+            </div>
           </div>
         </div>
       </div>
@@ -148,7 +193,7 @@ import * as API_Setting from "@/api/setting";
 import * as API_Auth from "@/api/auth";
 import { Foundation } from "~/ui-utils";
 import { mapGetters } from "vuex";
-import Print from 'print-js'
+import Print from "print-js";
 export default {
   name: "warehouse",
   data() {
@@ -167,7 +212,7 @@ export default {
       tableData: "",
       // 仓库表单
       stockForm: {
-        qty:0
+        qty: 0,
       },
       // 仓库表单 规则
       stockRules: {
@@ -178,14 +223,14 @@ export default {
       },
       // 仓库表单 dialog
       dialogVisible: false,
-      snTableData:[],
+      snTableData: [],
       // 当前已选择的行
       multipleSelection: [],
-      PrintVisible:false,
-      codeList:[],
+      PrintVisible: false,
+      codeList: [],
       // 新增窗口选中的值
-      snMultipleSelection:[],
-      title:''
+      snMultipleSelection: [],
+      title: "",
     };
   },
   mounted() {
@@ -198,11 +243,11 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
-    close(){
-      this.dialogVisible = false
-        this.snTableData=[]
+    close() {
+      this.dialogVisible = false;
+      this.snTableData = [];
     },
-    snHandleSelectionChange(val){
+    snHandleSelectionChange(val) {
       if (val.length > 1) {
         // 如果当前选中数量超过1,移除先前选中的,保留最后选中的
         const lastSelected = val[val.length - 1];
@@ -212,32 +257,32 @@ export default {
       this.snMultipleSelection = val; // 更新当前选中的行
     },
     // 批量打印
-    batchPrint(){
+    batchPrint() {
       const ids = this.multipleSelection.map((item) => item.sn_code);
-      this.codeList=ids
-      this.PrintVisible=true
+      this.codeList = ids;
+      this.PrintVisible = true;
     },
     /** 打印对账详情 */
     handlePrintGoodsLend() {
       Print({
-        printable: 'deliverySheet',
-        type: 'html',
-        targetStyles: ['*'],
-        ignoreElements: ['no-logs', 'goods-image', 'no-btn']
-      })
+        printable: "deliverySheet",
+        type: "html",
+        targetStyles: ["*"],
+        ignoreElements: ["no-logs", "goods-image", "no-btn"],
+      });
     },
-    handleCancle () {
-      this.dialogVisible = false
-      this.codeList=[]
+    handleCancle() {
+      this.dialogVisible = false;
+      this.codeList = [];
     },
     // 打印
-    PrintIng(row){
-      this.PrintVisible=true
-      this.codeList.push(row.sn_code)
+    PrintIng(row) {
+      this.PrintVisible = true;
+      this.codeList.push(row.sn_code);
     },
     // 删除
-    handleDelectWarehous(){
-     /*  if (!this.multipleSelection || !this.multipleSelection.length)
+    handleDelectWarehous() {
+      /*  if (!this.multipleSelection || !this.multipleSelection.length)
         return this.$message.error("请先选择!");
       this.$confirm("确定要删除这些吗?", "提示", { type: "warning" })
         .then(() => {
@@ -249,21 +294,21 @@ export default {
         })
         .catch(() => {}); */
     },
-     /** 多选改变 */
-     handleSelectionChange(val) {
+    /** 多选改变 */
+    handleSelectionChange(val) {
       this.multipleSelection = val;
     },
     // 生成序列号
-    saveQ(){
+    saveQ() {
       // if (!this.snMultipleSelection || !this.snMultipleSelection.length)
-        API_Setting.addCreateSnCode({product_id:this.snMultipleSelection[0].id,
-          num:Number(this.stockForm.qty)}).then(res=>{
-            this.dialogVisible = false
-            this.snTableData=[]
-            this.GET_WarehouseList();
-        })
-
-
+      API_Setting.addCreateSnCode({
+        product_id: this.snMultipleSelection[0].id,
+        num: Number(this.stockForm.qty),
+      }).then((res) => {
+        this.dialogVisible = false;
+        this.snTableData = [];
+        this.GET_WarehouseList();
+      });
     },
     /** 获取人员列表 */
     GET_AdministratorList() {
@@ -305,25 +350,24 @@ export default {
         dept_id: 0,
         admin_id: this.user.uid,
       }; */
-      this.title='新增序列号'
-      API_Setting.getSnProduct().then(res=>{
+      this.title = "新增序列号";
+      API_Setting.getSnProduct().then((res) => {
         console.log(res);
-         this.snTableData=res.records//this.tableData.data
-         this.dialogVisible = true;
-      })
-
+        this.snTableData = res.records; //this.tableData.data
+        this.dialogVisible = true;
+      });
     },
 
     /** 编辑仓库 */
     handleEditWarehouse(index, row) {
-      this.title='查看序列号'
-      this.snTableData.push(row)
+      this.title = "查看序列号";
+      this.snTableData.push(row);
       this.dialogVisible = true;
     },
 
     /** 删除 */
     handleDeleteWarehouse(index, row) {
-     /*  this.$confirm("确定要删除这个仓库吗?", "提示", { type: "warning" })
+      /*  this.$confirm("确定要删除这个仓库吗?", "提示", { type: "warning" })
         .then(() => {
           API_Setting.deleteSn(row.id).then(() => {
             this.$message.success("删除成功!");
@@ -408,27 +452,26 @@ export default {
 /deep/ .el-dialog__body {
   padding: 10px 20px;
 }
-.header{
+.header {
   display: flex;
   justify-content: flex-start;
-    align-items: center;
-  .el-input{
+  align-items: center;
+  .el-input {
     width: 200px;
     margin: 15px;
   }
-
 }
-.dialog-footer{
+.dialog-footer {
   margin-top: 30px;
   margin-bottom: 20px;
   display: flex;
   justify-content: center;
-  .el-input{
+  .el-input {
     width: 200px;
     margin-right: 15px;
   }
 }
-.info{
+.info {
   text-align: center;
   color: #aaaaaa;
 }

+ 63 - 18
manager-admin/src/views/stock/goodsExchange/addInventory.vue

@@ -116,10 +116,11 @@
                 <span v-else>{{ scope.row.bar_code }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="序列号">
+            <el-table-column label="序列号" >
               <template slot-scope="scope">
-                <span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
-                <span v-else>{{ scope.row.sn_code }}</span>
+                <span >{{scope.row}}</span>
+                <!-- <span v-if="id">{{ scope.row.product_vo.sn_code }}</span>
+                <span v-else>{{ scope.row.sn_code }}</span> -->
               </template>
             </el-table-column>
             <el-table-column prop="product_vo.spec_name" label="规格型号" v-if="id">
@@ -152,21 +153,27 @@
                 ></el-input-number>
               </template>
             </el-table-column>
-            <!-- <el-table-column label="库存数量">
+           <!--  <el-table-column label="库存数量">
               <template slot-scope="scope">
                 {{ scope.row.usable_stock }}
               </template>
-            </el-table-column>
+            </el-table-column>-->
             <el-table-column label="差异">
               <template slot-scope="scope">
-                {{ scope.row.num - scope.row.usable_stock || 0 }}
+                {{ scope.row.num - sn_code_list.length || 0 }}
               </template>
-            </el-table-column> -->
+            </el-table-column>
             <el-table-column
+            width="200"
               label="操作"
               v-if="type !== 'detail' && type !== 'audit'"
             >
               <template slot-scope="scope">
+                <el-button
+                  size="mini"
+                  @click="addSnCode(scope.row,scope.$index)"
+                  >添加序列号</el-button
+                >
                 <el-button
                   size="mini"
                   type="danger"
@@ -175,6 +182,7 @@
                   "
                   >删除</el-button
                 >
+
               </template>
             </el-table-column>
           </el-table>
@@ -226,7 +234,7 @@
         >
       </span>
     </el-dialog>
-    <el-dialog title="扫码入库" :visible.sync="scanDialogVisible" width="30%">
+    <el-dialog title="扫码入库" :visible.sync="scanDialogVisible" width="30%" :close-on-press-escape="false" :close-on-click-modal="false">
       <el-form
         ref="scanGoodsForm"
         :model="scanGoodsForm"
@@ -243,18 +251,14 @@
             :maxlength="100"
           ></el-input>
         </el-form-item>
-        <el-form-item label="序列号" prop="sn_code">
+        <!-- <el-form-item label="序列号" prop="sn_code">
           <el-input
             v-model="scanGoodsForm.sn_code"
             :minlength="0"
             :maxlength="100"
           ></el-input>
-        </el-form-item>
+        </el-form-item> -->
       </el-form>
-      <span slot="footer" class="dialog-footer">
-        <!-- <el-button @click="dialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="handleRejectGoodsExchange()">确 定</el-button> -->
-      </span>
     </el-dialog>
     <el-dialog
       title="入库商品"
@@ -375,6 +379,23 @@
         <el-button type="primary">确 定</el-button>
       </span>
     </el-dialog>
+    <el-dialog title="序列号" :visible.sync="snCodeVisible" width="30%" :close-on-press-escape="false" :close-on-click-modal="false">
+      <el-form
+        ref="scanGoodsForm"
+        :model="scanGoodsForm"
+        label-width="120px"
+        inline
+      >
+        <el-form-item label="序列号" prop="sn_code">
+          <el-input
+            v-model="sn_code"
+            @keyup.enter.native="toSnCode()"
+            :minlength="0"
+            :maxlength="100"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
   </div>
 </template>
 
@@ -527,6 +548,11 @@ export default {
           name: "门店自提",
         },
       ],
+      snCodeVisible:false,
+      sn_code:'',
+      sku:'',
+      sn_code_list:[],
+      index:''
     };
   },
   mounted() {
@@ -581,6 +607,20 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
+    //扫序列号goodsExchangeAddForm.product_list[this.index].sn_code_list
+    toSnCode(){
+      API_GoodsExchange.getSnCode('in',this.sku,this.sn_code).then(res=>{
+        this.sn_code_list.push(res)
+        this.sn_code=''
+        this.snCodeVisible=false
+      })
+      this.goodsExchangeAddForm.product_list[this.index].sn_code_list=this.sn_code_list
+    },
+    addSnCode(row,index){
+     this.sku=row.product_vo.sku
+     this.index=index
+      this.snCodeVisible=true
+    },
     orderBtn() {
       API_order.getOrderList(this.params).then((res) => {
         this.orderList = res;
@@ -745,15 +785,20 @@ export default {
     },
     // 打印功能
     printIng() {},
+    /* 扫条码 */
     toSearch() {
-      API_GoodsExchange.getGoodsInfo({
-        barcode: this.scanGoodsForm.bar_code,
-      }).then((res) => {
-        console.log(res);
+     API_GoodsExchange.getProduct(this.goodsExchangeAddForm.warehouse_id,this.scanGoodsForm.bar_code).then((res) => {
+        this.goodsExchangeAddForm.product_list.push(res)
+        this.scanGoodsForm.bar_code=''
+        this.scanDialogVisible = false;
       });
     },
     // 扫码入库
     scanCode() {
+      if (!this.goodsExchangeAddForm.warehouse_id) {
+        this.$message.error("请先选择仓库!");
+        return;
+      }
       this.scanDialogVisible = true;
       this.$nextTick(() => {
         this.$refs.input.focus();