Browse Source

物料采集复制信息

dengrui 1 week ago
parent
commit
d842f2ccf9

+ 1 - 1
.env.development

@@ -11,7 +11,7 @@ VITE_APP_BASE_API = '/dev-api'
 VITE_APP_UPLOAD_URL = 'http://192.168.1.4:9000'
 
 # 开发接口地址
-VITE_APP_API_URL = 'http://113.44.0.55:8020'
+VITE_APP_API_URL = 'http://113.44.0.55:9999'
 # Websocket地址
 VITE_WEBSOCKET_URL = 'ws://192.168.101.178:8079'
 ``

+ 9 - 0
src/api/prosteps/wuliaocaiji.ts

@@ -44,3 +44,12 @@ export function getInfo(data: any) {
     data,
   });
 }
+
+//复制物料信息
+export function copyMaterials(data: any) {
+  return request({
+    url: `/api/v1/process/itemRecord/itemInfo/copy`,
+    method: "post",
+    data,
+  });
+}

+ 57 - 2
src/views/pro-steps/components/wuliaocaiji.vue

@@ -1,6 +1,11 @@
 <template>
   <div class="scanCode">
-    <ScanCodeInput v-model="scanCode" @keyup.enter="enterfnc" />
+    <ScanCodeInput
+      style="width: 60%"
+      v-model="scanCode"
+      @keyup.enter="enterfnc"
+    />
+    <el-button type="primary" @click="copyMaterial">复制</el-button>
   </div>
   <div v-if="opCompentDataList.length < 1" class="showCodeBody">
     <div class="codeBox">
@@ -39,6 +44,13 @@
         <div class="describe">还需采集</div>
       </div>
       <svg-icon class="svgStyle" icon-class="jiaobiao" size="25" />
+      <el-checkbox
+        class="checkboxStyle"
+        v-model="opCompentDataList[index].select"
+        @click.stop
+        label=""
+        size="large"
+      />
     </div>
   </div>
   <xiangqingPopUp
@@ -52,29 +64,34 @@
     :seqNo="scanCode"
     @submit="submit"
   />
+  <copyPopUp v-model="showCP" @submit="submitCopy" />
 </template>
 
 <script setup>
 import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
 import caijiRightPopUp from "../popUpView/caijiRightPopUp.vue";
 import xiangqingPopUp from "../popUpView/xiangqingPopUp.vue";
+import copyPopUp from "../popUpView/copyPopUp.vue";
 import {
   getInfo,
   itemRecordAdd,
   recordList,
   searchMaterial,
+  copyMaterials,
 } from "@/api/prosteps/wuliaocaiji";
 import { useProcessStore } from "@/store";
 
 defineOptions({
   name: "Wuliaocaiji",
 });
+
 const caijiRef = ref(null);
 const store = useProcessStore();
 const scanCode = ref("");
 const scanCodeCopyValue = ref("");
 const showXQ = ref(false);
 const showCJ = ref(false);
+const showCP = ref(false);
 //详情展示数据
 const showInfoData = ref([]);
 const showInfo = ref({});
@@ -98,6 +115,38 @@ const enterfnc = async () => {
     showCJ.value = true;
   }
 };
+const checkBoxMaterialCodesArray = computed(() => {
+  let array = ref([]);
+  opCompentDataList.value.forEach((element) => {
+    if (element.select) {
+      array.value.push(element.itemCode);
+    }
+  });
+  return array.value;
+});
+const copyMaterial = () => {
+  showCP.value = true;
+};
+const clearSelect = () => {
+  opCompentDataList.value.forEach((element) => {
+    element.select = false;
+  });
+};
+const submitCopy = async (seqList) => {
+  if (seqList && seqList.length > 0) {
+    const { code } = await copyMaterials({
+      processId: store.scanInfo.id,
+      materialCodes: checkBoxMaterialCodesArray.value,
+      seqList: seqList,
+    });
+    ElMessage.success("操作成功");
+    clearSelect();
+    showCP.value = false;
+  } else {
+    ElMessage.error("请选择流转卡号");
+    return;
+  }
+};
 const opCompentDataList = ref([]);
 provide("opCompentDataList", opCompentDataList);
 //通过id获取详情
@@ -160,6 +209,8 @@ onMounted(() => {
 .scanCode {
   width: 100%;
   margin-top: $p5;
+  display: flex;
+  justify-content: space-between;
 }
 
 .materialInfoBody {
@@ -199,7 +250,11 @@ onMounted(() => {
       bottom: 0;
       right: 0;
     }
-
+    .checkboxStyle {
+      position: absolute;
+      top: 0;
+      right: 8px;
+    }
     .describe {
       font-size: $f20;
       color: $font-default-60;

+ 8 - 6
src/views/pro-steps/popUpView/caijiRightPopUp.vue

@@ -16,7 +16,9 @@
             :key="index"
           >
             <div class="leftInfo">
-              <div class="titleText">{{ item.materialName }}({{item.spec}})</div>
+              <div class="titleText">
+                {{ item.materialName }}({{ item.spec }})
+              </div>
               <div class="describeText">{{ item.materialCode }}</div>
               <div class="describeText">批次号:</div>
               <template v-if="selectIndex == index">
@@ -52,7 +54,7 @@
   </div>
 </template>
 
-<script lang="ts" setup>
+<script setup>
 import {
   getInfo,
   itemRecordAdd,
@@ -66,7 +68,7 @@ const scanCodeCopyValue = ref("");
 const opCompentDataList = inject("opCompentDataList");
 //获取当前扫码总物料code code 以及是否数量满足 status
 const resArray = ref([]);
-const successStaus = (code: any) => {
+const successStaus = (code) => {
   let res = true;
   for (let i = 0; i < resArray.value.length; i++) {
     if (code == resArray.value[i].code) {
@@ -85,7 +87,7 @@ const getRes = () => {
       needNum: item.needNum,
     });
   });
-  console.log(resArray.value, 222);
+
   for (let i = 0; i < resArray.value.length; i++) {
     let num = 0;
     for (let j = 0; j < scanData.value.length; j++) {
@@ -93,7 +95,7 @@ const getRes = () => {
         num += scanData.value[j].num;
       }
     }
-    console.log(num, resArray.value[i].needNum, 222);
+
     if (resArray.value[i].needNum <= num) {
       resArray.value[i].status = false;
     }
@@ -138,7 +140,7 @@ const props = defineProps({
   },
 });
 const selectIndex = ref();
-const setSelectIndex = (index: number) => {
+const setSelectIndex = (index) => {
   selectIndex.value = index;
 };
 const scanData = inject("scanData");

+ 157 - 0
src/views/pro-steps/popUpView/copyPopUp.vue

@@ -0,0 +1,157 @@
+<template>
+  <div class="midPopUp" v-if="modelValue" @click.stop="handleClose">
+    <div class="container" @click.stop>
+      <div class="headerTittle">选择流转卡号</div>
+      <div class="selectBox">
+        <el-select
+          v-model="selectedProcess"
+          :filterable="true"
+          multiple
+          style="margin-bottom: 20px"
+        >
+          <el-option
+            v-for="item in processList"
+            :key="item"
+            :label="item"
+            :value="item"
+          />
+        </el-select>
+      </div>
+      <div class="btns">
+        <el-button
+          class="btn"
+          type="primary"
+          @click="emits('submit', selectedProcess)"
+          >提交</el-button
+        >
+        <el-button class="btn" type="info" @click="handleClose">取消</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { getunProcessedList } from "@/api/prosteps";
+import { useProcessStore } from "@/store";
+const emits = defineEmits(["update:modelValue", "submit"]);
+const props = defineProps({
+  modelValue: {
+    type: Boolean,
+    default: false,
+  },
+});
+const store = useProcessStore();
+const toGetProcessedList = async () => {
+  getunProcessedList(store.scanInfo.id).then((res) => {
+    processList.value = res.data ?? [];
+  });
+};
+const processList = ref([]);
+
+const selectedProcess = ref([]);
+const handleClose = () => {
+  emits("update:modelValue", false);
+};
+onMounted(() => {
+  toGetProcessedList();
+});
+watch(
+  () => props.modelValue,
+  (val) => {
+    if (val == false) {
+      selectedProcess.value = [];
+    }
+  }
+);
+</script>
+
+<style lang="scss" scoped>
+.el-divider {
+  margin-top: 0;
+}
+.container {
+  height: 200px;
+  .selectBox {
+    padding: 20px;
+  }
+}
+.btns {
+  width: 100%;
+  @include flex;
+  .btn {
+    width: 120px;
+    height: 30px;
+    font-size: 20px;
+  }
+}
+.header {
+  @include flex;
+  width: 100%;
+  margin: $p10 0;
+
+  .inputBox {
+    width: 75%;
+  }
+}
+
+.describeText {
+  line-height: 25px !important;
+}
+
+.infoBox {
+  width: 100%;
+  height: 200px;
+  border-radius: 16px;
+  display: flex;
+  justify-content: space-between;
+  padding: $p20;
+  border-radius: 16px;
+
+  .leftInfo {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    div {
+      text-align: left !important;
+    }
+  }
+
+  .rightBox {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+
+    .sumBox {
+      width: 180px;
+      height: 80px;
+      padding-bottom: 40px;
+      text-align: left;
+
+      .describeText {
+        text-align: left;
+        line-height: 30px;
+      }
+
+      .sum {
+        font-size: $f38;
+        font-weight: bold;
+        line-height: 20px;
+      }
+    }
+  }
+}
+
+.body {
+  padding: 0 $p20;
+
+  .info {
+    width: 100%;
+    height: 70px;
+    padding: 0 $p20;
+    background-color: white;
+    border-radius: 16px;
+    line-height: 70px;
+  }
+}
+</style>