695593266@qq.com 11 luni în urmă
părinte
comite
e817dbe0bf

+ 9 - 0
src/api/produce/workOrder.js

@@ -336,3 +336,12 @@ export async function getPackingList(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//获取工艺文件
+export async function filePageAPI(data) {
+  const res = await request.post('/fm/file/queryIds', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 160 - 10
src/views/produce/components/feeding/components/outboundOrderDialog.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- 默认的vue 根节点必须要要有值  我看是不是这个问题哈 -->
   <ele-modal
     :visible.sync="visible"
     v-if="visible"
@@ -7,33 +8,182 @@
     :close-on-press-escape="false"
     :maxable="true"
     append-to-body
-    width="90%"
-  ></ele-modal>
+    width="85%"
+    :title="title"
+  >
+    <ele-pro-table
+      ref="sourceTable"
+      :columns="cloums"
+      :datasource="datasource"
+      row-key="id"
+      :cache-key="cacheKeyUrl"
+      @selection-change="handleSelectionChange"
+    >
+      <template v-slot:weight="{ row, $index }">
+        <span>{{ row.weight || 0 }}{{ row.weightUnit }}</span>
+      </template>
+    </ele-pro-table>
+
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button
+        size="mini"
+        type="primary"
+        :loading="loadingBtn"
+        @click="save()"
+        >确 定</el-button
+      >
+    </template>
+  </ele-modal>
 </template>
 
 <script>
+  import { feedOutInOrder } from '@/api/produce/feeding';
   export default {
-    name: 'outboundOrderDialog',
-
     data() {
       return {
-        visible: false
+        visible: false,
+        title: '出库单',
+        outList: [],
+        workOrderId: '',
+        taskId: '',
+        selection: [],
+        cacheKeyUrl: 'feeding-outboundOrderDialog',
+        loadingBtn: false,
+        chooseData: []
       };
     },
-
     computed: {
       cloums() {
-        return [];
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: 'left',
+            reserveSelection: true
+          },
+          {
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            label: '序号',
+            width: 55,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            width: 100,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            width: 100,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '物料名称',
+            width: 150,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '物料编码',
+            width: 150,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'feedQuantity',
+            label: '数量',
+            width: 90,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'unit',
+            label: '单位',
+            width: 100,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weight',
+            slot: 'weight',
+            label: '重量',
+            width: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            width: 150,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            width: 150,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            width: 200,
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ];
       }
     },
-
-    mehtods: {
+    methods: {
       handleClose() {
         this.visible = false;
       },
 
-      open() {
+      async datasource({ page, limit, where }) {
+        const res = await feedOutInOrder({
+          workOrderId: this.workOrderId,
+          taskId: this.taskId,
+          pageNum: page,
+          size: limit
+        });
+        return res;
+      },
+
+      open(id, item) {
+        this.workOrderId = id;
+        this.taskId = item.currentTaskDiagram.taskId;
         this.visible = true;
+      },
+
+      handleSelectionChange(item) {
+        this.chooseData = item;
+      },
+
+      handleClose() {
+        this.visible = false;
+      },
+
+      save() {
+        if (!this.chooseData || this.chooseData.length === 0) {
+          this.$message.warning('请选择出库物料');
+          return;
+        }
+
+        this.$emit('chooseData', this.chooseData);
+        this.visible = false;
       }
     }
   };

+ 19 - 3
src/views/produce/components/feeding/index.vue

@@ -39,7 +39,10 @@
             <div class="name">工单信息 </div>
 
             <div class="rx-bc">
-              <el-button type="text" size="mini" @click="outboundOrder()"
+              <el-button
+                type="text"
+                size="mini"
+                @click="outboundOrder(item.workOrderId, item)"
                 >出库单</el-button
               >
               <el-button
@@ -192,7 +195,11 @@
     <div v-else>
       <el-empty description="批量报工,不需要投料,直接去报工取样"></el-empty>
     </div>
-    <!-- <outboundOrderDialog ref="outboundOrderDialogRef"></outboundOrderDialog> -->
+
+    <outboundOrderDialog
+      ref="outboundOrderDialogRef"
+      @chooseData="chooseData"
+    />
   </div>
 </template>
 
@@ -422,12 +429,21 @@
         });
       },
 
-      outboundOrder() {},
+      outboundOrder(id, item) {
+        this.$refs.outboundOrderDialogRef.open(id, item);
+      },
 
       openPicking(id, item) {
         this.$refs.pickingListRef.open(id, item, '选择列表');
       },
 
+      chooseData(listData) {
+        this.$set(this.List[0], 'semiProductList', listData);
+        this.$forceUpdate();
+
+        console.log(this.List[0], 'this.List');
+      },
+
       allSelection(id, selectList) {
         this.List.forEach((m) => {
           if (m.workOrderId == id) {

+ 1 - 3
src/views/produce/components/jobBooking/components/batchPackagingGrouping.vue

@@ -260,9 +260,7 @@
             console.log(newVal.product, 'newVal.product');
             this.newCategoryId = newVal.product[0].categoryId;
             this.formedNumLast = newVal.product.reduce((acc, pro) => {
-              return pro.extInfo.sourceQuantity
-                ? acc + Number(pro.extInfo.sourceQuantity)
-                : acc;
+              return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
             }, 0);
 
             console.log(this.formedNumLast);

+ 8 - 4
src/views/produce/components/jobBooking/index.vue

@@ -549,16 +549,20 @@
                 this.clientEnvironmentId != 3 &&
                 this.clientEnvironmentId != 2
               ) {
-                obj.product = obj.pickOutInList;
-                obj.pickOutInList = [];
+                if (obj.pickOutInList != 0) {
+                  obj.product = obj.pickOutInList;
+                  obj.pickOutInList = [];
+                }
               } else if (
                 this.taskObj.type == 4 &&
                 obj.singleReport == 1 &&
                 this.clientEnvironmentId != 3 &&
                 this.clientEnvironmentId != 2
               ) {
-                obj.semiProductList = obj.pickOutInList;
-                obj.pickOutInList = [];
+                if (obj.pickOutInList != 0) {
+                  obj.semiProductList = obj.pickOutInList;
+                  obj.pickOutInList = [];
+                }
               }
 
               if (

+ 314 - 279
src/views/produce/components/picking/wokePopup.vue

@@ -1,330 +1,365 @@
 <template>
-    <el-dialog title="工艺文件" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
-        :close-on-press-escape="false" append-to-body width="80%">
-
-        <ele-pro-table ref="fileTable" :columns="jobColumns1" :datasource="workList">
-            <!-- 表头工具栏 -->
-
-            <template v-slot:action="{ row, $index }">
-                <el-link type="primary" @click="fileDetails(row)">详情</el-link>
-            </template>
-        </ele-pro-table>
-
-        <template slot="footer">
-            <el-button size="mini" @click="handleClose">取 消</el-button>
-            <el-button size="mini" type="primary" @click="handleClose">确 定</el-button>
-        </template>
-
-        <pickingList isType="pick" ref="pickingListRef" @allSelection="allSelection"></pickingList>
-        <fileBrowse  ref="browseRef"></fileBrowse>
-    </el-dialog>
+  <el-dialog
+    title="工艺文件"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <ele-pro-table
+      ref="fileTable"
+      :columns="jobColumns1"
+      :datasource="workList"
+    >
+      <!-- 表头工具栏 -->
+
+      <template v-slot:action="{ row, $index }">
+        <el-link type="primary" @click="fileDetails(row)">详情</el-link>
+      </template>
+    </ele-pro-table>
+
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button size="mini" type="primary" @click="handleClose"
+        >确 定</el-button
+      >
+    </template>
+
+    <pickingList
+      isType="pick"
+      ref="pickingListRef"
+      @allSelection="allSelection"
+    ></pickingList>
+    <fileBrowse ref="browseRef"></fileBrowse>
+  </el-dialog>
 </template>
 
 <script>
-import pickingList from './pickingList.vue';
-import fileBrowse from './fileBrowse.vue';
-import { workorderList, getCode, craftFiles } from '@/api/produce/workOrder';
-import { typeName } from '../common.js';
-import { batchSave } from '@/api/produce/picking';
-
-export default {
+  import pickingList from './pickingList.vue';
+  import fileBrowse from './fileBrowse.vue';
+  import {
+    workorderList,
+    getCode,
+    craftFiles,
+    filePageAPI
+  } from '@/api/produce/workOrder';
+  import { typeName } from '../common.js';
+  import { batchSave } from '@/api/produce/picking';
+
+  export default {
     components: {
-        pickingList,fileBrowse
+      pickingList,
+      fileBrowse
     },
     props: {
-        workListIds: {
-            type: Array,
-            default() {
-                return [];
-            }
-        },
-        taskId: {
-            type: String,
-            default() {
-                return null;
-            }
+      workListIds: {
+        type: Array,
+        default() {
+          return [];
+        }
+      },
+      taskId: {
+        type: String,
+        default() {
+          return null;
         }
+      }
     },
     data() {
-        return {
-            visible: false,
-            workList: [],
-            rules: {},
-
-            pickCode: null,
-            pickName: null,
-            jobColumns1: [
-                {
-                    label: '编码',
-                    prop: 'code',
-                    width: 180,
-                    align: 'center',
-                    showOverflowTooltip: true
-                },
-
-                {
-                    prop: 'name',
-                    label: '文档名称',
-                    align: 'center',
-                    slot: 'name',
-                    showOverflowTooltip: true,
-                    minWidth: 200
-                },
-
-                {
-                    prop: 'storagePath',
-                    label: '文件名称',
-                    align: 'center',
-
-                    showOverflowTooltip: true,
-                    minWidth: 200,
-                    formatter: (_row, _column, cellValue) => {
-                        return cellValue[0]?.name;
-                    }
-                },
-
-                {
-                    prop: 'version',
-                    label: '版本',
-                    align: 'center',
-                    showOverflowTooltip: true,
-                    minWidth: 100
-                },
-
-                {
-                    prop: 'createTime',
-                    label: '创建时间',
-                    showOverflowTooltip: true,
-                    align: 'center',
-                    minWidth: 110
-                },
-                {
-                    columnKey: 'action',
-                    label: '操作',
-                    width: 260,
-                    align: 'center',
-                    resizable: false,
-                    slot: 'action',
-                    showOverflowTooltip: true
-                }
-            ],
-
-            typeName,
-
-            tableRules: {}
-        };
+      return {
+        visible: false,
+        workList: [],
+        rules: {},
+
+        pickCode: null,
+        pickName: null,
+        jobColumns1: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
+
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
+          },
+
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 260,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+
+        typeName,
+
+        tableRules: {}
+      };
     },
     computed: {
-        taskObj() {
-            return this.$store.state.user.taskObj;
-        }
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      }
     },
 
     watch: {},
     methods: {
-        // datasource({ page, where, limit }) {
-
-        //     let req = {
-        //         "taskId": this.taskId,
-        //         "workOrderId": this.workListIds[0]
-        //     }
-
-        //     return craftFiles({
-        //         ...req,
-        //         pageNum: page,
-        //         size: limit,
-        //     });
-        // },
-
-        open(req) {
-
-            craftFiles(req).then(res => {
-
-                // this.$refs.fileTable.setDate(res);
-                this.workList = res;
-            })
-
-            this.visible = true;
-        },
-
-        fileDetails(row) {
-            this.$refs.browseRef.setFileUrl(row);
-        },
-        async getOrderCode() {
-            this.pickCode = await getCode('pick_order_code');
-        },
-
-        removeItem(idx, index) {
-            this.workList[idx].pickList.splice(index, 1);
-        },
-
-        handleClose() {
-            this.visible = false;
-            this.$emit('close', false);
-        },
-
-        getList() {
-            console.log(123);
-        },
-
-        openPicking(id, item) {
-            this.$refs.pickingListRef.open(id, item);
-        },
-
-        allSelection(id, list) {
-
-            this.workList.forEach((e) => {
-                if (e.id == id) {
-                    e.pickList = list;
-                    this.$forceUpdate();
-                }
+      // datasource({ page, where, limit }) {
+
+      //     let req = {
+      //         "taskId": this.taskId,
+      //         "workOrderId": this.workListIds[0]
+      //     }
+
+      //     return craftFiles({
+      //         ...req,
+      //         pageNum: page,
+      //         size: limit,
+      //     });
+      // },
+
+      open(req) {
+        craftFiles(req).then((res) => {
+          // this.$refs.fileTable.setDate(res);
+          // this.workList = res;
+          console.log(res, 'res');
+          let _ids = [];
+          if (res.length != 0) {
+            res.forEach((e) => {
+              _ids.push(e.id);
             });
-        },
-
-        save() {
-            console.log(this.workList);
-            if (this.workList.length > 0) {
-                let bol;
-                let _i;
-                bol = this.workList.every((e, i) => {
-                    _i = i;
-                    return (
-                        Object.prototype.hasOwnProperty.call(e, 'pickList') &&
-                        e.pickList.length > 0
-                    );
-                });
-
-                if (!bol) {
-                    this.$message.warning(
-                        `生成工单${this.workList[_i].code}领料不能为空`
-                    );
-                    return false;
-                }
-            }
+            const ids = _ids.join(',');
+            this.getFilepProcess(ids);
+          }
+        });
+
+        this.visible = true;
+      },
+
+      async getFilepProcess(ids) {
+        await filePageAPI({
+          ids: "'" + ids + "'"
+        }).then((res) => {
+          this.workList = res;
+        });
+      },
+
+      fileDetails(row) {
+        this.$refs.browseRef.setFileUrl(row);
+      },
+      async getOrderCode() {
+        this.pickCode = await getCode('pick_order_code');
+      },
+
+      removeItem(idx, index) {
+        this.workList[idx].pickList.splice(index, 1);
+      },
+
+      handleClose() {
+        this.visible = false;
+        this.$emit('close', false);
+      },
+
+      getList() {
+        console.log(123);
+      },
+
+      openPicking(id, item) {
+        this.$refs.pickingListRef.open(id, item);
+      },
+
+      allSelection(id, list) {
+        this.workList.forEach((e) => {
+          if (e.id == id) {
+            e.pickList = list;
+            this.$forceUpdate();
+          }
+        });
+      },
+
+      save() {
+        console.log(this.workList);
+        if (this.workList.length > 0) {
+          let bol;
+          let _i;
+          bol = this.workList.every((e, i) => {
+            _i = i;
+            return (
+              Object.prototype.hasOwnProperty.call(e, 'pickList') &&
+              e.pickList.length > 0
+            );
+          });
+
+          if (!bol) {
+            this.$message.warning(
+              `生成工单${this.workList[_i].code}领料不能为空`
+            );
+            return false;
+          }
+        }
+
+        if (this.workList.length > 0) {
+          let name;
+          let bol2;
+          let _i;
+
+          this.workList.forEach((e, i) => {
+            _i = i;
+            console.log(e.pickList);
+            bol2 = e.pickList.every((y) => {
+              name = y.name;
+              return (
+                Object.prototype.hasOwnProperty.call(y, 'demandQuantity') &&
+                Number(y.demandQuantity) > 0
+              );
+            });
+          });
+
+          if (!bol2) {
+            this.$message.warning(
+              `${this.workList[_i].code}的${name}数量不能为空`
+            );
+            return false;
+          }
+        }
 
-            if (this.workList.length > 0) {
-                let name;
-                let bol2;
-                let _i;
-
-                this.workList.forEach((e, i) => {
-                    _i = i;
-                    console.log(e.pickList);
-                    bol2 = e.pickList.every((y) => {
-                        name = y.name;
-                        return (
-                            Object.prototype.hasOwnProperty.call(y, 'demandQuantity') &&
-                            Number(y.demandQuantity) > 0
-                        );
-                    });
-                });
-
-                if (!bol2) {
-                    this.$message.warning(
-                        `${this.workList[_i].code}的${name}数量不能为空`
-                    );
-                    return false;
-                }
+        let _arr = [];
+        _arr = this.workList.map((m) => {
+          m.instanceList = [];
+          m.bomDetailDTOSList = [];
+          m.pickList.forEach((e) => {
+            if (
+              Object.prototype.hasOwnProperty.call(e, 'isBom') &&
+              e.isBom == 1
+            ) {
+              m.bomDetailDTOSList.push(e);
+            } else {
+              m.instanceList.push(e);
             }
+          });
 
-            let _arr = [];
-            _arr = this.workList.map((m) => {
-                m.instanceList = [];
-                m.bomDetailDTOSList = [];
-                m.pickList.forEach((e) => {
-                    if (
-                        Object.prototype.hasOwnProperty.call(e, 'isBom') &&
-                        e.isBom == 1
-                    ) {
-                        m.bomDetailDTOSList.push(e);
-                    } else {
-                        m.instanceList.push(e);
-                    }
-                });
-
-                m.workOrderId = m.id;
-                delete m.id;
-
-                return {
-                    ...m
-                };
-            });
+          m.workOrderId = m.id;
+          delete m.id;
 
-            let param = {
-                allPickList: _arr,
-                pickName: this.pickName,
-                pickCode: this.pickCode
-            };
+          return {
+            ...m
+          };
+        });
 
-            batchSave(param).then((res) => {
-                this.$message.success('领料成功');
-                this.$emit('close', true);
-            });
-        }
+        let param = {
+          allPickList: _arr,
+          pickName: this.pickName,
+          pickCode: this.pickCode
+        };
+
+        batchSave(param).then((res) => {
+          this.$message.success('领料成功');
+          this.$emit('close', true);
+        });
+      }
     },
 
     created() {
-        this.getList();
+      this.getList();
     }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.table_content {
+  .table_content {
     margin-bottom: 10px;
-}
+  }
 
-
-.tableZ_box {
+  .tableZ_box {
     border: 1px solid #e3e5e5;
     margin: 6px 0;
 
     &:last-child {
-        border-bottom: none;
+      border-bottom: none;
     }
 
     .row {
-        width: 100%;
-        display: flex;
+      width: 100%;
+      display: flex;
     }
 
     .col {
-        width: calc(100% / 5);
+      width: calc(100% / 5);
+      display: flex;
+      align-items: center;
+      min-width: 200px;
+      min-height: 32px;
+      border-bottom: 1px solid #e3e5e5;
+      border-right: 1px solid #e3e5e5;
+
+      &:last-child {
+        border-right: none;
+      }
+
+      .name {
         display: flex;
         align-items: center;
-        min-width: 200px;
-        min-height: 32px;
-        border-bottom: 1px solid #e3e5e5;
-        border-right: 1px solid #e3e5e5;
-
-        &:last-child {
-            border-right: none;
-        }
-
-        .name {
-            display: flex;
-            align-items: center;
-            padding: 4px;
-            width: 80px;
-            height: 100%;
-            background-color: #d0e4d5;
-            color: #000;
-        }
-
-        .content {
-            padding: 4px 6px;
-            color: #000;
-        }
+        padding: 4px;
+        width: 80px;
+        height: 100%;
+        background-color: #d0e4d5;
+        color: #000;
+      }
+
+      .content {
+        padding: 4px 6px;
+        color: #000;
+      }
     }
 
     .pd6 {
-        padding: 0 6px;
+      padding: 0 6px;
     }
-}
+  }
 </style>
 
 <style>
-:v-deep .el-form-item__error {
+  :v-deep .el-form-item__error {
     bottom: -6px !important;
-}
-</style>
+  }
+</style>