Просмотр исходного кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev

yusheng 4 дней назад
Родитель
Сommit
4763cd7e6c

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

@@ -92,6 +92,18 @@ export async function pleaseEntrustGoodsDetail(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//根据请托单查生产计划详情
+export async function productionPlanDetails(applyId) {
+  const res = await request.get(
+    '/mes/please_entrust_management/productionPlanDetails',
+    { params: { applyId } }
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 //获取工单的所有物品清单
 export async function pleaseEntrustAllGoodsDetail(data) {
   const res = await request.post(

+ 62 - 20
src/views/beEntrusted/components/goodsDetail.vue

@@ -43,6 +43,18 @@
       <template v-slot:rootCategoryLevelId="{ row }">
         <el-tag>{{ typeName[Number(row.rootCategoryLevelId)] }}</el-tag>
       </template>
+
+      <template v-slot:status="{ row }">
+        <span>{{ row.status == 1 ? "已发货" : row.status == 2 ? "已收货" : "驳回"}}</span>
+      </template>
+
+      <template v-slot:isTransferToProductionPlan="{ row }">
+        <span>{{ row.isTransferToProductionPlan == 1 ? "已转生产计划" : "未转生产计划"}}</span>
+      </template>
+
+      <template v-slot:isMeasuring="{ row }">
+        <span>{{ row.isMeasuring == 1 ? "是" : "否"}}</span>
+      </template>
     </ele-pro-table>
 
     <template v-slot:footer v-if="type != 'detail' && type != 'send'">
@@ -225,6 +237,28 @@
             label: '类型',
             align: 'center',
             showOverflowTooltip: true
+          },
+          {
+            prop: 'status',
+            slot: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'isTransferToProductionPlan',
+          //   slot: 'isTransferToProductionPlan',
+          //   label: '是否转生产计划',
+          //   align: 'center',
+          //   showOverflowTooltip: true
+          // }
+          {
+            prop: 'isMeasuring',
+            slot: 'isMeasuring',
+            label: '是否收货',
+            align: 'center',
+            showOverflowTooltip: true,
+            show: this.type == 'add' ? true : false
           }
         ];
       }
@@ -242,10 +276,20 @@
 
       async getDetail(id) {
         const detailType = this.type != 'send' ? 1 : 2;
-        await pleaseEntrustGoodsDetail({
+        const obj = {
           id,
-          detailType
-        }).then((res) => {
+          detailType,
+        }
+        if(this.type === 'send') {
+          obj.detailType = 3;
+        }
+        if(this.type === 'detail') {
+          obj.detailType = 2;
+        }
+        if(this.type === 'add') {
+          obj.status = 1;
+        }
+        await pleaseEntrustGoodsDetail(obj).then((res) => {
           this.goodsList = [];
           res.data.forEach((item) => {
             if (this.type != 'detail') {
@@ -347,12 +391,8 @@
           return this.$message.warning('请先选择一条收货数据!');
         }
 
-        const selectionIds = new Set(this.selection.map((it) => it.id));
-        this.goodsList.forEach((item) => {
-          if (!selectionIds.has(item.id)) {
-            item.receiveQuantity = 0;
-          }
-        });
+        // 仅提交勾选的数据
+        const selectedList = this.selection.map((item) => this.deepCopy(item));
 
         const totalNum = this.selection.reduce(
           (total, pro) => total + Number(pro.receiveQuantity || 0),
@@ -378,7 +418,7 @@
             background: 'rgba(0, 0, 0, 0.7)'
           });
 
-          confirmReceipt(this.goodsList)
+          confirmReceipt(selectedList)
             .then(() => {
               this.loading.close();
               this.$message.success('收货成功');
@@ -390,13 +430,13 @@
             });
         };
 
-        if (confirmMessage) {
-          this.$confirm(confirmMessage, '提示', { type: 'warning' })
-            .then(() => doConfirmReceipt())
-            .catch(() => {});
-        } else {
+        // if (confirmMessage) {
+        //   this.$confirm(confirmMessage, '提示', { type: 'warning' })
+        //     .then(() => doConfirmReceipt())
+        //     .catch(() => {});
+        // } else {
           doConfirmReceipt();
-        }
+        // }
       },
 
       cancel() {
@@ -408,13 +448,15 @@
       },
 
       confirmReject() {
+        if (this.selection.length === 0) {
+          return this.$message.warning('请先选择一条驳回数据!');
+        }
         this.$refs.rejectForm.validate((valid) => {
           if (!valid) return;
-          this.$confirm('确认要驳回该收货单吗?', '提示', { type: 'warning' })
+          this.$confirm('确认要驳回所选数据吗?', '提示', { type: 'warning' })
             .then(() => {
-              const ids = this.goodsList.map((it) => {
-                return it.id;
-              });
+              // 仅提交勾选的数据
+              const ids = this.selection.map((it) => it.id);
 
               console.log('7777');
 

+ 18 - 4
src/views/beEntrusted/index.vue

@@ -53,6 +53,9 @@
           <el-tag v-else-if="row.changeType == 3" type="success"
             >已转生产计划</el-tag
           >
+           <el-tag v-else-if="row.changeType == 4" type="success"
+            >部分转生产计划</el-tag
+          >
         </template>
 
         <template v-slot:status="{ row }">
@@ -88,6 +91,15 @@
           <el-tag v-else-if="row.sendStatus == 6" type="success">{{
             '请托拒收'
           }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 7" type="success">{{
+            '部分发货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 8" type="success">{{
+            '部分收货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 9" type="success">{{
+            '部分驳回'
+          }}</el-tag>
         </template>
 
         <template v-slot:approvalStatus="{ row }">
@@ -116,7 +128,8 @@
             type="primary"
             :underline="false"
             @click="receiveGoos(row, 'add')"
-            v-if="row.approvalStatus == 2 && row.sendStatus == 1"
+            v-if="row.approvalStatus == 2 && (row.sendStatus == 1 || row.sendStatus == 8 
+              || row.sendStatus == 7 || row.sendStatus == 9)"
           >
             收货
           </el-link>
@@ -276,7 +289,7 @@
           },
           {
             prop: 'applyFactoriesName',
-            label: '所属工厂',
+            label: '请托工厂',
             align: 'center',
             width: 130,
             showOverflowTooltip: true
@@ -571,7 +584,7 @@
         }
 
         const unreceived = this.selection.find(
-          (item) => item.approvalStatus == 2 && item.sendStatus != 2
+          (item) => item.approvalStatus == 2 && (item.sendStatus != 2 && item.sendStatus != 8 && item.sendStatus != 4)
         );
         if (unreceived) {
           return this.$message.warning(`请先收货再${actionText}`);
@@ -579,7 +592,8 @@
 
         const converted = this.selection.find(
           (item) =>
-            item.changeType == 1 || item.changeType == 2 || item.changeType == 3
+            item.changeType &&
+            (item.changeType == 1 || item.changeType == 2 || item.changeType == 3 || item.changeType != 4)
         );
         if (converted) {
           return this.$message.warning('该委托工单已转换,不能重复转换');

+ 5 - 2
src/views/entrust/components/addInvoice.vue

@@ -189,7 +189,7 @@
         this.allSelection = list || [];
         this.$nextTick(() => {
           this.allSelection.forEach((item) => {
-            this.$refs.entrustCreateTable.toggleRowSelection(item, true);
+            this.$refs.entrustCreateTable.toggleRowSelection(item, false);
           });
         });
       },
@@ -201,7 +201,10 @@
           this.workinProgress = (res.data || []).map((item) => {
             const remainingDeliverableQuantity =
               (Number(item.totalQuantity) || 0) - (Number(item.quantity) || 0);
-              item.remainingDeliverableQuantity = remainingDeliverableQuantity < 0 ? 0 : remainingDeliverableQuantity;
+            // 精度处理:避免出现 6.9999999999 这类浮点尾数
+            item.remainingDeliverableQuantity = Number(
+              (remainingDeliverableQuantity < 0 ? 0 : remainingDeliverableQuantity).toFixed(2)
+            );
             return item;
           });
         });

+ 57 - 1
src/views/entrust/components/create.vue

@@ -263,6 +263,45 @@
           </el-date-picker>
         </template>
       </ele-pro-table>
+
+      <headerTitle
+        title="生产计划详情"
+        style="margin-top: 15px"
+        v-if="type == 'detail'"
+      ></headerTitle>
+
+      <el-table
+        v-if="type == 'detail'"
+        :data="productionPlanList"
+        border
+        stripe
+        style="width: 100%; margin-top: 10px"
+      >
+        <el-table-column
+          prop="code"
+          label="计划编号"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="createUserName"
+          label="创建人"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="measuringUnit"
+          label="单位"
+          align="center"
+          show-overflow-tooltip
+        />
+        <el-table-column
+          prop="requiredFormingNum"
+          label="数量"
+          align="center"
+          show-overflow-tooltip
+        />
+      </el-table>
     </el-form>
 
     <template v-slot:footer v-if="type != 'detail'">
@@ -286,7 +325,8 @@
     save,
     addSubmit,
     pleaseEntrustDetail,
-    update
+    update,
+    productionPlanDetails
   } from '@/api/entrust/index';
   import produceOrder from './produceOrder.vue';
   import detail from '@/views/bpm/processInstance/detail.vue';
@@ -376,6 +416,7 @@
         produceTaskList: [],
         factoryList: [],
         orderList: [],
+        productionPlanList: [],
         selection: [],
         current: null,
         columns: [
@@ -603,6 +644,7 @@
       open(type, row) {
         this.visible = true;
         this.orderList = [];
+        this.productionPlanList = [];
         if (type == 'add') {
           this.form.pleaseEntrustDeptName =
             this.$store.state.user.info.groupName;
@@ -625,6 +667,10 @@
         this.type = type;
 
         this.title = type == 'add' ? '新增' : type == 'edit' ? '修改' : '详情';
+
+        if (type == 'detail') {
+          this.getProductionPlanDetails(row.id);
+        }
       },
 
       addOder() {
@@ -729,6 +775,7 @@
       cancel() {
         this.form = { ...defaultForm() };
         this.produceTaskList = [];
+        this.productionPlanList = [];
         this.visible = false;
       },
       choose(list) {
@@ -942,6 +989,15 @@
       async getUserList(groupId) {
         const { list } = await getUserPage({ pageNum: 1, size: -1, groupId });
         this.userList = list || [];
+      },
+      async getProductionPlanDetails(applyId) {
+        try {
+          const list = await productionPlanDetails(applyId);
+          this.productionPlanList = list || [];
+        } catch (error) {
+          console.error('加载生产计划详情失败:', error);
+          this.productionPlanList = [];
+        }
       }
     }
   };

+ 78 - 12
src/views/entrust/components/goodsDetail.vue

@@ -41,7 +41,7 @@
         <el-input
           placeholder=""
           v-model="row.receiveQuantity"
-          :disabled="type == 'receipt' && itemData.sendStatus == 4"
+          :disabled="type == 'receipt' && (itemData.sendStatus == 4 || itemData.sendStatus == 3)"
         >
           <template slot="append">{{ row.measuringUnit }}</template>
         </el-input>
@@ -50,6 +50,16 @@
       <template v-slot:rootCategoryLevelId="{ row }">
         <el-tag>{{ typeName[Number(row.rootCategoryLevelId)] }}</el-tag>
       </template>
+
+      <template v-slot:status="{ row }">
+        <el-tag :type="getStatusInfo(row.status).type">
+          {{ getStatusInfo(row.status).label }}
+        </el-tag>
+      </template>
+
+       <template v-slot:isMeasuring="{ row }">
+        <span>{{ row.isMeasuring == 1 ? "是" : "否"}}</span>
+      </template>
     </ele-pro-table>
 
     <template v-slot:footer v-if="type != 'detail' && itemData.sendStatus != 4">
@@ -89,8 +99,18 @@
         id: '',
         title: '',
         type: '',
+        isReceiptDetail: true,
         itemData: {},
-        loading: null
+        loading: null,
+        // 在制品发货状态:键为后端 status,值为 el-tag 显示配置
+        statusMap: {
+          0: { label: '待发货', type: 'info' },
+          1: { label: '已发货', type: 'success' },
+          2: { label: '已收货', type: 'success' },
+          7: { label: '部分发货', type: 'success' },
+          8: { label: '部分收货', type: 'success' },
+          9: { label: '部分驳回', type: 'success' }
+        }
       };
     },
 
@@ -195,27 +215,68 @@
             label: '类型',
             align: 'center',
             showOverflowTooltip: true
+          },
+          {
+            prop: 'status',
+            slot: 'status',
+            label: '状态',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            show: this.type == 'detail' ? true : false
+          },
+          {
+            prop: 'isMeasuring',
+            slot: 'isMeasuring',
+            label: '是否收货',
+            align: 'center',
+            showOverflowTooltip: true,
+            show: this.type == 'receipt' && !this.isReceiptDetail ? true : false
           }
         ];
       }
     },
 
     methods: {
-      open(item, type) {
+      // 根据后端 status 返回对应的展示文案和 el-tag 类型,未匹配时回落为驳回
+      getStatusInfo(status) {
+        return this.statusMap[Number(status)] || { label: '驳回', type: 'success' };
+      },
+
+      open(item, type, detailType) {
         this.visible = true;
         this.type = type;
         this.title = this.type != 'receipt' ? '发货单' : '收货单';
         this.itemData = item;
         this.id = item.id;
-        this.getDetail(item.id);
+        // 重置 isReceiptDetail:仅当 type 为 receipt 且传入了 detailType 时,才是收货操作(false)
+        // 其余情况(收货详情、发货、详情等)保持为 true
+        this.isReceiptDetail = !(type === 'receipt' && detailType);
+        this.getDetail(item.id, detailType);
       },
 
-      async getDetail(id) {
-        const detailType = this.type == 'receipt' ? 2 : 1;
-        await pleaseEntrustGoodsDetail({
+      async getDetail(id, type) {
+        let detailType = this.type == 'receipt' ? 2 : 1;
+        const params = {
           id,
           detailType
-        }).then(async (res) => {
+        };
+        if(this.type === "detail") {
+          params.detailType = 1;
+        }
+
+        //用type来区分收货详情与收货 存在type则是收货
+        if(this.type === "receipt") {
+          params.detailType = 4;
+        }
+
+        if(this.type === 'receipt' && type) {
+          params.detailType = type;
+          params.status = 3;
+          // isReceiptDetail 在 open() 里已经重置,此处只处理 params
+        }
+
+        await pleaseEntrustGoodsDetail(params).then(async (res) => {
           this.goodsList = [];
           res.data.forEach((item) => {
             if (this.type == 'receipt' && this.itemData.sendStatus != 4) {
@@ -291,10 +352,15 @@
 
       chooseData(dataList) {
         if (dataList.length === 0) return;
-        this.goodsList = dataList.map((item) => {
-          item.quantity = item.remainingDeliverableQuantity;
-          return this.deepCopy(item);
-        }).filter(item => item.quantity > 0);
+        this.goodsList = dataList
+          .map((item) => {
+            // 精度处理:后端 totalQuantity - quantity 会出现 6.9999999999 之类的浮点尾数
+            item.quantity = Number(
+              Number(item.remainingDeliverableQuantity || 0).toFixed(2)
+            );
+            return this.deepCopy(item);
+          })
+          .filter((item) => item.quantity > 0);
       },
 
       rejectReason() {},

+ 13 - 4
src/views/entrust/index.vue

@@ -50,6 +50,15 @@
           <el-tag v-else-if="row.sendStatus == 6" type="success">{{
             '请托拒收'
           }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 7" type="success">{{
+            '部分发货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 8" type="success">{{
+            '部分收货'
+          }}</el-tag>
+          <el-tag v-else-if="row.sendStatus == 9" type="success">{{
+            '部分驳回'
+          }}</el-tag>
         </template>
 
         <template v-slot:approvalStatus="{ row }">
@@ -140,7 +149,7 @@
             @click="sendGoods(row, 'add')"
             v-if="
               row.approvalStatus == 2 &&
-              (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 5)
+              (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 5 || row.sendStatus == 7 || row.sendStatus == 8 || row.sendStatus == 9)
             "
           >
             发货
@@ -149,7 +158,7 @@
           <el-link
             type="primary"
             :underline="false"
-            @click="sendGoods(row, 'receipt')"
+            @click="sendGoods(row, 'receipt', 3)"
             v-if="row.approvalStatus == 2 && row.sendStatus == 3"
           >
             收货
@@ -686,8 +695,8 @@
         });
       },
 
-      sendGoods(item, type) {
-        this.$refs.goodsDetailRef.open(item, type);
+      sendGoods(item, type, detailType) {
+        this.$refs.goodsDetailRef.open(item, type, detailType);
       },
 
       fullscreenChange(fullscreen) {

+ 20 - 0
src/views/produce/components/footBtn.vue

@@ -39,6 +39,15 @@
         type: String,
         default: ''
       },
+      // 当前工序已分配给他人(routeList 项 isSomeone 为 true)时禁用领料/投料/报工/委外请托
+      isSomeoneDisabled: {
+        type: Boolean,
+        default: false
+      },
+      isSomeoneDisabledMsg: {
+        type: String,
+        default: '无法操作'
+      },
       activeName: {
         type: String,
         default: '0'
@@ -388,6 +397,17 @@
                 '请先完成领料、投料后再进行首件两检'
             };
           }
+          // 当前工序已分配给他人时,禁用领料/投料/报工/委外请托
+          if (
+            this.isSomeoneDisabled &&
+            ['pick', 'feed', 'job', 'Outsourcing'].includes(i.type)
+          ) {
+            return {
+              ...i,
+              disable: true,
+              msg: this.isSomeoneDisabledMsg || '无法操作'
+            };
+          }
           if (this.isPreProductionResult) {
             for (let key in this.isPreProductionResult) {
               let obj = this.disableObj[key];

+ 13 - 2
src/views/produce/components/outsourcing/details.vue

@@ -203,6 +203,15 @@
         <el-tag v-else-if="row.sendStatus == 4" type="success">{{
           '请托已收'
         }}</el-tag>
+        <el-tag v-else-if="row.sendStatus == 7" type="success">{{
+          '部分发货'
+        }}</el-tag>
+        <el-tag v-else-if="row.sendStatus == 8" type="success">{{
+          '部分收货'
+        }}</el-tag>
+        <el-tag v-else-if="row.sendStatus == 9" type="success">{{
+          '部分驳回'
+        }}</el-tag>
       </template>
 
       <template v-slot:approvalStatus="{ row }">
@@ -264,7 +273,9 @@
           :underline="false"
           @click="sendGoods(row, 'add')"
           v-if="
-            row.approvalStatus == 2 && (row.sendStatus == 0 || !row.sendStatus)
+            row.approvalStatus == 2 && (row.sendStatus == 0 || !row.sendStatus || row.sendStatus == 7
+              || row.sendStatus == 8 || row.sendStatus == 9
+            )
           "
         >
           发货
@@ -293,7 +304,7 @@
           :underline="false"
           @click="sendGoods(row, 'detail')"
           v-if="
-            row.approvalStatus == 2 && row.sendOutQuantity > 0
+            row.approvalStatus == 2 || row.sendOutQuantity > 0
           "
         >
           发货详情

+ 5 - 0
src/views/produceOrder/workReport.vue

@@ -279,6 +279,8 @@
                 :singleReportInspection="singleReportInspection"
                 :qualityInspectionDisabled="qualityInspectionDisabled"
                 :qualityInspectionDisabledMsg="firstArticlePickFeedMsg"
+                :isSomeoneDisabled="isSomeoneDisabled"
+                :isSomeoneDisabledMsg="'无法操作'"
                 :activeName="activeName"
                 style="background: rgba(223, 250, 222, 0.6); padding: 10px"
               ></footBtn>
@@ -521,6 +523,9 @@
           !this.firstArticlePickFeedReady
         );
       },
+      isSomeoneDisabled() {
+        return !!this.curTaskObj?.isSomeone;
+      },
       rightShow() {
         return (type) => {};
       },