Jelajahi Sumber

1.半成品入库详情里面新增出库功能

liziliang 2 bulan lalu
induk
melakukan
555c6585f9

+ 11 - 0
src/api/storage/index.ts

@@ -86,3 +86,14 @@ export function oprerate(
     data: queryParams,
   });
 }
+
+
+export function outInv(
+  queryParams: object
+): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/semiFinishedStock/out",
+    method: "post",
+    data: queryParams,
+  });
+}

+ 113 - 5
src/views/storage/semi/components/details.vue

@@ -17,7 +17,49 @@
         :row-style="rowStyle"
         :cell-style="cellStyle"
         @selection-change="selectionChange"
-    />
+    >
+      <template #menu-left="{ size }">
+        <el-button
+          :disabled="toDeleteIds.length < 1"
+          type="primary"
+          :size="size"
+          @click="dialog3.visible = true"
+        >出库
+        </el-button
+        >
+      </template>
+    </avue-crud>
+
+    <el-dialog
+      v-model="dialog3.visible"
+      :title="dialog3.title"
+      width="550px"
+      @close="dialog3.visible = false"
+    >
+      <el-input
+        v-model="outWorkOrderCode"
+        placeholder="选择出库工单号"
+        :prefix-icon="Search"
+        @click="dialog4.visible = true"
+      >
+      </el-input>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="dialog3.visible = false">取消</el-button>
+          <el-button type="primary" @click="outInventory">
+            确定
+          </el-button>
+        </div>
+      </template>
+    </el-dialog>
+    <el-dialog
+      v-model="dialog4.visible"
+      :title="dialog4.title"
+      width="950px"
+      @close="dialog4.visible = false"
+    >
+      <work-order-page @order-info="materialInfo2" :queryType="99"/>
+    </el-dialog>
   </div>
 </template>
 <script setup>
@@ -36,11 +78,13 @@ const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
-import { getSemi, oprerate } from "@/api/storage/index";
+import {getSemi, oprerate, outInv} from "@/api/storage/index";
 import { useDictionaryStore } from "@/store";
+import {Search} from "@element-plus/icons-vue";
 const { dicts } = useDictionaryStore();
 const emits = defineEmits(["close"]);
 const ruleFormRef = ref(null);
+const outWorkOrderCode = ref(null);
 const dialog1 = reactive({
   title: "工单号选择",
   visible: false,
@@ -49,6 +93,40 @@ const materialInfo1 = (value) => {
   formData.value.outWorkOrderCode = value.workOrderCode;
   dialog1.visible = false;
 };
+
+const materialInfo2 = async (value) => {
+  outWorkOrderCode.value = value.workOrderCode;
+  dialog4.visible = false;
+};
+const dialog3 = reactive({
+  title: "出库",
+  visible: false,
+});
+
+const dialog4 = reactive({
+  visible: false,
+  title: "工单编码选择",
+});
+const outInventory = () => {
+
+  outInv({
+    inStockId: props.id,
+    ids: toDeleteIds.value,
+    outNum: toDeleteIds.value.length,
+    outWorkOrderCode: outWorkOrderCode.value
+  }).then((res) => {
+    if (res.code == "200") {
+      ElMessage.success("出库成功!");
+    } else {
+      ElMessage.error("出库失败!");
+    }
+    dialog3.visible = false;
+    outWorkOrderCode.value = null;
+    search.value.inStockId = props.id;
+    dataList();
+  });
+
+};
 const formData = ref({
   stockId: "",
   stockType: "2",
@@ -97,8 +175,19 @@ option.value = Object.assign(option.value, {
   viewBtn: false,
   menu: false,
   addBtn: false,
+  selectable: (row) => {
+    // 返回 true 表示允许勾选,false 表示禁用勾选
+    return row.inventoryStatus === 1; // 例如:状态不是 "已审核" 的行才能勾选
+  },
   column: [
     {
+      label: "管号",
+      prop: "workOrderSeqNo",
+      editDisabled: true,
+      addDisplay: false,
+      search: true,
+    },
+    {
       label: "生产批号",
       prop: "workOrderCode",
       editDisabled: true,
@@ -112,11 +201,30 @@ option.value = Object.assign(option.value, {
       ],
     },
     {
-      label: "号",
-      prop: "workOrderSeqNo",
+      label: "出库工单号",
+      prop: "outWorkOrderCode",
       editDisabled: true,
       addDisplay: false,
-      search: true,
+      rules: [
+        {
+          required: true,
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "是否已出库",
+      prop: "inventoryStatus",
+      editDisabled: true,
+      addDisplay: false,
+      html: true,
+      formatter: (val) => {
+        if (val.inventoryStatus === 2) {
+          return '<b class="el-tag el-tag--success el-tag--light">是</b>';
+        } else {
+          return '<b class="el-tag el-tag--danger el-tag--light">否</b>';
+        }
+      },
     },
 
   ]

+ 14 - 3
src/views/storage/semi/index.vue

@@ -62,13 +62,12 @@
       v-model="dialog3.visible"
       :title="dialog3.title"
       width="950px"
-      @close="dialog3.visible = false"
+      @close="dialog3.visible = false;dataList();"
     >
       <Details
         :id="selectId"
         @close="
           dialog3.visible = false;
-          dataList();
         "
       />
     </el-dialog>
@@ -217,7 +216,7 @@ option.value = Object.assign(option.value, {
         },
       },*/
     {
-      label: "库数量",
+      label: "库数量",
       prop: "operateNum",
       addDisplay: false,
       editDisabled: true,
@@ -228,6 +227,18 @@ option.value = Object.assign(option.value, {
         },
       ],
     },
+    {
+      label: "出库数量",
+      prop: "outNum",
+      addDisplay: false,
+      editDisabled: true,
+      rules: [
+        {
+          required: true,
+          trigger: "trigger",
+        },
+      ],
+    },
 
     /*{
       label: "出入库类型",