695593266@qq.com il y a 1 an
Parent
commit
5ffa5b72d2

+ 47 - 19
src/api/produce/picking.js

@@ -1,28 +1,24 @@
 import request from '@/utils/request';
 
-
-
 // 领料保存
 export async function batchSave(data) {
-    const res = await request.post(`/mes/pickorder/pcBatchSave`, data);
-    if (res.data.code == 0) {
-      return res.data.data;
-    }
-    return Promise.reject(new Error(res.data.message));
+  const res = await request.post(`/mes/pickorder/pcBatchSave`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
   }
+  return Promise.reject(new Error(res.data.message));
+}
 
-  // 中能领料保存
+// 中能领料保存
 export async function znfindVoucherList(data) {
-    const res = await request.post(`/mes/workorder/findVoucherList`, data);
-    if (res.data.code == 0) {
-      return res.data.data;
-    }
-    return Promise.reject(new Error(res.data.message));
+  const res = await request.post(`/mes/workorder/findVoucherList`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
   }
-  
- 
+  return Promise.reject(new Error(res.data.message));
+}
 
-  // 领料单详细信息
+// 领料单详细信息
 export async function pickDetails(data) {
   const res = await request.post(`/pda/mes/pickorder/list`, data);
   if (res.data.code == 0) {
@@ -31,8 +27,6 @@ export async function pickDetails(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 非生产性领料保存
 export async function unproductive(data) {
   const res = await request.post(`/mes/pickorder/unproductive`, data);
@@ -40,4 +34,38 @@ export async function unproductive(data) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+export async function checkOutsource(param) {
+  const res = await request.get(`/mes/applyoutsource/checkOutsource/`, param);
+
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据工单工序查已入库的委外申请
+
+export async function listOutsource(wordId, taskId) {
+  const res = await request.get(
+    `/mes/applyoutsource/listOutsource?workOrderId=${wordId}&taskId=${taskId}`
+  );
+
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function listOutsourceInWarehouse(params) {
+  const res = await request.post(
+    `/mes/applyoutsource/listOutsourceInWarehouse`,
+    params,
+    true
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 29 - 0
src/views/produce/components/inspection/index.vue

@@ -312,6 +312,35 @@
         // })
         // this.List[0].semiProductList = res;
         this.$set(this.List[0], 'semiProductList', res);
+        // console.log(this.List[0], 'this.List[0]');
+
+        this.List[0].semiProductList = this.List[0].semiProductList.map(
+          (item) => {
+            item.workReportInfo = {
+              formingNum: null,
+              formingWeight: null,
+              formedNum: null,
+              formedWeight: null,
+              taskId: this.taskObj.id,
+              executorTime: null
+            };
+
+            item.notFormedList = [
+              {
+                notFormedNum: null,
+                notFormedWeight: null,
+                weightUnit: res.weightUnit,
+                unit: res.unit,
+                warehouseId: null // 处置 仓库id
+              }
+            ];
+
+            return {
+              ...item
+            };
+          }
+        );
+
         console.log(this.List[0], 'this.List[0]');
 
         // this.$refs.newQualityTestingRef[0].open(this.List[0].semiProductList);

+ 18 - 17
src/views/produce/components/jobBooking/components/semiProductJobBom.vue

@@ -435,22 +435,22 @@
           this.changeHeatNumber();
           this.getCodeData();
         }
+      },
+      list: {
+        immediate: true,
+        deep: true,
+        handler(newVal) {
+          console.log('aaaaaa', newVal);
+          if (newVal.length) {
+            console.log(newVal);
+            this.newList = newVal;
+            // if(this.taskObj.type != 4){
+            this.sumweight(newVal);
+            this.sunTj();
+            // }
+          }
+        }
       }
-      // list: {
-      //   immediate: true,
-      //   deep: true,
-      //   handler(newVal) {
-      //     console.log('aaaaaa', newVal);
-      //     if (newVal.length) {
-      //       console.log(newVal);
-      //       this.newList = newVal;
-      //       // if(this.taskObj.type != 4){
-      //       this.sumweight(newVal);
-      //       this.sunTj();
-      //       // }
-      //     }
-      //   }
-      // }
     },
     computed: {
       taskObj() {
@@ -478,7 +478,8 @@
             type: 'selection',
             columnKey: 'selection',
             align: 'center',
-            fixed: 'left'
+            fixed: 'left',
+            reserveSelection: true
           },
           {
             width: 55,
@@ -1026,7 +1027,7 @@
       },
 
       save() {
-        if (this.item.currentTaskDiagram.isFirstTask == 1) {
+        if (this.item?.currentTaskDiagram?.isFirstTask == 1) {
           this.resultObj = {};
 
           if (Number(this.reportWeight) < Number(this.paramList[0].CVIWeight)) {

+ 29 - 3
src/views/produce/components/jobBooking/index.vue

@@ -262,6 +262,23 @@
           ></semiProductJobBom>
         </div>
 
+        <div
+          v-if="
+            item.currentTaskDiagram.type == 4 && item.pickOutInList.length != 0
+          "
+        >
+          <semiProductJobBom
+            :singleReport="item.singleReport"
+            :item="item"
+            :list="
+              item.currentTaskDiagram.type == 4
+                ? item.pickOutInList
+                : item.semiProductList
+            "
+            :equipmentList="item.equipmentList"
+          ></semiProductJobBom>
+        </div>
+
         <!--  <packingBom :taskId='taskObj.id' :workOrderId="item.workOrderId" :objData="item" ref="packRef"
           v-if='taskObj.type == 4 && clientEnvironmentId != 3 && item'></packingBom> -->
 
@@ -646,9 +663,18 @@
           return res;
         });
 
-        const confirmList = this.List[0].semiProductList.filter(
-          (item) => item.confirm == 1
-        );
+        let confirmList = [];
+
+        // const confirmList = this.List[0].semiProductList.filter(
+        //   (item) => item.confirm == 1
+        // );
+        this.List.forEach((item) => {
+          item.semiProductList.forEach((it) => {
+            if (it.confirm == 1) {
+              confirmList.push(it);
+            }
+          });
+        });
 
         if (required.value == '1') {
           // if (this.chooseListData.length > 0) {

+ 77 - 19
src/views/produce/components/picking/details.vue

@@ -21,7 +21,12 @@
             @click="handleAdd"
             >新增</el-button
           >
-          <!-- <el-button type="primary" size="mini" @click="openOutsourcingPicking()">委外领料</el-button> -->
+          <el-button
+            type="primary"
+            size="mini"
+            @click="openOutsourcingPicking()"
+            >委外领料</el-button
+          >
         </div>
       </template>
 
@@ -47,30 +52,43 @@
       :detailedObj="detailedObj"
     ></detailed>
 
-    <outsourcingPickingList
+    <!-- <outsourcingPickingList
       v-if="outsourcingPickingShow"
       ref="outsourcingPickingListRef"
+      :workTaskId="workListIds[0]"
+      :taskId="taskId"
+      :workList="workList"
       @closeOutsourcingPicking="closeOutsourcingPicking"
-    ></outsourcingPickingList>
+    ></outsourcingPickingList> -->
+
+    <picking
+      v-if="pickingShow"
+      @close="pickingClose"
+      :workListIds="workListIds"
+    ></picking>
   </div>
 </template>
 
 <script>
   import { pickDetails } from '@/api/produce/picking';
+  import { workorderList } from '@/api/produce/workOrder';
   import detailed from './detailed.vue';
   import outsourcingPickingList from './outsourcingPickingList.vue';
   import { getTaskInstanceById } from '@/api/produce/index';
+  import { checkOutsource, listOutsource } from '@/api/produce/picking';
+  import picking from './outsourceIndex.vue';
 
   import { boolean } from 'mathjs';
   export default {
     name: 'picking-details',
-    components: { detailed, outsourcingPickingList },
+    components: { detailed, outsourcingPickingList, picking },
     props: {
       isDetails: {
         type: Boolean,
         default: false
       },
-      workTaskId: {}
+      workTaskId: {},
+      taskId: {}
     },
     data() {
       return {
@@ -79,7 +97,9 @@
         detailedObj: null,
 
         statusList: ['未领料', '领料中', '已出库', '已驳回'],
-        outsourcingPickingShow: false
+        outsourcingPickingShow: false,
+        workList: [],
+        pickingShow: false
       };
     },
 
@@ -190,21 +210,59 @@
       closeOutsourcingPicking() {
         this.outsourcingPickingShow = false;
       },
+
+      pickingClose() {
+        this.pickingShow = false;
+      },
+
       //获取工单列表
       getTaskInstanceByIdFn() {
-        getTaskInstanceById(this.workListIds[0]).then((res) => {
-          // console.log(res,this.workTaskId, 'res2345678');
-          let { data } = res;
-          if (data.length) {
-            let arr = data.filter((item) => item.taskId == this.workTaskId);
-            console.log(arr, this.workTaskId, 'res2345678');
-            if (arr[0].existOutsource) {
-              this.outsourcingPickingShow = true;
-            } else {
-              this.$message.warning('当前工序不能委外领料');
-            }
-          }
-        });
+        console.log(this.taskId, 'this.tasworkTaskIdkId');
+        console.log(this.workListIds[0], 'this.workListIds[0]');
+        this.pickingShow = true;
+        // let param = {
+        //   ids: [this.workListIds[0]],
+        //   taskId: this.taskId
+        // };
+        // workorderList(param)
+        //   .then((res) => {
+        //     let _arr = res.map((e) => {
+        //       e.pickList = [...e.bomDetailDTOS];
+        //       e.bomDetailDTOS = [];
+        //       return e;
+        //     });
+
+        //     this.workList = JSON.parse(JSON.stringify(_arr));
+
+        //     console.log(this.workList, 'this.workList');
+        //     this.outsourcingPickingShow = true;
+
+        // this.getOutsourcingDataList(
+        //   this.workList[0].currentTaskDiagram.taskId
+        // );
+
+        // this.$forceUpdate();
+        // })
+        // .finally(() => {});
+        // checkOutsource({
+        //   ids: [this.workListIds[0]],
+        //   taskId: this.workTaskId
+        // }).then((res) => {
+        //   console.log(res);
+        // });
+        // getTaskInstanceById(this.workListIds[0]).then((res) => {
+        //   // console.log(res,this.workTaskId, 'res2345678');
+        //   let { data } = res;
+        //   if (data.length) {
+        //     let arr = data.filter((item) => item.taskId == this.workTaskId);
+        //     console.log(arr, 'arr');
+        //     console.log(arr, this.workTaskId, 'res2345678');
+        //     if (arr[0].existOutsource) {
+        //     } else {
+        //       this.$message.warning('当前工序不能委外领料');
+        //     }
+        //   }
+        // });
       }
     },
     created() {}

+ 2 - 2
src/views/produce/components/picking/index.vue

@@ -303,7 +303,7 @@
               e.bomDetailDTOS = [];
               return e;
             });
-            this.pickName = res[0].batchNo || '' + res[0].bomCategoryId || '';
+            this.pickName = res[0].productName + '领料';
 
             // arr.bomDetailDTOS.map(v=>{
             //   this.getInventoryTotalFn(v.id)
@@ -328,7 +328,7 @@
               e.bomDetailDTOS = [];
               return e;
             });
-            this.pickName = res[0].batchNo + res[0].bomCategoryId;
+            this.pickName = res[0].productName + '领料';
 
             // arr.bomDetailDTOS.map(v=>{
             //   this.getInventoryTotalFn(v.id)

+ 620 - 0
src/views/produce/components/picking/outsourceIndex.vue

@@ -0,0 +1,620 @@
+<template>
+  <ele-modal
+    title="领料单"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :maxable="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <el-form>
+      <el-row :gutter="24">
+        <el-col :span="6">
+          <el-form-item label="领料单编号" prop="pickCode" label-width="90px">
+            <el-input v-model="pickCode" disabled=""></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="6">
+          <el-form-item label="领料单名称" prop="pickName" label-width="90px">
+            <el-input v-model="pickName" style="width: 260px"></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <div v-for="(item, idx) in workList" :key="idx">
+      <el-form
+        :ref="`formRef${idx}`"
+        :model="{ pickList: item }"
+        :rules="tableRules"
+        size="mini"
+        label-position="left"
+      >
+        <div class="tableZ_box">
+          <div class="row">
+            <div class="col">
+              <div class="name">生产工单号</div>
+              <div class="content">{{ item.code }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品编码</div>
+              <div class="content">{{ item.productCode }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品名称</div>
+              <div class="content">{{ item.productName }}</div>
+            </div>
+            <div class="col">
+              <div class="name">批次号</div>
+              <div class="content">{{ item.batchNo }}</div>
+            </div>
+            <div class="col pd6" v-if="clientEnvironmentId != 21">
+              <el-button type="primary" size="mini" @click="openPicking()"
+                >获取委外单</el-button
+              >
+            </div>
+          </div>
+        </div>
+
+        <div>
+          <el-table
+            :ref="`tableRef${idx}`"
+            class="table_content"
+            :max-height="300"
+            :data="item.pickList"
+            tooltip-effect="dark"
+            style="width: 100%"
+            stripe
+            border
+          >
+            <el-table-column label="序号" type="index" width="60">
+              <template slot-scope="{ row, $index }">
+                {{ $index }}
+              </template>
+            </el-table-column>
+
+            <el-table-column label="类型" prop="rootCategoryLevelId" width="80">
+              <template slot-scope="{ row, $index }">
+                <el-tag size="mini">{{
+                  typeName[Number(row.rootCategoryLevelId)]
+                }}</el-tag>
+              </template>
+            </el-table-column>
+
+            <el-table-column label="编码" prop="assetCode">
+              <template slot-scope="{ row, $index }">
+                <span
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                  style="color: #faad14"
+                >
+                  {{ row.categoryCode }}
+                </span>
+                <span>
+                  {{
+                    row.rootCategoryLevelId == 4 ? row.codeNumber : row.code
+                  }}</span
+                >
+              </template>
+            </el-table-column>
+
+            <el-table-column label="名称" prop="name">
+              <template slot-scope="{ row, $index }">
+                <span
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                >
+                  {{ row.categoryName }}
+                </span>
+                <span> {{ row.name }}</span>
+                <span v-if="row.isOut" style="color: #faad14"> (委外) </span>
+              </template>
+            </el-table-column>
+            <el-table-column label="型号" prop="modelType"> </el-table-column>
+            <el-table-column label="规格" prop="specification">
+            </el-table-column>
+            <el-table-column label="批次号" prop="batchNo"> </el-table-column>
+
+            <el-table-column label="数量" prop="demandQuantity">
+              <template slot-scope="{ row, $index }">
+                <el-form-item>
+                  <el-input
+                    v-model="row.demandQuantity"
+                    @input="
+                      row.demandQuantity > row.availableCountBase
+                        ? (row.demandQuantity = row.availableCountBase)
+                        : row.demandQuantity
+                    "
+                    size="mini"
+                    style="width: 150px"
+                  >
+                    <template slot="append">{{ row.measuringUnit }}</template>
+                  </el-input>
+                </el-form-item>
+              </template>
+            </el-table-column>
+
+            <el-table-column label="计量库存数量" prop="availableCountBase">
+              <template slot-scope="{ row, $index }">
+                {{ row.availableCountBase }} {{ row.measuringUnit }}
+              </template>
+            </el-table-column>
+
+            <el-table-column label="领料仓库" prop="warehouseId">
+              <template slot-scope="{ row, $index }">
+                <div
+                  v-if="
+                    Object.prototype.hasOwnProperty.call(row, 'isBom') &&
+                    row.isBom == 1
+                  "
+                >
+                  <el-select
+                    v-model="row.warehouseId"
+                    placeholder="请选择"
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in row.warehouseList"
+                      :label="item.name"
+                      :value="item.id"
+                      :key="item.id"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+                <div v-else-if="clientEnvironmentId == 21">
+                  <el-select
+                    v-model="row.warehouseId"
+                    placeholder="请选择"
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in row.warehouseList"
+                      :label="item.name"
+                      :value="item.id"
+                      :key="item.id"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+
+                <div v-else-if="row.warehouseName">
+                  <span>{{ row.warehouseName }}</span>
+                </div>
+
+                <div v-else>
+                  <el-select
+                    v-model="row.warehouseId"
+                    placeholder="请选择"
+                    filterable
+                  >
+                    <el-option
+                      v-for="item in row.warehouseLists"
+                      :label="item.warehouse_name"
+                      :value="item.warehouse_id"
+                      :key="item.warehouse_id"
+                    >
+                    </el-option>
+                  </el-select>
+                </div>
+              </template>
+            </el-table-column>
+
+            <el-table-column label="操作" fixed="right" width="100px">
+              <template slot-scope="{ $index, row }">
+                <el-link type="danger" @click="removeItem(idx, $index)"
+                  >删除</el-link
+                >
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </el-form>
+    </div>
+
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button
+        size="mini"
+        type="primary"
+        :loading="loadingBtn"
+        @click="save()"
+        >确 定</el-button
+      >
+    </template>
+
+    <!-- <pickingList
+      isType="pick"
+      ref="pickingListRef"
+      @allSelection="allSelection"
+    ></pickingList> -->
+
+    <outsourcingPickingList
+      v-if="outsourcingPickingShow"
+      ref="outsourcingPickingListRef"
+      :workTaskId="workListIds[0]"
+      :taskId="taskObj.id"
+      @closeOutsourcingPicking="closeOutsourcingPicking"
+      @outsourceEmit="outsourceEmit"
+    ></outsourcingPickingList>
+  </ele-modal>
+</template>
+
+<script>
+  import pickingList from './pickingList.vue';
+  import {
+    workorderList,
+    getCode,
+    getInventoryTotal,
+    znworkorderList
+  } from '@/api/produce/workOrder';
+  import { typeName } from '../common.js';
+  import {
+    batchSave,
+    znfindVoucherList,
+    listOutsourceInWarehouse
+  } from '@/api/produce/picking';
+  import outsourcingPickingList from './outsourcingPickingList.vue';
+
+  export default {
+    components: {
+      pickingList,
+      outsourcingPickingList
+    },
+    props: {
+      workListIds: {
+        type: Array,
+        default() {
+          return [];
+        }
+      }
+    },
+
+    data() {
+      return {
+        visible: true,
+        workList: [],
+        rules: {},
+
+        pickCode: null,
+        pickName: null,
+
+        typeName,
+
+        tableRules: {},
+        loadingBtn: false,
+        outsourcingPickingShow: false
+      };
+    },
+    computed: {
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      },
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+
+    watch: {},
+    methods: {
+      getList() {
+        let param = {
+          ids: this.workListIds,
+          taskId: this.taskObj.id
+        };
+        console.log('1111122222', this.clientEnvironmentId);
+        if (this.clientEnvironmentId == 21) {
+          znworkorderList(param).then((res) => {
+            let arr = res.map((e) => {
+              e.bomDetailDTOS.map((d) => {
+                e.warehouseId =
+                  d.warehouseList.length > 0 ? d.warehouseList[0].id : '';
+              });
+              e.pickList = [...e.bomDetailDTOS];
+              e.bomDetailDTOS = [];
+              return e;
+            });
+            this.pickName = res[0].productName + '领料';
+
+            // arr.bomDetailDTOS.map(v=>{
+            //   this.getInventoryTotalFn(v.id)
+            // })
+
+            // getInventoryTotal
+            // this.workList = arr;
+            this.$set(this, 'workList', arr);
+
+            this.getOrderCode();
+            this.$forceUpdate();
+          });
+        } else {
+          workorderList(param).then((res) => {
+            let arr = res.map((e) => {
+              e.bomDetailDTOS.map((d) => {
+                e.warehouseId =
+                  d.warehouseList.length > 0 ? d.warehouseList[0].id : '';
+                // this.getInventoryTotalFn([d.categoryCode])
+              });
+              e.pickList = [...e.bomDetailDTOS];
+              e.bomDetailDTOS = [];
+              return e;
+            });
+            this.pickName = res[0].productName + '领料';
+
+            // arr.bomDetailDTOS.map(v=>{
+            //   this.getInventoryTotalFn(v.id)
+            // })
+
+            // getInventoryTotal
+            // this.workList = arr;
+            this.$set(this, 'workList', arr);
+
+            this.getOrderCode();
+            this.getInventoryTotalFn();
+            this.$forceUpdate();
+          });
+        }
+      },
+
+      async getInventoryTotalFn(id) {
+        let ids = [];
+        this.workList.map((item) => {
+          item.pickList.map((pitem) => {
+            ids.push(pitem.categoryCode);
+          });
+        });
+
+        if (ids.length == 0) {
+          return;
+        }
+
+        const res = await getInventoryTotal(ids);
+        res.map((ritem) => {
+          this.workList.map((item) => {
+            item.pickList.map((pitem) => {
+              if (pitem.categoryCode == ritem.code) {
+                pitem.availableCountBase = ritem.availableCountBase;
+              }
+            });
+          });
+        });
+        console.log('cashasisasa', res);
+      },
+
+      async getOrderCode() {
+        console.log(this.workListIds, '555555');
+        this.pickCode = await getCode('pick_order_code');
+      },
+
+      removeItem(idx, index) {
+        this.workList[idx].pickList.splice(index, 1);
+      },
+
+      handleClose() {
+        this.loadingBtn = false;
+        this.$emit('close', false);
+      },
+
+      outsourceEmit(list) {
+        this.closeOutsourcingPicking();
+        let param = {
+          outsourceOrder: list || [],
+          workOrderId: this.workListIds[0],
+          taskId: this.taskObj.id
+        };
+        listOutsourceInWarehouse(param).then((res) => {
+          let indexList = [];
+
+          res.list.forEach((item) => {
+            item.isOut = 1;
+            this.workList[0].pickList.forEach((i, index) => {
+              if (i.categoryId == item.categoryId) {
+                indexList.push(index);
+              }
+            });
+          });
+
+          if (indexList.length > 0) {
+            indexList.forEach((i) => {
+              this.workList[0].pickList.splice(i, 1);
+            });
+          }
+
+          let _arr = [...this.workList[0].pickList, ...res.list];
+
+          this.$set(this.workList[0], 'pickList', _arr);
+          this.$forceUpdate();
+          console.log(this.workList[0], 'this.workList[0]');
+        });
+      },
+
+      openPicking(id, item) {
+        this.outsourcingPickingShow = true;
+        // 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, 'cvassasasag');
+        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;
+          }
+        }
+
+        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
+          };
+        });
+        this.loadingBtn = true;
+        // if (this.clientEnvironmentId == 21) {
+        //   let param = {
+        //     workOrderId: this.workListIds[0],
+        //     pickingCode: this.pickCode
+        //   };
+        //   znfindVoucherList(param).then((res) => {
+        //     this.loadingBtn = false;
+        //     this.$message.success('领料成功');
+        //   });
+        // }
+        let param = {
+          allPickList: _arr,
+          pickName: this.pickName,
+          pickCode: this.pickCode
+        };
+        batchSave(param).then((res) => {
+          this.loadingBtn = false;
+          this.$message.success('领料成功');
+          this.$emit('close', true);
+        });
+      },
+
+      closeOutsourcingPicking() {
+        this.outsourcingPickingShow = false;
+      }
+    },
+
+    created() {
+      this.getList();
+    },
+
+    mounted() {
+      this.$nextTick(() => {
+        // this.outsourcingPickingShow = true;
+        setTimeout(() => {
+          // this.outsourcingPickingShow = true;
+        }, 5000);
+      });
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .table_content {
+    margin-bottom: 10px;
+  }
+
+  .tableZ_box {
+    border: 1px solid #e3e5e5;
+    margin: 6px 0;
+
+    &:last-child {
+      border-bottom: none;
+    }
+
+    .row {
+      width: 100%;
+      display: flex;
+    }
+
+    .col {
+      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;
+        padding: 4px;
+        width: 80px;
+        height: 100%;
+        background-color: #d0e4d5;
+        color: #000;
+      }
+
+      .content {
+        padding: 4px 6px;
+        color: #000;
+      }
+    }
+
+    .pd6 {
+      padding: 0 6px;
+    }
+  }
+</style>
+
+<style>
+  :v-deep .el-form-item__error {
+    bottom: -6px !important;
+  }
+</style>

+ 363 - 91
src/views/produce/components/picking/outsourcingPickingList.vue

@@ -1,133 +1,405 @@
 <template>
-  <ele-modal title="委外领料" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+  <ele-modal
+    title="委外领料"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
     :maxable="true"
-    :close-on-press-escape="false" append-to-body width="60%">
-    
+    :close-on-press-escape="false"
+    append-to-body
+    width="68%"
+  >
+    <div>
+      <el-form :model="pickForm" ref="pickForm">
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item label="领料单编号" prop="pickCode" label-width="90px">
+              <el-input v-model="pickForm.pickCode" disabled></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="6">
+            <el-form-item label="领料单名称" prop="pickName" label-width="90px">
+              <el-input v-model="pickForm.pickName"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div v-for="(item, idx) in workList" :key="idx">
+        <div class="tableZ_box">
+          <div class="row">
+            <div class="col">
+              <div class="name">生产工单号</div>
+              <div class="content">{{ item.code }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品编码</div>
+              <div class="content">{{ item.productCode }}</div>
+            </div>
+            <div class="col">
+              <div class="name">产品名称</div>
+              <div class="content">{{ item.productName }}</div>
+            </div>
+            <div class="col">
+              <div class="name">批次号</div>
+              <div class="content">{{ item.batchNo }}</div>
+            </div>
+          </div>
+        </div>
+      </div>
+
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :cache-key="cacheKeyUrl"
+        :selection.sync="selection"
+        :datasource="outsourcingList"
+        @selection-change="handleSelectionChange"
+        row-key="id"
+      >
+        <template v-slot:deliveryMethod="{ row, $index }">
+          <span>{{ row.deliveryMethod == 2 ? '分批到货' : '一次到货' }}</span>
+        </template>
+
+        <template v-slot:purchaseQuantity="{ row, $index }">
+          <span v-if="row.deliveryMethod == 2">{{ row.purchaseQuantity }}</span>
+          <span v-else>{{ row.totalCount }}</span>
+        </template>
+
+        <template v-slot:batchNo="{ row, $index }">
+          <span v-if="row.batchNo && row.deliveryMethod == 2">{{
+            row.batchNo
+          }}</span>
+        </template>
+
+        <template v-slot:requireDeliveryTime="{ row, $index }">
+          <span v-if="row.deliveryMethod == 2">{{
+            row.requireDeliveryTime
+          }}</span>
+          <span v-else>{{ row.requireDeliveryTime }}</span>
+        </template>
+      </ele-pro-table>
+    </div>
 
     <template slot="footer">
       <el-button size="mini" @click="handleClose">取 消</el-button>
       <el-button size="mini" type="primary" @click="save()">确 定</el-button>
     </template>
-
   </ele-modal>
 </template>
 
 <script>
-import pickingList from './pickingList.vue';
-import { workorderList, getCode,getInventoryTotal,znworkorderList } from '@/api/produce/workOrder';
-import { typeName } from '../common.js';
-import { batchSave,znfindVoucherList } from '@/api/produce/picking';
-
-export default {
-  components: {
-    pickingList
-  },
-  props: {
-    workListIds: {
-      type: Array,
-      default() {
-        return [];
-      }
-    }
-  },
-
-  data() {
-    return {
-      visible: true,
-     
-    };
-  },
-  computed: {
-    taskObj() {
-      return this.$store.state.user.taskObj;
+  import pickingList from './pickingList.vue';
+  import {
+    workorderList,
+    getCode,
+    getInventoryTotal,
+    znworkorderList
+  } from '@/api/produce/workOrder';
+  import { typeName } from '../common.js';
+  import { batchSave, znfindVoucherList } from '@/api/produce/picking';
+  import { getWarehouseList } from '@/api/mes';
+  import { checkOutsource, listOutsource } from '@/api/produce/picking';
+
+  export default {
+    components: {
+      pickingList
+    },
+    props: {
+      // workListIds: {
+      //   type: Array,
+      //   default() {
+      //     return [];
+      //   }
+      // },
+      workTaskId: {},
+      taskId: {}
+      // workList: {
+      //   type: Array,
+      //   default() {
+      //     return [];
+      //   }
+      // }
+    },
+
+    data() {
+      return {
+        visible: true,
+        cacheKeyUrl: 'out-sourcing-picking-list',
+        selection: [],
+        warehouseList: [],
+        pickForm: {
+          pickCode: null,
+          pickName: null
+        },
+        workList: [],
+        outsourcingList: [],
+        chooseData: []
+      };
     },
-    clientEnvironmentId() {
-      return this.$store.state.user.info.clientEnvironmentId;
-    }
-  },
 
-  watch: {},
-  methods: {
-    
+    computed: {
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      },
+      tableKey() {
+        return `table-${this.rootCategoryLevelId}`;
+      },
 
-   
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 50,
+            align: 'center'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            width: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            width: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            width: 120,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            slot: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'deliveryMethod',
+            slot: 'deliveryMethod',
+            label: '委外类型',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'purchaseQuantity',
+            label: '委外数量',
+            width: 120,
+            align: 'center',
+            slot: 'purchaseQuantity'
+          },
+          {
+            prop: 'requireDeliveryTime',
+            label: '委外时间',
+            width: 160,
+            align: 'center',
+            slot: 'requireDeliveryTime'
+          }
+        ];
+      }
+    },
 
+    watch: {},
 
-    handleClose() {
-      this.$emit('closeOutsourcingPicking', false);
+    mounted() {
+      console.log(22222222222222222);
+      // this.$nextTick(() => {
+      this.getList();
+      this.getOrderCode();
+      // });
+      // this.getList();
+      // this.getOrderCode();
+      // this.getOutsourcingDataList();
+      // this.pickForm.pickName = this.workList[0].productName + '领料';
     },
 
-   
+    methods: {
+      handleClose() {
+        this.$emit('closeOutsourcingPicking', false);
+      },
 
-    save() {
-      
-      
+      handleSelectionChange(data) {
+        this.chooseData = data;
+      },
 
-      
-    }
-  },
+      save() {
+        if (this.chooseData.length > 0) {
+          let _arr = [];
+          this.chooseData.forEach((item) => {
+            _arr.push({
+              id: item.id,
+              code: item.code,
+              batchNo: item.batchNo
+            });
+          });
+          this.$emit('outsourceEmit', _arr);
+        }
+      },
 
-  created() {
-  }
-};
-</script>
+      getOutsourcingDataList(id) {
+        listOutsource(this.workTaskId, id).then((res) => {
+          this.outsourcingList = res;
+        });
+      },
 
-<style lang="scss" scoped>
-.table_content {
-  margin-bottom: 10px;
-}
+      getList() {
+        let param = {
+          ids: [this.workTaskId],
+          taskId: this.taskId
+        };
+        console.log(11111111111111);
+        workorderList(param)
+          .then((res) => {
+            console.log(res, 'res');
+            let _arr = res.map((e) => {
+              e.pickList = [...e.bomDetailDTOS];
+              e.bomDetailDTOS = [];
+              return e;
+            });
 
+            this.workList = JSON.parse(JSON.stringify(_arr));
 
-.tableZ_box {
-  border: 1px solid #e3e5e5;
-  margin: 6px 0;
+            console.log(this.workList, 'this.workList');
+            this.pickForm.pickName = this.workList[0].productName + '领料';
 
-  &:last-child {
-    border-bottom: none;
-  }
+            this.getOutsourcingDataList(
+              this.workList[0].currentTaskDiagram.taskId
+            );
 
-  .row {
-    width: 100%;
-    display: flex;
+            this.$forceUpdate();
+          })
+          .finally(() => {});
+      },
+      async getOrderCode() {
+        this.pickForm.pickCode = await getCode('pick_order_code');
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .table_content {
+    margin-bottom: 10px;
   }
 
-  .col {
-    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;
+  .tableZ_box {
+    border: 1px solid #e3e5e5;
+    margin: 6px 0;
 
     &:last-child {
-      border-right: none;
+      border-bottom: none;
+    }
+
+    .row {
+      width: 100%;
+      display: flex;
     }
 
-    .name {
+    .col {
+      width: calc(100% / 5);
       display: flex;
       align-items: center;
-      padding: 4px;
-      width: 80px;
-      height: 100%;
-      background-color: #d0e4d5;
-      color: #000;
+      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;
+      }
     }
 
-    .content {
-      padding: 4px 6px;
-      color: #000;
+    .pd6 {
+      padding: 0 6px;
     }
   }
+</style>
 
-  .pd6 {
-    padding: 0 6px;
+<style scoped lang="scss">
+  :v-deep .el-form-item__error {
+    bottom: -6px !important;
   }
-}
-</style>
 
-<style>
-:v-deep .el-form-item__error {
-  bottom: -6px !important;
-}
+  .tableZ_box {
+    border: 1px solid #e3e5e5;
+    margin: 6px 0;
+
+    &:last-child {
+      border-bottom: none;
+    }
+
+    .row {
+      width: 100%;
+      display: flex;
+    }
+
+    .col {
+      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;
+        padding: 4px;
+        width: 80px;
+        height: 100%;
+        background-color: #d0e4d5;
+        color: #000;
+      }
+
+      .content {
+        padding: 4px 6px;
+        color: #000;
+      }
+    }
+
+    .pd6 {
+      padding: 0 6px;
+    }
+  }
 </style>

+ 2 - 2
src/views/produce/components/warehousing/components/jobDdBom.vue

@@ -139,7 +139,7 @@
           </div>
         </div>
 
-        <div class="item rx-sc">
+        <!-- <div class="item rx-sc">
           <div class="rx ww40">
             <div class="lable rx-cc">仓库</div>
             <div class="content content_num rx-sc">
@@ -179,7 +179,7 @@
               </el-select>
             </div>
           </div>
-        </div>
+        </div> -->
       </div>
 
       <!-- <view class="select_box" v-if="clientEnvironmentId !== 3">

+ 120 - 134
src/views/produce/components/warehousing/index.vue

@@ -43,47 +43,48 @@
             item.toWarehouseList &&
             item.toWarehouseList.length > 0
           "
-          class="item"
         >
-          <div>
-            <div class="text">仓库</div>
-            <div class="select-type">
-              <el-select
-                v-model="warehouseId"
-                filterable
-                clearable
-                placeholder="请选择仓库"
-                size="mini"
-                class="content_num"
-              >
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :value="item.id"
-                  :label="item.name"
-                ></el-option>
-              </el-select>
+          <div class="item">
+            <div>
+              <div class="text">仓库</div>
+              <div class="select-type">
+                <el-select
+                  v-model="warehouseId"
+                  filterable
+                  clearable
+                  placeholder="请选择仓库"
+                  size="mini"
+                  class="content_num"
+                >
+                  <el-option
+                    v-for="item in warehouseList"
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.name"
+                  ></el-option>
+                </el-select>
+              </div>
             </div>
-          </div>
 
-          <div>
-            <div class="text">入库规格</div>
-            <div class="select-type">
-              <el-select
-                v-model="inWarehouseSpecType"
-                filterable
-                clearable
-                placeholder="请选择入库规格"
-                size="mini"
-                class="content_num select-warehousing"
-              >
-                <el-option
-                  v-for="item in WarehouseSpecTypeList"
-                  :key="item.value"
-                  :label="item.text"
-                  :value="item.value"
-                ></el-option>
-              </el-select>
+            <div>
+              <div class="text">入库规格</div>
+              <div class="select-type">
+                <el-select
+                  v-model="inWarehouseSpecType"
+                  filterable
+                  clearable
+                  placeholder="请选择入库规格"
+                  size="mini"
+                  class="content_num select-warehousing"
+                >
+                  <el-option
+                    v-for="item in WarehouseSpecTypeList"
+                    :key="item.value"
+                    :label="item.text"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+              </div>
             </div>
           </div>
           <!-- <div style="margin-top: 6px">
@@ -120,68 +121,51 @@
             (item.currentTaskDiagram.type == 5 && item.singleReport == 1)
           "
         >
-          <div
-            v-if="item.toWarehouseList && item.toWarehouseList.length > 0"
-            class="item"
-          >
-            <div>
-              <div class="text">仓库</div>
-              <div class="select-type">
-                <el-select
-                  v-model="warehouseId"
-                  filterable
-                  clearable
-                  placeholder="请选择仓库"
-                  size="mini"
-                  class="content_num"
-                >
-                  <el-option
-                    v-for="item in warehouseList"
-                    :key="item.id"
-                    :value="item.id"
-                    :label="item.name"
-                  ></el-option>
-                </el-select>
+          <div v-if="item.toWarehouseList && item.toWarehouseList.length > 0">
+            <div class="item">
+              <div>
+                <div class="text">仓库</div>
+                <div class="select-type">
+                  <el-select
+                    v-model="warehouseId"
+                    filterable
+                    clearable
+                    placeholder="请选择仓库"
+                    size="mini"
+                    class="content_num"
+                  >
+                    <el-option
+                      v-for="item in warehouseList"
+                      :key="item.id"
+                      :value="item.id"
+                      :label="item.name"
+                    ></el-option>
+                  </el-select>
+                </div>
               </div>
-            </div>
 
-            <div>
-              <div class="text">入库规格</div>
-              <div class="select-type">
-                <el-select
-                  v-model="inWarehouseSpecType"
-                  filterable
-                  clearable
-                  placeholder="请选择入库规格"
-                  size="mini"
-                  class="content_num select-warehousing"
-                >
-                  <el-option
-                    v-for="item in WarehouseSpecTypeList"
-                    :key="item.value"
-                    :label="item.text"
-                    :value="item.value"
-                  ></el-option>
-                </el-select>
+              <div>
+                <div class="text">入库规格</div>
+                <div class="select-type">
+                  <el-select
+                    v-model="inWarehouseSpecType"
+                    filterable
+                    clearable
+                    placeholder="请选择入库规格"
+                    size="mini"
+                    class="content_num select-warehousing"
+                  >
+                    <el-option
+                      v-for="item in WarehouseSpecTypeList"
+                      :key="item.value"
+                      :label="item.text"
+                      :value="item.value"
+                    ></el-option>
+                  </el-select>
+                </div>
               </div>
             </div>
-            <!-- <div style="margin-top: 6px">
-              <el-select
-                v-model="item.warehouseId"
-                filterable
-                clearable
-                placeholder="请选择仓库"
-                size="mini"
-                class="content_num"
-              >
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :value="item.id"
-                  :label="item.name"
-                ></el-option>
-              </el-select>
-            </div> -->
+
             <div v-for="(it, idx) in item.toWarehouseList" :key="idx">
               <packingTgBom
                 :list="it.extInfo.pickOutInList"
@@ -269,46 +253,48 @@
           </div>
         </div>
 
-        <div v-if="clientEnvironmentId == 2" class="item">
-          <div>
-            <div class="text">仓库</div>
-            <div class="select-type">
-              <el-select
-                v-model="warehouseId"
-                filterable
-                clearable
-                placeholder="请选择仓库"
-                size="mini"
-                class="content_num"
-              >
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.id"
-                  :value="item.id"
-                  :label="item.name"
-                ></el-option>
-              </el-select>
+        <div v-if="clientEnvironmentId == 2">
+          <div class="item">
+            <div>
+              <div class="text">仓库</div>
+              <div class="select-type">
+                <el-select
+                  v-model="warehouseId"
+                  filterable
+                  clearable
+                  placeholder="请选择仓库"
+                  size="mini"
+                  class="content_num"
+                >
+                  <el-option
+                    v-for="item in warehouseList"
+                    :key="item.id"
+                    :value="item.id"
+                    :label="item.name"
+                  ></el-option>
+                </el-select>
+              </div>
             </div>
-          </div>
 
-          <div>
-            <div class="text">入库规格</div>
-            <div class="select-type">
-              <el-select
-                v-model="inWarehouseSpecType"
-                filterable
-                clearable
-                placeholder="请选择入库规格"
-                size="mini"
-                class="content_num select-warehousing"
-              >
-                <el-option
-                  v-for="item in WarehouseSpecTypeList"
-                  :key="item.value"
-                  :label="item.text"
-                  :value="item.value"
-                ></el-option>
-              </el-select>
+            <div>
+              <div class="text">入库规格</div>
+              <div class="select-type">
+                <el-select
+                  v-model="inWarehouseSpecType"
+                  filterable
+                  clearable
+                  placeholder="请选择入库规格"
+                  size="mini"
+                  class="content_num select-warehousing"
+                >
+                  <el-option
+                    v-for="item in WarehouseSpecTypeList"
+                    :key="item.value"
+                    :label="item.text"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+              </div>
             </div>
           </div>
         </div>

+ 2 - 1
src/views/produce/components/workPlan/index.vue

@@ -14,6 +14,7 @@
         <!-- <seek-page :seekList="seekList" @search="search"></seek-page> -->
 
         <ele-pro-table
+          v-if="visible"
           ref="table"
           :columns="columns"
           :datasource="datasource"
@@ -449,7 +450,7 @@
           size: limit
         });
 
-        console.log(res);
+        console.log(res, 'ERSSSSSSS');
 
         return res;
       },

+ 1 - 0
src/views/produce/index.vue

@@ -130,6 +130,7 @@
                 <pickDetails
                   ref="pickListRef"
                   :workTaskId="workTaskId"
+                  :taskId="taskObj.id"
                   @pickAdd="pickAdd"
                 ></pickDetails>
               </div>

+ 2 - 2
vue.config.js

@@ -35,8 +35,8 @@ module.exports = {
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.103:18086',192.168.1.116
-        // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.116:18086',
+        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.30:18086',
         // target: 'http://192.168.1.211:18086',