瀏覽代碼

添加成品出库任务

qinhb 1 月之前
父節點
當前提交
9d253f94f5

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

@@ -96,3 +96,13 @@ export function addWarningUser(
     data: queryParams,
   });
 }
+
+export function outSingle(
+    queryParams: object
+): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/wms/task/outSingle",
+    method: "post",
+    data: queryParams,
+  });
+}

+ 186 - 0
src/views/storage/task/components/choice_out.vue

@@ -0,0 +1,186 @@
+<template>
+  <div class="mainContentBox">
+<!--    <form>
+      <el-row>
+        <el-col :span="16">
+        <el-form-item label="物料编码">
+          <el-input v-model="search.materialCode" placeholder="多个用,号隔开" clearable></el-input>
+        </el-form-item>
+          </el-col>
+        <el-col :span="4">
+          <el-form-item label="仓库类别">
+            <el-select v-model="search.level">
+              <el-option
+                  v-for="item in typeList"
+                  :label="item.label"
+                  :value="item.value"
+                  :key="item.value"
+              />
+            </el-select>
+        </el-form-item>
+      </el-col>
+        <el-col :span="4">
+          <el-button
+              type="primary"
+              icon="el-icon-search"
+              size="normal"
+              @click="queryDataList"
+          >搜索</el-button
+          >
+        </el-col>
+      </el-row>
+    </form>-->
+
+    <avue-crud
+        ref="crudRef"
+        v-model:search="search"
+        v-model="form"
+        :data="data"
+        :option="option"
+        @search-change="searchChange"
+        @search-reset="resetChange"
+        @size-change="dataList"
+        @current-change="dataList"
+        @selection-change="selectionChange1"
+    >
+<!--      <template #menu="{ size, row, index }">
+        <el-button type="primary" link size="small" @click="outMaterial()"
+        ><i-ep-view />出库</el-button>
+      </template>-->
+    </avue-crud>
+    <div class="dialog-footer" style="align-items: center;text-align: center;margin-top: 5px;">
+      <el-button type="primary" @click="outMaterial"> 确定</el-button>
+    </div>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import { useCommonStoreHook } from "@/store";
+import {outSingle} from "@/api/storage";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+const emit = defineEmits(["searchMaterials"])
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+    useCrud({
+      dataListUrl: "/api/v1/wms/stock/info",
+    });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+const clickObjs = ref([])
+const selectionChange1 =(row)=>{
+  toDeleteIds.value = [];
+  row?.forEach((element) => {
+    toDeleteIds.value.push(element.id);
+  });
+  clickObjs.value = row
+}
+const rowClick = (row)=>{
+  emit("searchMaterials", clickObjs.value)
+}
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const typeList = ref([
+  {"label": "一类库","value": "1"},{"label": "二类库","value": "2"}
+])
+const outMaterial = () => {
+  if(clickObjs.value.length == 0){
+    ElMessage.error("请选择需要出库的物料")
+    return;
+  }
+  let pass = true
+  clickObjs.value?.forEach((value) => {
+    if(!value.outNum){
+      ElMessage.error("请输入要出库的数量")
+      pass = false
+      return;
+    }
+    if(value.outNum > value.num){
+      ElMessage.error("出库数量不能大于库存数量")
+      pass = false
+      return;
+    }
+    value.materialNo = value.materialCode;
+    value.num = value.materialCount;
+    value.id = null
+  });
+  if(pass){
+    ElMessageBox.confirm("你确定要出库当前物料吗", "提示", {
+      confirmButtonText: "确定",
+      cancelButtonText: "取消",
+      type: "warning",
+    }).then(() => {
+      const params = {
+        outType: search.value.level,
+        type: 2,
+        state: 1,
+        hosueNo: 1,
+        detailsList: clickObjs.value
+      }
+      outSingle(params).then((res)=>{
+        emit("searchMaterials", clickObjs.value)
+      })
+    });
+  }
+}
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: true,
+  addBtn: false,
+  search: false,
+  searchBtn: false,
+  viewBtn: false,
+  editBtn: false,
+  menu: false,
+  cellBtn: false,
+  column: [
+    {
+      label: "物料编码",
+      overHidden: true,
+      prop: "materialCode",
+    },
+    {
+      label: "物料名称",
+      prop: "materialName",
+      readonly: true,
+      overHidden: true,
+    },
+    {
+      label: "库存数量",
+      prop: "materialCount",
+      type: 'number',
+      min: 0,
+      max: 99999,
+      width: 100,
+      overHidden: true,
+    },
+    {
+      label: "出库数量",
+      prop: "outNum",
+      type: 'number',
+      min: 1,
+      max: 99999,
+      width: 180,
+      cell: true,
+      overHidden: true,
+    }
+  ],
+});
+
+const queryDataList = async () => {
+  search.value.outType = "out"
+  await dataList();
+  if (data.value) {
+    data.value.forEach(item => {
+      item.$cellEdit = true
+    })
+  }
+}
+onMounted(() => {
+  search.value.level = "1"
+  queryDataList();
+
+});
+</script>

+ 111 - 0
src/views/storage/task/components/task_details.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+        ref="crudRef"
+        v-model:search="search"
+        v-model="form"
+        :data="data"
+        :option="option"
+        v-model:page="page"
+        @search-change="searchChange"
+        @search-reset="resetChange"
+        @size-change="dataList"
+        @current-change="dataList"
+        @selection-change="selectionChange"
+    >
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import { useCommonStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import {outSingle} from "@/api/storage";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+    useCrud({
+      dataListUrl: "/api/v1/wms/task/pageDetails",
+    });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+const props = defineProps({
+  taskId: {
+    type: Object,
+    default: () => {
+      return null;
+    }
+  },
+  dialog1: {
+    type: Object,
+    default: () => {
+      return null;
+    }
+  }
+})
+watch(
+    () => props.taskId,
+    () => {
+      search.value.taskId = props.taskId
+      dataList();
+    }
+);
+watch(
+    () => props.dialog1,
+    () => {
+    }
+);
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: false,
+  addBtn: false,
+  search: false,
+  searchBtn: false,
+  viewBtn: false,
+  editBtn: false,
+  menu: false,
+  cellBtn: false,
+  column: [
+    {
+      label: "物料编码",
+      overHidden: true,
+      prop: "materialNo",
+    },
+    {
+      label: "物料名称",
+      prop: "materialName",
+      readonly: true,
+      overHidden: true,
+      click: ({ value, column }) => {
+        if(column.boxType){
+          dialog1.visible = true
+        }
+      },
+    },
+    {
+      label: "出库数量",
+      prop: "num",
+      type: 'number',
+      min: 0,
+      max: 99999,
+      width: 100,
+      overHidden: true,
+    },
+  ],
+});
+
+onMounted(() => {
+  search.value.taskId = props.taskId
+  dataList();
+});
+</script>

+ 74 - 74
src/views/storage/task/index.vue

@@ -15,7 +15,46 @@
         @size-change="dataList"
         @current-change="dataList"
     >
+      <template #menu-left="{ size }">
+        <el-button
+            type="primary"
+            :size="size"
+            @click="openDialog(0,null)"
+        >出库
+          <template #icon>
+            <svg-icon icon-class="paicheng" />
+          </template>
+        </el-button>
+      </template>
+
+      <template #menu="{ size, row, index }">
+        <el-button
+            @click="openDialog(1,row.id)"
+            text
+            type="primary"
+            :size="size">明细
+          <template #icon>
+            <svg-icon icon-class="paicheng" />
+          </template>
+        </el-button>
+      </template>
     </avue-crud>
+    <el-dialog
+        v-model="dialog1.visible"
+        :title="dialog1.title"
+        width="1300px"
+        @close="dialog1.visible = false"
+    >
+      <choice_out  @searchMaterials="handleMaterials"/>
+    </el-dialog>
+    <el-dialog
+        v-model="dialog2.visible"
+        :title="dialog2.title"
+        width="1300px"
+        @close="dialog2.visible = false"
+    >
+      <task_details :taskId="clickTaskId" :dialog1="dialog2"/>
+    </el-dialog>
   </div>
 </template>
 <script setup>
@@ -26,11 +65,27 @@ import ButtonPermKeys from "@/common/configs/buttonPermission";
 import { useCommonStoreHook } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-const test = () => {
-  isShowTable.value = true;
-  tableType.value = tableType.value == 1 ? 2 : 1;
+const openDialog = (type,taskId) => {
+  if(type == 0){
+    dialog1.visible = true;
+  }else{
+    clickTaskId.value = taskId + ""
+    dialog2.visible = true;
+  }
 };
-
+const clickTaskId = ref(null)
+const dialog1 = reactive({
+  title: "出库选择",
+  visible: false,
+});
+const dialog2 = reactive({
+  title: "任务明细",
+  visible: false,
+});
+const handleMaterials = (list) =>{
+  dialog1.visible = false
+  dataList();
+}
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
@@ -39,7 +94,9 @@ const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
 const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
-
+const typeList = ref([
+  {"label": "一类库","value": "1"},{"label": "二类库","value": "2"}
+])
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
@@ -47,94 +104,37 @@ option.value = Object.assign(option.value, {
   selection: false,
   viewBtn: false,
   editBtn: false,
-  menu: false,
+  menu: true,
   addBtn: false,
   column: [
     {
       label: "任务单号",
       prop: "taskNo",
       search: true,
-      width:150,
       overHidden: true
     },
     {
-      label: "计划单号",
-      prop: "planNo",
-      search: true,
-    },
-    {
-      label: "类型",
-      prop: "type",
-      type: "select",
-      search: true,
-      dicData:[{label: "入库",value: "1"},{label: "出库",value: "2"},{label: "退料",value: "3"}],
+      label: "仓库类别",
+      prop: "outType",
+      type: 'select',
+      dicData: typeList
     },
     {
-      label: "物料编号",
-      width: 130,
-      overHidden: true,
-      prop: "materialNo",
+      label: "创建时间",
+      prop: "created",
+      display: false
     },
     {
-      label: "物料名称",
-      width:150,
-      overHidden: true,
-      prop: "materialName",
-    },
-    {
-      label: "批次号",
-      prop: "batchCode",
-      width:150,
-      overHidden: true
-    },
-    {
-      label: "总数量",
-      prop: "num",
-    },
-    {
-      label: "已操作数量",
-      prop: "completedNum",
-    },
-    {
-      label: "待操作数量",
-      prop: "unDoNum",
-    },
-    {
-      label: "单位",
-      prop: "unit",
-    },
-    {
-      label: "仓库",
-      prop: "houseType",
-      type: "select",
-      search: true,
-      dicUrl:
-          dictDataUtil.request_url +
-          dictDataUtil.TYPE_CODE.warehouse_type,
-      props: {
-        label: "dictLabel",
-        value: "dictValue",
-      }
-    },
-    {
-      label: "状态",
-      prop: "state",
-      type: "select",
-      search: true,
-      dicUrl:
-          dictDataUtil.request_url +
-          dictDataUtil.TYPE_CODE.warehouse_task_state,
-      props: {
-        label: "dictLabel",
-        value: "dictValue",
-      }
+      label: "创建人",
+      prop: "creator",
+      display: false
     },
   ],
 });
 
 onMounted(() => {
   // console.log("crudRef", crudRef)
-  //search.value.type = '1'
+  search.value.type = '2'
   dataList();
 });
 </script>