Pārlūkot izejas kodu

1.出库逻辑修改,添加可以扫码载具。

jiaxiaoqiang 1 gadu atpakaļ
vecāks
revīzija
44fb13bca7

+ 1 - 1
src/views/pro-operation/call-materiel/desperse.vue

@@ -101,7 +101,7 @@ const clickItem = (box: any) => {
     sporadicCallItem({
       materials: [
         {
-          materialName: box.materialName,
+          materialName: box.materialCode,
           num: value,
         },
       ],

+ 49 - 18
src/views/storage-out/index.vue

@@ -67,13 +67,21 @@
         </el-button>
       </el-col>
       <el-col :span="6">
+        <ScanCodeInput
+          v-model="boxInputValue"
+          :clearable="true"
+          placeholder="请扫描或输入载具编号"
+          @keyup.enter="enterBoxInput"
+        />
+        <div class="boxHeader">载具名称:{{ toSendBoxInfo?.vehicleName }}</div>
+        <div class="boxHeader">载具编码:{{ toSendBoxInfo?.vehicleCode }}</div>
         <div class="type-title">请扫码物料</div>
         <ScanCodeInput
           v-model="scanCodeInput"
           placeholder="请扫描或输入物料编码"
           @keyup.enter="handleScanCodeInput"
         />
-        <el-scrollbar class="base-container">
+        <el-scrollbar style="height: calc(100vh - 535px); margin-top: 10px">
           <div class="list-container">
             <div
               v-for="(item, index) in materialList"
@@ -97,9 +105,9 @@
             </div>
           </div>
         </el-scrollbar>
-        <!--        <el-button class="sureBtn" type="primary" @click="sureToAdd"-->
-        <!--          >确认添加-->
-        <!--        </el-button>-->
+        <el-button class="sureBtn" type="primary" @click="sureToAdd"
+          >确认添加
+        </el-button>
       </el-col>
       <el-col :span="6">
         <div class="type-title">流转终点</div>
@@ -128,6 +136,7 @@
 //料箱
 import {
   addMaterialFlow,
+  getBoxDetailByLabel,
   getDestinationList,
   getMaterialInfoByLabel,
 } from "@/api/process/materialFlow";
@@ -182,7 +191,10 @@ const checkHasOuting = () => {
           if (res.data) {
             if (res.data.state === 3 || res.data.state === 4) {
               clearInterval(outInterval);
+              commonS.orderId = -1;
+
               outingBox.value = { ...res.data };
+              toSendBoxInfo.value = { ...outingBox.value }; //默认派发出库的盒子,如果返库了,扫码物料上方的载具信息则需要重新获取
               // 同时也刷新左侧列表数据
               getStorageBoxesList({}).then((res: any) => {
                 boxesList.value = res.data;
@@ -192,6 +204,9 @@ const checkHasOuting = () => {
                 outingRawBoxList = JSON.parse(
                   JSON.stringify(outingBox.value.detailsList)
                 );
+                materialList.value = JSON.parse(
+                  JSON.stringify(outingBox.value.detailsList)
+                );
               } else {
                 outingRawBoxList = [];
                 outingMaterials.value = [];
@@ -216,6 +231,7 @@ const backToStorage = async () => {
     detailsList: outingMaterials.value,
   });
   outingBox.value = {};
+  toSendBoxInfo.value = {};
   outingMaterials.value = [];
   ElMessage.success("返库成功");
   currentBox.value = {};
@@ -227,9 +243,18 @@ const backToStorage = async () => {
 };
 
 // 物料
+const toSendBoxInfo = ref<any>({}); //扫码物料上方的载具信息,默认是出库的减料位的盒子,也可以通过扫码获取新的盒子
 const scanCodeInput = ref("");
 const materialList = ref<any[]>([]);
 
+const boxInputValue = ref("");
+const enterBoxInput = () => {
+  currentBox.value = currentBox.value.trim();
+  getBoxDetailByLabel(currentBox.value).then((res: any) => {
+    toSendBoxInfo.value = res.data;
+  });
+};
+
 const handleScanCodeInput = () => {
   getMaterialInfoByLabel(scanCodeInput.value).then((res: any) => {
     // 扫描之后要先查看数组中是否有这个物料,有的话就数量相加,没有的话就添加到数组中
@@ -237,9 +262,12 @@ const handleScanCodeInput = () => {
     for (let i = 0; i < materialList.value.length; i++) {
       let currentMaterial = materialList.value[i];
       if (currentMaterial.materialCode === res.data.materialCode) {
-        materialList.value[i].num += res.data.num;
         hasMaterial = true;
-        break;
+        // SEQ/BATCH 如果是流转卡号数量只能唯1,序列号相加
+        if (currentMaterial.codeType === "BATCH") {
+          materialList.value[i].num += res.data.num;
+          break;
+        }
       }
     }
     !hasMaterial && materialList.value.push(res.data);
@@ -308,17 +336,20 @@ const createTask = () => {
 
   addMaterialFlow(params).then((res: any) => {
     ElMessage.success(res.msg ?? "派发成功");
-    currentBox.value = {};
-    currentBoxIndex.value = -1;
-    boxSearch.value = "";
-    outingBox.value = {};
-    outingMaterials.value = [];
+    // currentBox.value = {};
+    // currentBoxIndex.value = -1;
+    // boxSearch.value = "";
+    // outingBox.value = {};
+    // outingMaterials.value = [];
     materialList.value = [];
     currentDestination.value = {};
     currentDestinationIndex.value = -1;
-    commonS.orderId = -1;
   });
 };
+
+onBeforeUnmount(() => {
+  clearInterval(outInterval);
+});
 </script>
 
 <style lang="scss" scoped>
@@ -362,15 +393,15 @@ const createTask = () => {
   }
 }
 
+.boxHeader {
+  font-weight: bolder;
+  font-size: 24px;
+  text-align: left;
+}
+
 .outing-container {
   height: calc(100vh - 354px);
 
-  .boxHeader {
-    font-weight: bolder;
-    font-size: 24px;
-    text-align: left;
-  }
-
   .outing-box {
     background: #fff;
     border-radius: 16px;