Răsfoiți Sursa

入库单入库调整

yangg 1 an în urmă
părinte
comite
76affc6345
1 a modificat fișierele cu 25 adăugiri și 12 ștergeri
  1. 25 12
      src/views/InoutStorage/inStorage.vue

+ 25 - 12
src/views/InoutStorage/inStorage.vue

@@ -29,22 +29,24 @@
             <el-table :data="goodsExchangeAddForm.product_list" style="width: 100%">
                 <el-table-column prop="goods_vo.name" label="商品名称" />
                 <el-table-column prop="product_vo.sku" label="SKU" />
-                <el-table-column prop="num" label="入库数量" >
+                <el-table-column prop="num" label="入库数量">
                     <template #default="scope">
-                            <span :style="{ color: scope.row.num > 0 ? 'red' : 'black' }">
-                                {{ scope.row.num }}
-                            </span>
-                        </template>
+                        <span :style="{ color: scope.row.num > 0 ? 'red' : 'black' }">
+                            {{ scope.row.num }}
+                        </span>
+                    </template>
                 </el-table-column>
-                <el-table-column prop="orderNum"  label="待入库数量" />
+                <el-table-column prop="orderNum" label="待入库数量" />
             </el-table>
         </el-form>
         <el-dialog v-model="dialogVisible" :modal=false title="扫码入库" :close-on-click-modal="false" top="80px"
             width="90%" style="height: 200px" :before-close="handleClose">
             <el-form :model="snCodeForm" label-width="auto" style="max-width: 600px">
                 <el-form-item label="SKU">
-                    <el-input v-model="snCodeForm.bar_code" ref="inputRef" clearable :inputmode="inputmode" @keyup.enter="toSearch()">
-                        <template #append> <img src="../../assets/images/JP.png" @click="getInfo" class="w-8 h-8" /> </template>
+                    <el-input v-model="snCodeForm.bar_code" ref="inputRef" clearable :inputmode="inputmode"
+                        @keyup.enter="toSearch()">
+                        <template #append> <img src="../../assets/images/JP.png" @click="getInfo" class="w-8 h-8" />
+                        </template>
                     </el-input>
                 </el-form-item>
                 <el-form-item label="序列号">
@@ -158,7 +160,12 @@ const toSearch = async () => {
         // 如果商品不存在,则添加到列表
         if (indexs === -1) {
             index.value = goodsExchangeAddForm.product_list.length;
-            goodsExchangeAddForm.product_list.push(res.data);
+            if (goodsExchangeAddForm.value.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.value.type == 'HAIL_ENTRY' || goodsExchangeAddForm.value.type == 'SALE_AFTER') {
+                goodsExchangeAddForm.product_list.push(res.data);
+            } else {
+                ElMessage.warning("请扫描订单内的商品!")
+            }
+            
         } else {
             index.value = indexs;
         }
@@ -167,7 +174,10 @@ const toSearch = async () => {
                 snInputRef.value.focus();
             });
         } else {
-            if (goodsExchangeAddForm.value.order_item_vos[index.value].num >= goodsExchangeAddForm.value.order_item_vos[index.value].orderNum) return ElMessage.warning('待入库数量不能大于入库数量!')
+            if (goodsExchangeAddForm.value.product_list[index.value].num >= goodsExchangeAddForm.value.product_list[index.value].orderNum) return ElMessage.warning('待入库数量不能大于入库数量!')
+            if (goodsExchangeAddForm.value.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.value.type == 'HAIL_ENTRY' || goodsExchangeAddForm.value.type == 'SALE_AFTER') {
+                if (goodsExchangeAddForm.value.product_list[index.value].num >= goodsExchangeAddForm.value.product_list[index.value].not_entry_num) return ElMessage.warning("录入数量大于未入库数量!")
+            }
             goodsExchangeAddForm.product_list[index.value].num += 1
             /* this.scanDialogVisible = false; */
         }
@@ -177,7 +187,7 @@ const toSearch = async () => {
 };
 //扫描序列号
 const toSnCode = async () => {
-    if(!sku.value) return  ElMessage.error('请先扫描sku!')
+    if (!sku.value) return ElMessage.error('请先扫描sku!')
     try {
         const res: any = await orderApi.getsnCode(
             "in",
@@ -196,6 +206,9 @@ const toSnCode = async () => {
                 goodsExchangeAddForm.product_list[index.value].sn_code_list.push(res.data);
             })
         }
+        if (goodsExchangeAddForm.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.type == 'HAIL_ENTRY' || goodsExchangeAddForm.type == 'SALE_AFTER') {
+           if(goodsExchangeAddForm.product_list[index.value].num >=goodsExchangeAddForm.product_list[index.value].not_entry_num) return ElMessage.warning("录入数量大于未入库数量!")
+          }
         goodsExchangeAddForm.product_list[index.value].num = goodsExchangeAddForm.product_list[index.value].sn_code_list.length;
         snCodeForm.bar_code = "";
         nextTick(() => {
@@ -235,7 +248,7 @@ const scanCode = () => {
                 setTimeout(() => {
                     if (inputRef.value) {
                         inputRef.value.select();
-                        inputmode.value='none'
+                        inputmode.value = 'none'
                     }
                 }, 100);
             } catch (error) {