Browse Source

1.物料流转bug。2.登录保存产线id。3. 出库。4.打包配置修改。

jiaxiaoqiang 1 year ago
parent
commit
b702de2b9c

+ 2 - 2
package.json

@@ -6,8 +6,8 @@
   "scripts": {
     "preinstall": "npx only-allow pnpm",
     "dev": "vite serve --mode development",
-    "build:test": "vite build --mode test && vue-tsc --noEmit",
-    "build": "vite build --mode production && vue-tsc --noEmit",
+    "build:test": "vite build --mode test",
+    "build": "vite build --mode production",
     "lint:eslint": "eslint  --fix --ext .ts,.js,.vue ./src ",
     "lint:prettier": "prettier --write \"**/*.{js,cjs,ts,json,tsx,css,less,scss,vue,html,md}\"",
     "lint:stylelint": "stylelint  \"**/*.{css,scss,vue}\" --fix",

+ 2 - 2
src/api/process/materialFlow.ts

@@ -1,9 +1,9 @@
 import request from "@/utils/request";
 
 // 获取物料流转终点,有仓库,也有工位
-export function getDestinationList() {
+export function getDestinationList(withStore: number) {
   return request({
-    url: `/api/v1/process/circulation/target`,
+    url: `/api/v1/process/circulation/target/${withStore}`,
     method: "get",
   });
 }

+ 1 - 0
src/api/user/types.ts

@@ -3,6 +3,7 @@
  */
 export interface UserInfo {
   userId?: number;
+  proCode?: string; //产线
   station?: string; //工位
   username?: string;
   nickname?: string;

+ 2 - 1
src/views/login/index.vue

@@ -279,7 +279,8 @@ function handleLogin() {
         .login(loginData.value)
         .then(() => {
           userStore.user.station = stationName;
-          console.log("stationType", stationType);
+          userStore.user.proCode = loginData.value.proCode;
+
           // 捡选 装配 测试 维修站 预齐套
           if (stationType == "1") {
             router.replace({ name: "StorageMain" });

+ 33 - 31
src/views/material-flow/creatTask.vue

@@ -48,36 +48,38 @@
       <el-col :span="8">
         <div class="type-title">流转终点</div>
         <div class="destination">
-          <div
-            v-for="(item, index) in destinationList"
-            :key="index"
-            :class="{ selected: index === currentDestinationIndex }"
-            class="end-box"
-            @click="onEndBoxClick(index, item)"
-          >
-            <div class="name">{{ item.name }}</div>
-            <!--            <div-->
-            <!--              v-if="-->
-            <!--                item.targetType === 'stock' && index === currentDestinationIndex-->
-            <!--              "-->
-            <!--            >-->
-            <!--              <el-select-->
-            <!--                v-model="selectStore"-->
-            <!--                filterable-->
-            <!--                placeholder="请选择"-->
-            <!--                size="large"-->
-            <!--                style="width: 200px"-->
-            <!--                value-key="id"-->
-            <!--              >-->
-            <!--                <el-option-->
-            <!--                  v-for="store in storeMap.get(item.houseNo)"-->
-            <!--                  :key="store.id"-->
-            <!--                  :label="store.name"-->
-            <!--                  :value="store"-->
-            <!--                />-->
-            <!--              </el-select>-->
-            <!--            </div>-->
-          </div>
+          <el-scrollbar>
+            <div
+              v-for="(item, index) in destinationList"
+              :key="index"
+              :class="{ selected: index === currentDestinationIndex }"
+              class="end-box"
+              @click="onEndBoxClick(index, item)"
+            >
+              <div class="name">{{ item.name }}</div>
+              <!--            <div-->
+              <!--              v-if="-->
+              <!--                item.targetType === 'stock' && index === currentDestinationIndex-->
+              <!--              "-->
+              <!--            >-->
+              <!--              <el-select-->
+              <!--                v-model="selectStore"-->
+              <!--                filterable-->
+              <!--                placeholder="请选择"-->
+              <!--                size="large"-->
+              <!--                style="width: 200px"-->
+              <!--                value-key="id"-->
+              <!--              >-->
+              <!--                <el-option-->
+              <!--                  v-for="store in storeMap.get(item.houseNo)"-->
+              <!--                  :key="store.id"-->
+              <!--                  :label="store.name"-->
+              <!--                  :value="store"-->
+              <!--                />-->
+              <!--              </el-select>-->
+              <!--            </div>-->
+            </div>
+          </el-scrollbar>
         </div>
         <el-button class="sureBtn" type="primary" @click="createTask"
           >创建任务
@@ -150,7 +152,7 @@ const onEndBoxClick = (index: number, item: any) => {
 
 onMounted(() => {
   let wm = new WeakMap();
-  getDestinationList().then((res) => {
+  getDestinationList(1).then((res) => {
     console.log("destinationList", res);
     destinationList.value = res.data;
   });

+ 35 - 51
src/views/storage-out/index.vue

@@ -96,39 +96,20 @@
       <el-col :span="6">
         <div class="type-title">流转终点</div>
         <div class="destination">
-          <div
-            v-for="(item, index) in destinationList"
-            :key="index"
-            :class="{ selected: index === currentDestinationIndex }"
-            class="end-box"
-            @click="onEndBoxClick(index, item)"
-          >
-            <div class="name">{{ item.name }}</div>
-            <!--            <div-->
-            <!--              v-if="-->
-            <!--                item.targetType === 'stock' && index === currentDestinationIndex-->
-            <!--              "-->
-            <!--            >-->
-            <!--              <el-select-->
-            <!--                v-model="selectStore"-->
-            <!--                filterable-->
-            <!--                placeholder="请选择"-->
-            <!--                size="large"-->
-            <!--                style="width: 200px"-->
-            <!--                value-key="id"-->
-            <!--              >-->
-            <!--                <el-option-->
-            <!--                  v-for="store in storeMap.get(item.houseNo)"-->
-            <!--                  :key="store.id"-->
-            <!--                  :label="store.name"-->
-            <!--                  :value="store"-->
-            <!--                />-->
-            <!--              </el-select>-->
-            <!--            </div>-->
-          </div>
+          <el-scrollbar>
+            <div
+              v-for="(item, index) in destinationList"
+              :key="index"
+              :class="{ selected: index === currentDestinationIndex }"
+              class="end-box"
+              @click="onEndBoxClick(index, item)"
+            >
+              <div class="name">{{ item.name }}</div>
+            </div>
+          </el-scrollbar>
         </div>
         <el-button class="sureBtn" type="primary" @click="createTask"
-          >创建任务
+          >派发
         </el-button>
       </el-col>
     </el-row>
@@ -138,6 +119,7 @@
 <script lang="ts" setup>
 //料箱
 import {
+  addMaterialFlow,
   getDestinationList,
   getMaterialInfoByLabel,
 } from "@/api/process/materialFlow";
@@ -240,29 +222,19 @@ const sureToAdd = () => {
     }
   }
 };
-// 流转终点
+// 出库终点
 const destinationList = ref<any>();
 const currentDestination = ref<any>({});
 const currentDestinationIndex = ref(-1);
-const storeMap = new Map<string, Array<any>>();
-const selectStore = ref<any>({});
+
 const onEndBoxClick = (index: number, item: any) => {
   currentDestination.value = item;
   currentDestinationIndex.value = index;
-  // 如果是仓库,会根据仓库的no获取仓储的列表,存入map, 如果已经有数据了则不需要再次请求接口
-  // if (item.targetType === "stock") {
-  //   if (!storeMap.has(item.houseNo)) {
-  //     getStoreListByNo(item.houseNo).then((res) => {
-  //       storeMap.set(item.houseNo, res.data || []);
-  //     });
-  //   }
-  // }
 };
 
 onMounted(() => {
   let wm = new WeakMap();
-  getDestinationList().then((res) => {
-    console.log("destinationList", res);
+  getDestinationList(0).then((res) => {
     destinationList.value = res.data;
   });
   getStorageBoxesList({}).then((res) => {
@@ -274,14 +246,26 @@ const createTask = () => {
   const params = {
     circulationDetail: [...materialList.value],
     // coordinate: "",
-    houseNo: "",
+    houseNo: outingBox.value.houseNo,
     // locationNo: "",
-    stationId: 0,
-    targetType: "",
-    vehicleCode: "",
-    vehicleId: 0,
-    vehicleName: "",
+    stationId: currentDestination.value.id,
+    targetType: currentDestination.value.targetType,
+    vehicleCode: outingBox.value.vehicleNo,
+    vehicleId: outingBox.value.id,
+    vehicleName: outingBox.value.name,
   };
+
+  addMaterialFlow(params).then((res: any) => {
+    ElMessage.success(res.msg ?? "派发成功");
+    currentBox.value = {};
+    currentBoxIndex.value = -1;
+    boxSearch.value = "";
+    outingBox.value = {};
+    outingMaterials.value = [];
+    materialList.value = [];
+    currentDestination.value = {};
+    currentDestinationIndex.value = -1;
+  });
 };
 </script>
 
@@ -407,7 +391,7 @@ const createTask = () => {
 }
 
 .destination {
-  height: calc(100vh - 350px);
+  height: calc(100vh - 353px);
   margin-top: 15px;
 
   .end-box {