2 Commits af5a2b8bc3 ... 17c7719318

Author SHA1 Message Date
  lucw 17c7719318 feat: 对账明细新增差异数量/金额、异常处置与状态字段,异常管理完善异常类型与处置方式枚举并支持采购对账异常展示 1 week ago
  lucw 6eae62c613 feat: 发票管理新增是否冲红列并修复应收账款搜索空字符串参数问题 1 week ago

+ 3 - 1
src/enum/dict.js

@@ -290,7 +290,9 @@ export const pricingWayList = [
 export const relationTypeOption = {
   1: '发货确认单',
   2: '收货确认单',
-  3: '销售退货单'
+  3: '销售退货单',
+  4: '销售订单-对账异常',
+  5: '采购订单-对账异常'
 };
 
 export const shippingModeOp = [

+ 8 - 0
src/views/financialManage/invoiceManage/index.vue

@@ -350,6 +350,14 @@
             slot: 'ifRedReversalInvoice',
             align: 'center',
           },
+          {
+            minWidth: 100,
+            prop: 'ifRedReversalInvoice',
+            label: '是否冲红',
+            slot: 'ifRedReversalInvoice',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             minWidth: 100,
             prop: 'accountingSubjectName',

+ 5 - 2
src/views/financialManage/receivableManage/searchTable.vue

@@ -115,9 +115,12 @@ export default {
     },
     /* 搜索 */
     search(e) {
-      this.$emit('search', {
-        ...e
+      const where = { ...e };
+      // 清理空字符串参数,避免金额等数值/精确匹配字段绑定空串报错
+      Object.keys(where).forEach((k) => {
+        if (where[k] === '') delete where[k];
       });
+      this.$emit('search', where);
     }
   }
 };

+ 1 - 1
src/views/purchasingManage/purchaseOrder/index.vue

@@ -251,7 +251,7 @@
           <return-goods @getToDoReminder="getToDoReminder"></return-goods>
         </div>
         <div v-if="activeComp == 'exceptionList'">
-          <exceptionList :relationType="'2'" @getToDoReminder="getToDoReminder">
+          <exceptionList :relationType="'2,5'" @getToDoReminder="getToDoReminder">
           </exceptionList>
         </div>
         <div v-if="activeComp == 'accountstatement'">

+ 114 - 12
src/views/saleManage/saleOrder/accountstatement/components/accountDetailTable.vue

@@ -64,7 +64,7 @@
                 <el-input
                   v-model="scope.row.statementCount"
                   type="number"
-                  :disabled="true"
+                  :disabled="isView"
                   @input="handleCountChange(scope.row, scope.$index)"
                 />
               </el-form-item>
@@ -145,6 +145,49 @@
               <span>{{ scope.row.statementAmount }}</span>
             </template>
 
+            <template v-slot:diffQty="scope">
+              <span>{{ formatDiffQty(scope.row) }}</span>
+            </template>
+
+            <template v-slot:diffAmount="scope">
+              <span>{{ formatDiffAmount(scope.row) }}</span>
+            </template>
+
+            <template v-slot:exceptionDetermine="scope">
+              <el-select
+                v-model="scope.row.exceptionDetermine"
+                :disabled="isView"
+                clearable
+                placeholder="请选择"
+                size="small"
+              >
+                <el-option
+                  v-for="item in exceptionDetermineOptions"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                  :disabled="item.disabled"
+                />
+              </el-select>
+            </template>
+
+            <template v-slot:exceptionStatus="scope">
+              <el-tag :type="hasException(scope.row) ? 'danger' : 'success'" size="small">
+                {{ hasException(scope.row) ? '有差异' : '一致' }}
+              </el-tag>
+            </template>
+
+            <template v-slot:exceptionRemark="scope">
+              <el-input
+                v-model="scope.row.exceptionRemark"
+                :disabled="isView"
+                maxlength="255"
+                show-word-limit
+                placeholder="选填"
+                size="small"
+              />
+            </template>
+
             <template v-slot:headerRequired="{ column }">
               <span class="is-required">{{ column.label }}</span>
             </template>
@@ -271,6 +314,16 @@ import tabMixins from '@/mixins/tableColumnsMixin';
       };
     },
     computed: {
+      exceptionDetermineOptions() {
+        const purchase = this.queryDimension == 3;
+        return [
+          { value: 1, label: purchase ? '多收' : '多发' },
+          { value: 2, label: purchase ? '少收' : '少发' },
+          { value: 3, label: purchase ? '错收' : '错发' },
+          { value: 5, label: '质量不良' },
+          { value: 6, label: '丢失' }
+        ];
+      },
       isView() {
         return this.dialogType === 'view';
       },
@@ -475,6 +528,41 @@ import tabMixins from '@/mixins/tableColumnsMixin';
                 ?.name;
             }
           },
+          {
+            minWidth: 120,
+            prop: 'diffQty',
+            label: '差异数量',
+            align: 'center',
+            slot: 'diffQty'
+          },
+          {
+            minWidth: 120,
+            prop: 'diffAmount',
+            label: '差异金额',
+            align: 'center',
+            slot: 'diffAmount'
+          },
+          {
+            minWidth: 150,
+            prop: 'exceptionDetermine',
+            label: '处置类型',
+            align: 'center',
+            slot: 'exceptionDetermine'
+          },
+          {
+            minWidth: 100,
+            prop: 'exceptionStatus',
+            label: '异常状态',
+            align: 'center',
+            slot: 'exceptionStatus'
+          },
+          {
+            minWidth: 180,
+            prop: 'exceptionRemark',
+            label: '异常说明',
+            align: 'center',
+            slot: 'exceptionRemark'
+          },
         ]
         if(this.$route.path === '/receivableManage' || this.isShowDispatchDate){
           columns = columns.filter((item) => item.prop !== 'productOperateTime');
@@ -677,6 +765,29 @@ import tabMixins from '@/mixins/tableColumnsMixin';
         const text = String(value);
         if (!list.includes(text)) list.push(text);
       },
+      // 异常状态:数量或金额有差异即为异常(数量按当前编辑值实时算)
+      hasException(row) {
+        const qty = Math.abs(
+          Math.abs(Number(row.statementCount) || 0) - (Number(row.totalCount) || 0)
+        );
+        const amount = Math.abs(Number(this.formatDiffAmount(row)) || 0);
+        return qty > 0 || amount > 0;
+      },
+      // 差异金额:优先服务端快照;编辑中按 对账金额 - 折让合计 估算
+      formatDiffAmount(row) {
+        if (row.diffAmount != null) {
+          return row.diffAmount;
+        }
+        const statementAmount = Number(row.statementAmount) || 0;
+        const discountTotalPrice = Number(row.discountTotalPrice) || 0;
+        return Math.round(Math.abs(statementAmount - discountTotalPrice) * 10000) / 10000;
+      },
+      // 差异数量:前端只读展示,最终以服务端重算为准
+      formatDiffQty(row) {
+        const statementCount = Math.abs(Number(row.statementCount) || 0);
+        const totalCount = Number(row.totalCount) || 0;
+        return Math.round(Math.abs(statementCount - totalCount) * 10000) / 10000;
+      },
       // 数值收敛到 4 位小数
       roundNumber(value) {
         const num = +value || 0;
@@ -887,17 +998,8 @@ import tabMixins from '@/mixins/tableColumnsMixin';
         return price <= 0;
       },
       validateStatementCount(rule, value, callback, row) {
-        const val = +value || 0;
-        const max = Math.abs(row.outboundCount || 0);
-        if (Math.abs(val) > max) {
-          callback(new Error('不能超出库数量'));
-        } 
-        // else if (this.queryDimension == 1 && val != row.outboundCount) {
-        //   callback(new Error('按发货单查询时不可修改'));
-        // } 
-        else {
-          callback();
-        }
+        // 对账数量允许大于单据/库数量(多发/多收场景),不再限制上限
+        callback();
       },
       // 批量设置
       batchSetTaxRate() {

+ 113 - 0
src/views/saleManage/saleOrder/accountstatement/components/inventoryTable.vue

@@ -93,6 +93,49 @@
                     </el-form-item>
                   </template>
 
+                  <template v-slot:diffQty="scope">
+                    <span>{{ formatDiffQty(scope.row) }}</span>
+                  </template>
+
+                  <template v-slot:diffAmount="scope">
+                    <span>{{ formatDiffAmount(scope.row) }}</span>
+                  </template>
+
+                  <template v-slot:exceptionDetermine="scope">
+                    <el-select
+                      v-model="scope.row.exceptionDetermine"
+                      :disabled="dialogType === 'view'"
+                      clearable
+                      placeholder="请选择"
+                      size="small"
+                    >
+                      <el-option
+                        v-for="option in exceptionDetermineOptions"
+                        :key="option.value"
+                        :label="option.label"
+                        :value="option.value"
+                        :disabled="option.disabled"
+                      />
+                    </el-select>
+                  </template>
+
+                  <template v-slot:exceptionStatus="scope">
+                    <el-tag :type="hasException(scope.row) ? 'danger' : 'success'" size="small">
+                      {{ hasException(scope.row) ? '有差异' : '一致' }}
+                    </el-tag>
+                  </template>
+
+                  <template v-slot:exceptionRemark="scope">
+                    <el-input
+                      v-model="scope.row.exceptionRemark"
+                      :disabled="dialogType === 'view'"
+                      maxlength="255"
+                      show-word-limit
+                      placeholder="选填"
+                      size="small"
+                    />
+                  </template>
+
                   <template v-slot:discountRatio="scope">
                     <el-form-item
                       :prop="'deliveryProducts.' + scope.$index + '.discountRatio'"
@@ -182,6 +225,16 @@ export default {
   components: {},
   props: ['datasource', 'dialogType', 'dataForm', 'type'],
   computed: {
+    exceptionDetermineOptions() {
+      const purchase = this.type === 'purchase';
+      return [
+        { value: 1, label: purchase ? '多收' : '多发' },
+        { value: 2, label: purchase ? '少收' : '少发' },
+        { value: 3, label: purchase ? '错收' : '错发' },
+        { value: 5, label: '质量不良' },
+        { value: 6, label: '丢失' }
+      ];
+    },
     columnsFactory() {
       // 标准 mixin 列宽持久化:columnsVersion 让 mixin 触发重算,applyColumnWidth 应用缓存宽度
       this.columnsVersion;
@@ -501,6 +554,43 @@ export default {
           // ],
         }
         permissionType[this.taskDefinitionKey] && basicFields.push(...permissionType[this.taskDefinitionKey])
+        basicFields.push(
+          {
+            minWidth: 120,
+            prop: 'diffQty',
+            label: '差异数量',
+            align: 'center',
+            slot: 'diffQty'
+          },
+          {
+            minWidth: 120,
+            prop: 'diffAmount',
+            label: '差异金额',
+            align: 'center',
+            slot: 'diffAmount'
+          },
+          {
+            minWidth: 150,
+            prop: 'exceptionDetermine',
+            label: '处置类型',
+            align: 'center',
+            slot: 'exceptionDetermine'
+          },
+          {
+            minWidth: 100,
+            prop: 'exceptionStatus',
+            label: '异常状态',
+            align: 'center',
+            slot: 'exceptionStatus'
+          },
+          {
+            minWidth: 180,
+            prop: 'exceptionRemark',
+            label: '异常说明',
+            align: 'center',
+            slot: 'exceptionRemark'
+          }
+        )
         return this.applyColumnWidth(basicFields)
       }
     },
@@ -588,6 +678,29 @@ export default {
     // console.log('activeNames~~~', this.activeNames)
   },
   methods: {
+    // 异常状态:数量或金额有差异即为异常(数量按当前编辑值实时算)
+    hasException(row) {
+      const qty = Math.abs(
+        Math.abs(Number(row.statementCount) || 0) - (Number(row.totalCount) || 0)
+      );
+      const amount = Math.abs(Number(this.formatDiffAmount(row)) || 0);
+      return qty > 0 || amount > 0;
+    },
+    // 差异金额:优先服务端快照;编辑中按 对账金额 - 折让合计 估算
+    formatDiffAmount(row) {
+      if (row.diffAmount != null) {
+        return row.diffAmount;
+      }
+      const statementAmount = Number(row.statementAmount) || 0;
+      const discountTotalPrice = Number(row.discountTotalPrice) || 0;
+      return Math.round(Math.abs(statementAmount - discountTotalPrice) * 10000) / 10000;
+    },
+    // 差异数量:前端只读展示,最终以服务端重算为准
+    formatDiffQty(row) {
+      const statementCount = Math.abs(Number(row.statementCount) || 0);
+      const totalCount = Number(row.totalCount) || 0;
+      return Math.round(Math.abs(statementCount - totalCount) * 10000) / 10000;
+    },
     // 退货单副表列宽(scope: sub1)
     returnColumns(item) {
       return this.applyScopedColumnWidth(

+ 3 - 3
src/views/saleManage/saleOrder/customerReturnOrder/index.vue

@@ -98,15 +98,15 @@
             >
               提交
             </el-link>
-            <!-- <el-link
+            <el-link
               type="primary"
               :underline="false"
               icon="el-icon-plus"
               @click="handleAddSaleOrder(row)"
-              v-if="[2].includes(row.approvalStatus)&&!row.resendId"
+              v-if="[2].includes(row.approvalStatus)&&!row.resendId&&row.returnSourceType==5"
             >
               创建发货单
-            </el-link> -->
+            </el-link>
             <el-popconfirm
               class="ele-action"
               title="确定要删除此信息吗?"

+ 58 - 17
src/views/saleManage/saleOrder/exceptionManagement/components/addOrEditDialog.vue

@@ -109,9 +109,10 @@
           <span class="is-required">{{ column.label }}</span>
         </template>
         <template v-slot:exceptionDispose="scope">
+          <span v-if="title == '详情'">{{ disposeLabel(scope.row.exceptionDispose) }}</span>
           <el-select
+            v-else
             v-model="scope.row.exceptionDispose"
-            :disabled="title == '详情'"
             placeholder="请选择"
           >
             <el-option
@@ -128,9 +129,10 @@
           </el-input>
         </template>
         <template v-slot:exceptionDetermine="scope">
+          <span v-if="title == '详情'">{{ determineLabel(scope.row.exceptionDetermine) }}</span>
           <el-select
+            v-else
             v-model="scope.row.exceptionDetermine"
-            :disabled="title == '详情'"
             placeholder="请选择"
           >
             <el-option
@@ -457,39 +459,78 @@ import tabMixins from '@/mixins/tableColumnsMixin';
           }
         ]);
       },
+      // 处置方式:与后端 ExceptionDisposeEnum(1-12) 保持一致
       options() {
-        return this.relationType == 1
-          ? [
-              { label: '退货入库', value: 1 },
-              { label: '返工返修', value: 2 },
-              { label: '报损', value: 3 },
-              { label: '报废', value: 4 }
-            ]
-          : [
-              { label: '退货出库', value: 1 },
-              { label: '返工返修', value: 2 },
-              { label: '报损', value: 3 },
-              { label: '报废', value: 4 }
-            ];
+        return [
+          { label: '退货入库(出库)', value: 1 },
+          { label: '返工返修', value: 2 },
+          { label: '报损', value: 3 },
+          { label: '报废', value: 4 },
+          { label: '不处置', value: 5 },
+          { label: '退回成品仓', value: 6 },
+          { label: '补发/补收', value: 7 },
+          { label: '退回后重发', value: 8 },
+          { label: '退回不良品仓', value: 9 },
+          { label: '报损核销', value: 10 },
+          { label: '生成应付单', value: 11 },
+          { label: '生成应收单', value: 12 }
+        ];
       },
+      // 异常类型:与后端 ExceptionDetermineEnum(1-8) 保持一致
       options1() {
         return this.relationType == 1
           ? [
               { label: '多发', value: 1 },
               { label: '少发', value: 2 },
               { label: '错发', value: 3 },
-              { label: '损坏', value: 4 }
+              { label: '损坏', value: 4 },
+              { label: '质量不良', value: 5 },
+              { label: '丢失', value: 6 },
+              { label: '退款', value: 7 },
+              { label: '收款', value: 8 }
             ]
           : [
               { label: '多收', value: 1 },
               { label: '少收', value: 2 },
               { label: '错收', value: 3 },
-              { label: '损坏', value: 4 }
+              { label: '损坏', value: 4 },
+              { label: '质量不良', value: 5 },
+              { label: '丢失', value: 6 },
+              { label: '退款', value: 7 },
+              { label: '收款', value: 8 }
             ];
       }
     },
 
     methods: {
+      // 异常类型文本(详情态):采购(relationType=5)与销售标签不同
+      determineLabel(code) {
+        if (!code) return '--';
+        const purchase = String(this.form.relationType) === '5';
+        const map = purchase
+          ? { 1: '多收', 2: '少收', 3: '错收', 4: '损坏', 5: '质量不良', 6: '丢失', 7: '退款', 8: '收款' }
+          : { 1: '多发', 2: '少发', 3: '错发', 4: '损坏', 5: '质量不良', 6: '丢失', 7: '退款', 8: '收款' };
+        return map[code] || code;
+      },
+      // 处置方式文本(详情态):与后端 ExceptionDisposeEnum 一致
+      disposeLabel(code) {
+        if (!code) return '--';
+        const map = {
+          1: '退货入库(出库)',
+          2: '返工返修',
+          3: '报损',
+          4: '报废',
+          5: '不处置',
+          6: '退回成品仓',
+          7: '补发/补收',
+          8: '退回后重发',
+          9: '退回不良品仓',
+          10: '报损核销',
+          11: '生成应付单',
+          12: '生成应收单'
+        };
+        return map[code] || code;
+      },
       openDialog() {
         let ref =
           this.relationType == 1

+ 58 - 2
src/views/saleManage/saleOrder/exceptionManagement/exceptionList/index.vue

@@ -127,7 +127,7 @@
         <dispose
           ref="disposeRef"
           @done="reload"
-          :relationType="relationType == '1,3' ? 1 : relationType"
+          :relationType="relationType && relationType.includes('1') ? 1 : relationType"
         ></dispose>
       </ele-pro-table>
     </el-card>
@@ -162,7 +162,7 @@
     mixins: [dictMixins, tabMixins],
     props: {
       relationType: {
-        default: '1,3'
+        default: '1,3,4'
       }
     },
     data() {
@@ -262,6 +262,33 @@
             label: '来源单据名称',
             align: 'center'
           },
+          {
+            prop: 'exceptionDetermine',
+            label: '异常类型',
+            align: 'center',
+            formatter: (row) => this.determineLabel(row)
+          },
+          {
+            prop: 'exceptionDispose',
+            label: '处置方式',
+            align: 'center',
+            formatter: (row) => this.disposeLabel(row.exceptionDispose)
+          },
+          {
+            prop: 'diffQty',
+            label: '差异数量',
+            align: 'center'
+          },
+          {
+            prop: 'diffAmount',
+            label: '差异金额',
+            align: 'center'
+          },
+          {
+            prop: 'disposalDocNo',
+            label: '处置单据号',
+            align: 'center'
+          },
 
           {
             prop: 'createUserName',
@@ -317,6 +344,35 @@
       dispose(type, row) {
         this.$refs.disposeRef.open(type, row);
       },
+      // 异常类型:销售/采购标签不同
+      determineLabel(row) {
+        const code = row.exceptionDetermine;
+        if (!code) return '--';
+        const purchase = String(row.relationType) === '5';
+        const map = purchase
+          ? { 1: '多收', 2: '少收', 3: '错收', 4: '损坏', 5: '质量不良', 6: '丢失', 7: '退款', 8: '收款' }
+          : { 1: '多发', 2: '少发', 3: '错发', 4: '损坏', 5: '质量不良', 6: '丢失', 7: '退款', 8: '收款' };
+        return map[code] || code;
+      },
+      // 处置方式
+      disposeLabel(code) {
+        if (!code) return '--';
+        const map = {
+          1: '退货入库(出库)',
+          2: '返工返修',
+          3: '报损',
+          4: '报废',
+          5: '不处置',
+          6: '退回成品仓',
+          7: '补发/补收',
+          8: '退回后重发',
+          9: '退回不良品仓',
+          10: '报损核销',
+          11: '生成应付单',
+          12: '生成应收单'
+        };
+        return map[code] || code;
+      },
       /* 表格数据源 */
       datasource({ page, limit, where }) {
         return getList({