Parcourir la source

仓储管理更改

qinhb il y a 4 mois
Parent
commit
7eabf1ec9c

+ 8 - 0
src/api/order/index.ts

@@ -286,3 +286,11 @@ export function getShortageItem(shortageId: number): AxiosPromise<any> {
     method: "get",
   });
 }
+export function queryReceive(
+    taskNo: object
+): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/plan/requisition/queryReceive/"+ taskNo,
+    method: "get",
+  });
+}

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

@@ -107,3 +107,14 @@ export function addWarningUser(
     data: queryParams,
   });
 }
+export function outSingle(
+    queryParams: object
+): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/plan/requisition/outSingle",
+    method: "post",
+    data: queryParams,
+  });
+}
+
+

+ 9 - 9
src/views/plan/requisition/index.vue

@@ -342,7 +342,7 @@
                       </el-radio-group>
                     </el-form-item>
                     <el-form-item
-                      label="审批人员"
+                      label="出库人员"
                       v-if="
                         dialogType !== 1 &&
                         form.state === '1' &&
@@ -353,7 +353,7 @@
                         size="small"
                         filterable
                         v-model="form.approveUser"
-                        placeholder="请选择审批人员"
+                        placeholder="请选择出库人员"
                         clearable
                       >
                         <el-option
@@ -434,7 +434,7 @@
                     label-width="auto"
                     style="max-width: 400px"
                   >
-                    <el-form-item label="审批人" v-if="form.state > 5">
+                    <el-form-item label="出库人" v-if="form.state > 5">
                       <el-text tag="p">{{ form.approve.user }}</el-text>
                     </el-form-item>
                     <el-form-item label="出库结果">
@@ -447,14 +447,14 @@
                             : "已出库"
                         }}</el-text
                       >
-                      <el-text tag="p" v-else-if="form.approveUser !== username"
+                      <el-text tag="p"
                         >待出库</el-text
                       >
                     </el-form-item>
                     <el-form-item label="出库时间" v-if="form.state > 5">
                       <el-text tag="p">{{ form.approve.time }}</el-text>
                     </el-form-item>
-                    <el-form-item style="margin-left: 35%">
+<!--                    <el-form-item style="margin-left: 35%">
                       <el-button
                         type="primary"
                         @click="saveForm(4)"
@@ -465,7 +465,7 @@
                         "
                         >已 出 库</el-button
                       >
-                    </el-form-item>
+                    </el-form-item>-->
                   </el-form>
                 </el-card>
               </el-timeline-item>
@@ -535,10 +535,10 @@ const saveForm = (type) => {
       return;
     }
     for (let item of tableDataList.value) {
-      if (!item.workCode) {
+      /*if (!item.workCode) {
         ElMessage.error("工作令号不能为空");
         return;
-      }
+      }*/
       if (!item.num || item.num <= 0) {
         ElMessage.error("物料数量不正确");
         return;
@@ -635,7 +635,7 @@ const openDialog = (type, row) => {
   dialogType.value = type;
   tableDataList.value = [];
   form.value = {};
-  form.value.sendOrg = "周转库";
+  form.value.sendOrg = "线边仓";
   form.value.applyOrg = "制造中心";
   form.value.state = "0";
   if (type !== 0) {

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

@@ -0,0 +1,252 @@
+<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"
+        :row-style="rowStyle"
+        :cell-style="cellStyle"
+        @selection-change="selectionChange"
+    >
+      <template #menu="{ size, row, index }">
+        <el-button type="primary" link size="small" @click="outMaterial(row)"
+        ><i-ep-view />出库</el-button>
+      </template>
+    </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({
+      src: "/api/v1/wms/stock",
+    });
+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 dialog1 = reactive({
+  title: "物料选择",
+  visible: false,
+});
+const outMaterial = (value) => {
+  if(!value.outNum){
+    ElMessage.error("请输入要出库的数量")
+    return;
+  }
+  if(value.outNum > value.num){
+    ElMessage.error("出库数量不能大于库存数量")
+    return;
+  }
+  ElMessageBox.confirm("你确定要出库当前物料吗", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",
+  }).then(() => {
+    value.detailId = props.materialInfo.id
+    value.applyCode = props.materialInfo.applyCode
+    outSingle(value).then((res)=>{
+      queryDataList();
+    })
+  });
+}
+const props = defineProps({
+  materialInfo: {
+    type: Object,
+    default: () => {
+      return null;
+    }
+  },
+  dialog1: {
+    type: Object,
+    default: () => {
+      return null;
+    }
+  }
+})
+watch(
+    () => props.materialInfo,
+    () => {
+      search.value.materialNo = props.materialInfo.materialCode
+      queryDataList();
+    }
+);
+watch(
+    () => props.dialog1,
+    () => {
+      alert(1)
+    }
+);
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: false,
+  addBtn: false,
+  search: false,
+  searchBtn: false,
+  viewBtn: false,
+  editBtn: false,
+  menuWidth: 100,
+  cellBtn: false,
+  column: [
+    {
+      label: "仓库编码",
+      prop: "houseType",
+      type: "select",
+      width: 90,
+      overHidden: true,
+      editDisabled: true,
+      dicUrl:
+          dictDataUtil.request_url +
+          dictDataUtil.TYPE_CODE.warehouse_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+      rules: [
+        {
+          required: true,
+          message: "仓库编码不能为空",
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "货区",
+      prop: "locationNo",
+      width: 90,
+      editDisabled: true,
+      rules: [
+        {
+          required: true,
+          message: "料箱编号不能为空",
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "货位",
+      width: 90,
+      prop: "coordinate",
+      editDisabled: true,
+      rules: [
+        {
+          required: true,
+          message: "仓库位置不能为空",
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "批次号",
+      width: 120,
+      overHidden: true,
+      prop: "batchCode",
+    },
+    {
+      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,
+      formatter:(val,value,label)=>{
+        if(val.warningMsg){
+          return val.num+"("+val.warningMsg+")"
+        }else{
+          return val.num
+        }
+      }
+    },
+    {
+      label: "出库数量",
+      prop: "outNum",
+      type: 'number',
+      min: 0,
+      max: props.materialInfo.num - props.materialInfo.receiveNum,
+      width: 180,
+      cell: true,
+      overHidden: true,
+    },
+    {
+      label: "单位",
+      width: 80,
+      prop: "unit",
+    },
+  ],
+});
+const rowStyle = ({row,column,rowIndex}) =>{
+  if(row.warningMsg){
+    return {
+      backgroundColor:'#f3d2d2',
+      color:'#6c6a6a'
+    }
+  }
+}
+const cellStyle = ({row,column,rowIndex,columnIndex})=>{
+  if(columnIndex === 10){
+    if(row.warningMsg){
+      return {
+        color:'red',
+        fontWeight:'bold',
+        fontSize:'20'
+      }
+    }else{
+      return {
+        color: '#60fc56',
+        fontWeight:'bold',
+        fontSize:'20'
+      }
+    }
+  }
+}
+const queryDataList = async () => {
+  search.value.outType = "out"
+  search.value.materialNo = props.materialInfo.materialCode
+  await dataList();
+  if (data.value) {
+    data.value.forEach(item => {
+      item.$cellEdit = true
+    })
+  }
+}
+onMounted(() => {
+  queryDataList();
+
+});
+</script>

+ 306 - 75
src/views/storage/task/index.vue

@@ -1,113 +1,297 @@
 <template>
   <div class="mainContentBox">
     <avue-crud
-        ref="crudRef"
-        v-model:search="search"
-        v-model="form"
-        :data="data"
-        :option="option"
-        v-model:page="page"
-        @row-save="createRow"
-        @row-update="updateRow"
-        @row-del="deleteRow"
-        @search-change="searchChange"
-        @search-reset="resetChange"
-        @size-change="dataList"
-        @current-change="dataList"
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+      @search-change="searchChange"
+      @search-reset="resetChange"
+      @size-change="dataList"
+      @current-change="dataList"
+      @selection-change="selectionChange"
     >
+      <template #menu="{ size, row, index }">
+        <el-button type="primary" link size="small" @click="openDialog(0, row)"
+          ><i-ep-view />查看</el-button
+        >
+        <el-button type="primary" v-if="row.state === '5'" link size="small" @click="openDialog(1, row)"
+          ><i-ep-edit />出库</el-button>
+      </template>
     </avue-crud>
+    <el-dialog
+        v-model="dialog1.visible"
+        :title="dialog1.title"
+        width="1300px"
+        @close="dialog1.visible = false"
+    >
+      <choice_out :materialInfo="form" :dialog1="dialog1"/>
+    </el-dialog>
+    <el-dialog
+        v-model="dialog2.visible"
+        :title="dialog2.title"
+        width="1000px"
+        @close="dialog2.visible = false"
+    >
+      <avue-crud
+          ref="crudRef"
+          v-model:search="search2"
+          :data="data2"
+          :option="option2"
+      />
+    </el-dialog>
+    <el-dialog
+      v-model="dialog.visible"
+      :title="dialog.title"
+      width="75%"
+      @close="dialog.visible = false"
+    >
+      <template #header="{ close, titleId, titleClass }">
+        <el-button
+          type="primary"
+          @click="printPage"
+          >打印</el-button
+        >
+      </template>
+
+      <div class="card-container">
+        <el-card style="width: 95%; margin-bottom: 15px;margin-top: 10px" shadow="always">
+          <div ref="toPrintRef">
+            <el-row style="text-align: center">
+              <el-col :span="24"
+                ><el-text tag="b">零、部(组)件领用单</el-text></el-col
+              >
+            </el-row>
+            <el-row>
+              <el-col :span="14"></el-col>
+              <el-col :span="5"
+                ><el-text tag="p" v-if="form.applyCode">{{
+                  form.applyCode
+                }}</el-text></el-col
+              >
+              <el-col :span="5"></el-col>
+            </el-row>
+            <el-row style="width: 100%; height: 30px"></el-row>
+            <el-table
+              class="print-table"
+              v-loading="loading"
+              :data="tableDataList"
+              border
+            >
+              <el-table-column label="序号" type="index" width="60" />
+              <el-table-column label="工序编码" prop="workCode"/>
+              <el-table-column label="工序名称" prop="remark"/>
+              <el-table-column label="零、部(组)件图号" prop="materialCode" />
+              <el-table-column label="名称" prop="materialName" />
+              <el-table-column label="领用数量" prop="num"/>
+              <el-table-column
+                label="已出库数量"
+                align="receiveNum"
+              >
+                <template v-slot="{ row }">
+                  <el-text v-if="row.receiveNum === 0">0</el-text>
+                  <el-button
+                      v-else
+                      link
+                      type="primary"
+                      @click="showDetails(row)"
+                  >{{ row.receiveNum }}</el-button
+                  >
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="操作"
+                align="remark"
+                v-if="dialogType === 1"
+              >
+                <template v-slot="{ row, index }">
+                  <el-button type="primary" v-if="row.receiveNum < row.num" link size="small" @click="openDialog(2, row)"
+                  ><i-ep-edit />选料出库</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </el-card>
+      </div>
+    </el-dialog>
   </div>
 </template>
+
 <script setup>
-import { ref, getCurrentInstance } from "vue";
+import { useUserStoreHook } from "@/store/index";
+import { ref, watchEffect  } from "vue";
+import { html2CanvasPrint } from "@/utils/common";
 import { useCrud } from "@/hooks/userCrud";
-import ButtonPermKeys from "@/common/configs/buttonPermission";
-
-import { useCommonStoreHook } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
+import {
+  queryReceive,
+  queryApplyInfoDetails,
+} from "@/api/order";
+import { useCommonStoreHook } from "@/store";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const test = () => {
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
-
+const dialog = reactive({
+  title: "领用单",
+  visible: false,
+});
+const dialog1 = reactive({
+  title: "出库选择",
+  visible: false,
+});
+const dialog2 = reactive({
+  title: "领用记录",
+  visible: false,
+});
+const clickRow = ref(null)
+const showDetails = (value) => {
+  //查询领用的记录
+  dialog2.visible = true
+  queryReceive(value.applyCode).then((res)=>{
+    data2.value = res.data
+  })
+};
+const data2 = ref([])
+const search2 = ref(null)
+// 1.定义ref
+const toPrintRef = ref(null);
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
-    src: "/api/v1/wms/task",
+    src: "/api/v1/plan/requisition",
   });
-const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } = Methords; //增删改查
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
-
+const { username } = useUserStoreHook().user;
+watchEffect(() => {
+  if (!dialog1.visible) {
+    if(clickRow.value){
+      queryApplyInfoDetails({ applyCode: clickRow.value }).then((data) => {
+        tableDataList.value = data.data;
+      });
+    }
+  }
+  if(!dialog.visible){
+    dataList()
+  }
+});
+const loading = ref(false);
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const dialogType = ref(false);
+const tableDataList = ref([]);
+const openDialog = (type, row) => {
+  if(type !== 2){
+    clickRow.value = row.applyCode
+    dialogType.value = type;
+    tableDataList.value = [];
+    queryApplyInfoDetails({ applyCode: row.applyCode }).then((data) => {
+      tableDataList.value = data.data;
+    });
+    form.value = row;
+    dialog.visible = true;
+  }else{
+    form.value = {}
+    form.value = row
+    dialog1.visible = true;
+  }
+
+};
+const printPage = () => {
+  html2CanvasPrint(toPrintRef.value);
+};
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   delBtn: false,
-  selection: false,
-  viewBtn: false,
-  editBtn: false,
-  menu: false,
   addBtn: false,
+  editBtn: false,
+  viewBtn: false,
+  selection: true,
   column: [
     {
-      label: "任务单号",
-      prop: "taskNo",
+      label: "领用单号",
+      prop: "applyCode",
       search: true,
-      width:150,
-      overHidden: true
+      width: 150,
+      overHidden: true,
     },
     {
-      label: "计划单号",
-      prop: "planNo",
+      label: "工单单号",
+      prop: "workOrderCode",
       search: true,
+      width: 100,
+      overHidden: true,
     },
     {
-      label: "类型",
-      prop: "type",
-      type: "select",
+      label: "订单编号",
+      prop: "orderCode",
       search: true,
-      dicData:[{label: "入库",value: "1"},{label: "出库",value: "2"},{label: "退料",value: "3"}],
-    },
-    {
-      label: "物料编号",
-      width: 130,
+      width: 150,
       overHidden: true,
-      prop: "materialNo",
     },
     {
-      label: "物料名称",
-      width:150,
+      label: "领用单位",
+      prop: "applyOrg",
+      width: 120,
       overHidden: true,
-      prop: "materialName",
-    },
-    {
-      label: "批次号",
-      prop: "batchCode",
-      width:150,
-      overHidden: true
     },
     {
-      label: "总数量",
-      prop: "num",
+      label: "发件单位",
+      prop: "sendOrg",
+      width: 120,
+      overHidden: true,
     },
     {
-      label: "已操作数量",
-      prop: "completedNum",
+      label: "出库人员",
+      width: 120,
+      overHidden: true,
+      prop: "approveUser",
     },
     {
-      label: "待操作数量",
-      prop: "unDoNum",
+      label: "状态",
+      prop: "state",
+      width: 90,
+      type: "select",
+      search: true,
+      dicData: [{"dictLabel": "待出库","dictValue": "5"},{"dictLabel": "已出库","dictValue": "6"}],
+      props: {
+        label: "dictLabel", // 下拉菜单显示的字段
+        value: "dictValue", // 下拉菜单值的字
+      },
     },
     {
-      label: "单位",
-      prop: "unit",
+      label: "创建时间",
+      prop: "created",
+      width: 160,
+      display: false,
     },
+  ],
+});
+const option2 = {
+  delBtn: false,
+  selection: false,
+  addBtn: false,
+  search: false,
+  searchBtn: false,
+  viewBtn: false,
+  editBtn: false,
+  menu: false,
+  column: [
     {
-      label: "仓库",
-      prop: "houseType",
+      label: "仓库编码",
+      prop: "vehicle",
       type: "select",
-      search: true,
+      width: 90,
+      overHidden: true,
+      editDisabled: true,
       dicUrl:
           dictDataUtil.request_url +
           dictDataUtil.TYPE_CODE.warehouse_type,
@@ -117,24 +301,71 @@ option.value = Object.assign(option.value, {
       }
     },
     {
-      label: "状态",
-      prop: "state",
-      type: "select",
-      search: true,
-      dicUrl:
-          dictDataUtil.request_url +
-          dictDataUtil.TYPE_CODE.warehouse_task_state,
-      props: {
-        label: "dictLabel",
-        value: "dictValue",
-      }
+      label: "货区",
+      prop: "remark",
+      width: 90,
+      editDisabled: true,
+    },
+    {
+      label: "货位",
+      width: 90,
+      prop: "code",
+    },
+    {
+      label: "物料编码",
+      overHidden: true,
+      prop: "materialCode",
+    },
+    {
+      label: "物料名称",
+      prop: "materialName",
+      readonly: true,
+      overHidden: true,
+    },
+    {
+      label: "物料型号",
+      prop: "materialModel",
+      readonly: true,
+      overHidden: true,
+    },
+    {
+      label: "出库数量",
+      prop: "receiveNum",
+      type: 'number',
+      width: 80,
+      overHidden: true,
+    },
+    {
+      label: "出库人",
+      prop: "creator",
+    },
+    {
+      label: "出库时间",
+      prop: "created",
+      overHidden: true,
     },
   ],
-});
-
+}
 onMounted(() => {
-  // console.log("crudRef", crudRef)
-  //search.value.type = '1'
+  search.value.type = "1"
   dataList();
 });
 </script>
+
+<style scoped>
+:deep(.card-container .el-form-item) {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  height: 15px; /* 根据需要调整高度 */
+}
+
+:deep(.el-timeline-item) {
+  padding-bottom: 0px;
+  position: relative;
+}
+.card-container {
+  display: flex;
+  justify-content: space-around;
+}
+</style>

+ 1 - 1
src/views/storage/wmsOrder/components/add_order_details.vue

@@ -190,7 +190,7 @@ option2.value = {
           trigger: "trigger",
         },
       ],
-      dicData:[{label: "原材料入库",value: "1"},{label: "工装入库",value: "2"},{label: "退料",value: "3"},{label: "领料",value: "4"}],
+      dicData:[{label: "原材料入库",value: "1"},{label: "工装入库",value: "2"},{label: "退料",value: "3"},{label: "出库",value: "4"}],
     },
     {
       label: "仓库编码",

+ 1 - 1
src/views/storage/wmsOrder/index.vue

@@ -134,7 +134,7 @@ option.value = Object.assign(option.value, {
       overHidden: true,
       type: "select",
       search: true,
-      dicData:[{label: "原材料入库",value: "1"},{label: "工装入库",value: "2"},{label: "退料",value: "3"},{label: "领料",value: "4"}],
+      dicData:[{label: "原材料入库",value: "1"},{label: "工装入库",value: "2"},{label: "退料",value: "3"},{label: "出库",value: "4"}],
     },
     {
       label: "货区",