695593266@qq.com 7 bulan lalu
induk
melakukan
20765c902c

+ 12 - 0
src/api/beEntrusted/index.js

@@ -213,3 +213,15 @@ export async function createProductionOrder(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//驳回收货
+export async function rejectGoods(data) {
+  const res = await request.post(
+    `/mes/please_entrust_management/returnDetail`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 78 - 3
src/views/beEntrusted/components/goodsDetail.vue

@@ -45,12 +45,46 @@
       <el-button type="primary" @click="rejectReason"> 驳回 </el-button>
       <el-button type="primary" @click="save"> 确认收货 </el-button>
     </template>
+
+    <!-- 驳回原因弹窗 -->
+    <el-dialog
+      :visible.sync="rejectDialogVisible"
+      v-if="rejectDialogVisible"
+      title="请输入驳回原因"
+      width="30vw"
+      :close-on-click-modal="false"
+      :before-close="
+        () => {
+          rejectDialogVisible = false;
+        }
+      "
+    >
+      <el-form
+        ref="rejectForm"
+        :model="rejectForm"
+        :rules="rejectRules"
+        label-width="80px"
+      >
+        <el-form-item label="原因" prop="reason">
+          <el-input
+            type="textarea"
+            v-model="rejectForm.reason"
+            placeholder="请输入驳回原因"
+            rows="4"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="rejectDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="confirmReject">确定</el-button>
+      </span>
+    </el-dialog>
   </ele-modal>
 </template>
 
 <script>
   import { pleaseEntrustGoodsDetail } from '@/api/entrust';
-  import { confirmReceipt } from '@/api/beEntrusted';
+  import { confirmReceipt, receiveGoos } from '@/api/beEntrusted';
   import { typeName } from '@/views/produce/components/common.js';
   export default {
     data() {
@@ -63,7 +97,15 @@
         id: '',
         type: '',
         title: '',
-        loading: null
+        loading: null,
+        // 驳回弹窗
+        rejectDialogVisible: false,
+        rejectForm: { reason: '' },
+        rejectRules: {
+          reason: [
+            { required: true, message: '请输入驳回原因', trigger: 'blur' }
+          ]
+        }
       };
     },
 
@@ -242,7 +284,40 @@
       },
 
       rejectReason() {
-        
+        this.rejectDialogVisible = true;
+      },
+
+      confirmReject() {
+        this.$refs.rejectForm.validate((valid) => {
+          if (!valid) return;
+          this.$confirm('确认要驳回该收货单吗?', '提示', { type: 'warning' })
+            .then(() => {
+              const ids = this.goodsList.map((it) => {
+                return it.id;
+              });
+
+              receiveGoos({
+                ids,
+                applyId: this.id,
+                beReason: this.rejectForm.reason
+              }).then(() => {
+                this.$message.success('驳回成功');
+                this.rejectDialogVisible = false;
+                this.visible = false;
+                this.$emit('done');
+              });
+              // rejectEntrust({
+              //   id: this.id,
+              //   reason: this.rejectForm.reason
+              // }).then(() => {
+              //   this.$message.success('驳回成功');
+              //   this.rejectDialogVisible = false;
+              //   this.visible = false;
+              //   this.$emit('done');
+              // });
+            })
+            .catch(() => {});
+        });
       },
 
       chooseData(dataList) {

+ 117 - 35
src/views/pick/pickApply/components/addPick.vue

@@ -97,7 +97,11 @@
                 </template>
               </el-table-column>
 
-              <el-table-column label="编码" prop="assetCode">
+              <el-table-column
+                label="编码"
+                prop="assetCode"
+                show-overflow-tooltip
+              >
                 <template slot-scope="{ row, $index }">
                   <span
                     v-if="
@@ -116,7 +120,7 @@
                 </template>
               </el-table-column>
 
-              <el-table-column label="名称" prop="name">
+              <el-table-column label="名称" prop="name" show-overflow-tooltip>
                 <template slot-scope="{ row, $index }">
                   <span
                     v-if="
@@ -129,22 +133,33 @@
                   <span> {{ row.name }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="型号" prop="modelType"> </el-table-column>
-              <el-table-column label="规格" prop="specification">
+              <el-table-column
+                label="型号"
+                prop="modelType"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+              <el-table-column
+                label="规格"
+                prop="specification"
+                show-overflow-tooltip
+              >
+              </el-table-column>
+              <el-table-column
+                label="批次号"
+                prop="batchNo"
+                show-overflow-tooltip
+              >
               </el-table-column>
-              <el-table-column label="批次号" prop="batchNo"> </el-table-column>
 
-              <el-table-column label="数量" prop="demandQuantity">
+              <el-table-column label="数量" prop="demandQuantity" width="140">
                 <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
-                      "
+                      @input="changeInput(row, $index, idx)"
                       size="mini"
+                      style="width: 120px"
                     >
                       <template slot="append">{{ row.measuringUnit }}</template>
                     </el-input>
@@ -152,13 +167,32 @@
                 </template>
               </el-table-column>
 
-              <el-table-column label="计量库存数量" prop="availableCountBase">
+              <el-table-column
+                label="计量库存数量"
+                prop="availableCountBase"
+                width="220"
+                show-overflow-tooltip
+              >
                 <template slot-scope="{ row, $index }">
-                  {{ row.availableCountBase }} {{ row.measuringUnit }}
+                  <div v-for="it of row.warehouseList">
+                    <span
+                      v-if="it.availableCountBase != '0'"
+                      style="cursor: pointer"
+                      >{{ it.name ? it.name : it.warehouse_name }}库存数:<span
+                        style="color: green"
+                        >{{ it.availableCountBase }}</span
+                      >{{ row.measuringUnit }}</span
+                    >
+                  </div>
                 </template>
               </el-table-column>
 
-              <el-table-column label="领料仓库" prop="warehouseId">
+              <el-table-column
+                label="领料仓库"
+                prop="warehouseId"
+                width="180"
+                show-overflow-tooltip
+              >
                 <template slot-scope="{ row, $index }">
                   <div
                     v-if="
@@ -167,10 +201,11 @@
                     "
                   >
                     <el-select
-                      v-model="row.warehouseId"
+                      v-model="row.warehouseIdList"
                       placeholder="请选择"
                       filterable
-                      size="mini"
+                      multiple
+                      @change="changeWarehouse(row, $index)"
                     >
                       <el-option
                         v-for="item in row.warehouseList"
@@ -184,12 +219,14 @@
 
                   <div v-else>
                     <el-select
-                      v-model="row.warehouseId"
+                      v-model="row.warehouseIdList"
                       placeholder="请选择"
                       filterable
+                      multiple
+                      @change="changeWarehouse(row, $index)"
                     >
                       <el-option
-                        v-for="item in row.warehouseLists"
+                        v-for="item in row.warehouseList"
                         :label="item.warehouse_name"
                         :value="item.warehouse_id"
                         :key="item.warehouse_id"
@@ -285,23 +322,32 @@
       },
 
       getList(ids, taskId) {
-        let param = {
-          ids: ids,
-          taskId: taskId
-        };
-        workorderList(param)
-          .then((res) => {
-            let _arr = res.map((e) => {
-              e.pickList = [...e.bomDetailDTOS];
-              e.bomDetailDTOS = [];
-              return e;
+        const param = { ids, taskId };
+
+        workorderList(param).then((res) => {
+          this.workList = res.map((item) => {
+            // 处理 pickList 并统一 warehouse 字段
+            const pickList = item.bomDetailDTOS.map((it) => {
+              const warehouseList = (it.warehouseList || []).map((wh) => ({
+                ...wh,
+                warehouse_id: wh.id,
+                warehouse_name: wh.name
+              }));
+
+              return {
+                ...it,
+                warehouseIdList: it.warehouseId ? [it.warehouseId] : [],
+                warehouseList
+              };
             });
 
-            this.workList = JSON.parse(JSON.stringify(_arr));
-
-            this.$forceUpdate();
-          })
-          .finally(() => {});
+            return {
+              ...item,
+              pickList,
+              bomDetailDTOS: [] // 清空原 bomDetailDTOS
+            };
+          });
+        });
       },
 
       async getOrderCode() {
@@ -330,7 +376,6 @@
       },
 
       save() {
-        console.log(this.workList, 'this.workList');
         if (this.workList.length > 0) {
           let bol;
           let _i;
@@ -389,7 +434,6 @@
               m.instanceList.push(e);
             }
           });
-
           m.workOrderId = m.id;
           delete m.id;
 
@@ -418,6 +462,44 @@
         this.getList(ids, taskId);
 
         this.orderShow = false;
+      },
+      changeWarehouse(item, index) {},
+      changeInput(item, index, idx) {
+        if (Number(item.demandQuantity) >= Number(item.availableCountBase)) {
+          this.$set(
+            this.workList[idx].pickList[index],
+            'demandQuantity',
+            Number(item.availableCountBase)
+          );
+          const idsList = [];
+          item.warehouseList.forEach((it) => {
+            idsList.push(it.id);
+          });
+          this.$set(
+            this.workList[idx].pickList[index],
+            'warehouseIdList',
+            idsList
+          );
+        } else if (!Number(item.demandQuantity)) {
+          this.$set(this.workList[idx].pickList[index], 'warehouseIdList', []);
+        } else {
+          const idsList = [];
+          let totalNum = 0;
+          for (let i = 0; i < item.warehouseList.length; i++) {
+            totalNum += Number(item.warehouseList[i].availableCountBase);
+            if (Number(item.demandQuantity) > totalNum) {
+              idsList.push(item.warehouseList[i].id);
+            } else {
+              idsList.push(item.warehouseList[i].id);
+              break;
+            }
+          }
+          this.$set(
+            this.workList[0].pickList[index],
+            'warehouseIdList',
+            idsList
+          );
+        }
       }
     },
 

+ 20 - 10
src/views/pick/pickApply/components/produceOrder.vue

@@ -87,7 +87,8 @@
           {
             prop: 'batchNo',
             label: '批次号',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
 
           {
@@ -95,28 +96,33 @@
             slot: 'code',
             label: '生产工单号',
             align: 'center',
-            minWidth: '110'
+            minWidth: '110',
+            showOverflowTooltip: true
           },
           {
             prop: '',
             label: '计划编号',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
           {
             prop: '',
             label: '计划类型',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
 
           {
             prop: 'productCode',
             label: '产品编码',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
           {
             prop: 'productName',
             label: '产品名称',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
 
           {
@@ -124,25 +130,29 @@
             slot: 'singleReport',
             label: '报工类型',
             align: 'center',
-            width: 100
+            width: 100,
+            showOverflowTooltip: true
           },
 
           {
             prop: 'brandNo',
             label: '牌号',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
           {
             prop: 'model',
             label: '型号',
-            align: 'center'
+            align: 'center',
+            showOverflowTooltip: true
           },
 
           {
             prop: 'priority',
             label: '优先级',
             align: 'center',
-            minWidth: 120
+            minWidth: 120,
+            showOverflowTooltip: true
           },
 
           {

+ 1 - 0
src/views/produce/components/new_produceOrder.vue

@@ -57,6 +57,7 @@
           <span v-if="row.entrustStatus == 2">请托中</span>
           <span v-if="row.entrustStatus == 3">请托完成</span>
         </div>
+        <span v-else>未请托</span>
       </template>
 
       <template v-slot:workOrderType="{ row }">

+ 0 - 7
src/views/produce/components/picking/index.vue

@@ -260,13 +260,6 @@
                       :key="item.warehouse_id"
                     >
                     </el-option>
-                    <!-- <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>

+ 16 - 0
src/views/produceOrder/index.vue

@@ -129,6 +129,15 @@
           <span v-if="row.workOrderType == 3">受托订单</span>
         </template>
 
+        <template v-slot:entrustStatus="{ row }">
+          <div v-if="row.entrustStatus">
+            <span v-if="row.entrustStatus == 1">未请托</span>
+            <span v-if="row.entrustStatus == 2">请托中</span>
+            <span v-if="row.entrustStatus == 3">请托完成</span>
+          </div>
+          <span v-else>未请托</span>
+        </template>
+
         <template v-slot:outsourceStatus="{ row }">
           <div v-if="row.outsourceStatus">
             <span v-if="row.outsourceStatus == 1">未委外</span>
@@ -796,6 +805,13 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'entrustStatus',
+            label: '请托状态',
+            align: 'center',
+            slot: 'entrustStatus',
+            showOverflowTooltip: true
+          },
           {
             prop: 'crewNames',
             slot: 'crewNames',

+ 1 - 1
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.116:18086', // 赵沙金
+        // 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.144:18086',