From 6c32142688766a4a25253b3d1e07a6530bb2907d Mon Sep 17 00:00:00 2001 From: “wangming” <“wangming@antissoft.com”> Date: Tue, 31 Mar 2026 11:45:51 +0800 Subject: [PATCH] Refactor build script and enhance sales order handling --- Antis.Erp.Plat/antis-ncc-admin/package.json | 2 +- Antis.Erp.Plat/antis-ncc-admin/src/views/wtSp/index.vue | 4 ++-- Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/Form.vue | 27 ++++++++++++++++++++------- Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/detail-view.vue | 579 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/Form.vue | 19 ++++++++++--------- Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/detail-view.vue | 494 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/index.vue | 15 +++++++++++++-- Antis.Erp.Plat/douyin/DouyinLogistics.API/Services/OrderService.cs | 3 ++- Antis.Erp.Plat/netcore/src/Modularity/Extend/NCC.Extend/WtXsckdService.cs | 34 +++++++++++++++++++++++++++++++--- Antis.Erp.Plat/sy/settlement.html | 9 +++++++++ 11 files changed, 1215 insertions(+), 35 deletions(-) create mode 100644 Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/detail-view.vue create mode 100644 Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/detail-view.vue diff --git a/Antis.Erp.Plat/antis-ncc-admin/package.json b/Antis.Erp.Plat/antis-ncc-admin/package.json index 8f045f2..12f16fd 100755 --- a/Antis.Erp.Plat/antis-ncc-admin/package.json +++ b/Antis.Erp.Plat/antis-ncc-admin/package.json @@ -7,7 +7,7 @@ "scripts": { "dev": "vue-cli-service serve --open", "dev:3000": "vue-cli-service serve --port 3000", - "build": "cross-env NODE_ENV=production NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build", + "build": "cross-env NODE_ENV=production vue-cli-service build", "build:staging": "cross-env NODE_ENV=production vue-cli-service build --mode staging", "build:javaBootDev": "cross-env NODE_ENV=production vue-cli-service build --mode javaBootDev", "build:javaBootTest": "cross-env NODE_ENV=production vue-cli-service build --mode javaBootTest", diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtSp/index.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtSp/index.vue index 1ff34cd..23df5a4 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtSp/index.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtSp/index.vue @@ -45,7 +45,7 @@ - + @@ -113,7 +113,7 @@ - + diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/Form.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/Form.vue index 287c6ff..8c66b48 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/Form.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/Form.vue @@ -329,6 +329,7 @@ djlx:undefined, djzt: '', // 单据状态 cbje: undefined, // 主表出库成本合计(详情/已保存单据由后端返回) + ly: '后台', // 单据来源:后台录入为「后台」;收银台为「门店」,后台不可改 }, rules: { }, @@ -393,6 +394,12 @@ mounted() { }, methods: { + /** ERP 新建/保存销售出库单时固定为「后台」,避免与收银台「门店」混淆 */ + ensureBackendSalesSource() { + if (this.dataForm.djlx === '销售出库单') { + this.dataForm.ly = this.dataForm.ly || '后台' + } + }, // 获取商品信息(只通过API获取序列号类型) async getProductInfo(productId) { const key = String(productId); @@ -720,6 +727,8 @@ }) } else{ + _this.dataForm.ly = '后台'; + _this.dataForm.djlx = '销售出库单'; // 新建时加载默认选项设置 request({ url: '/api/Extend/WtMrsz', method: 'get' }).then(res => { if (res.data) { @@ -739,6 +748,7 @@ async saveDraft() { // 确保单据类型字段赋值 this.dataForm.djlx = '销售出库单'; + this.ensureBackendSalesSource(); this.$refs['elForm'].validate(async (valid) => { if (valid) { try { @@ -807,6 +817,7 @@ this.dataForm.djlx = '销售出库单'; // 确保单据状态为待审核 this.dataForm.djzt = '待审核'; + this.ensureBackendSalesSource(); // 检查是否有明细数据 if (!this.dataForm.wtXsckdMxList || this.dataForm.wtXsckdMxList.length === 0) { console.log('没有明细数据,跳过序列号验证'); @@ -916,6 +927,7 @@ if (valid) { console.log('表单验证通过,继续提交...'); try { + this.ensureBackendSalesSource(); // 格式化所有明细行的金额字段为 2 位小数 this.dataForm.wtXsckdMxList.forEach(row => { if (row.dj) { @@ -996,6 +1008,7 @@ if (valid) { console.log('表单验证通过,继续提交...'); try { + this.ensureBackendSalesSource(); if (!this.dataForm.id) { const res = await request({ url: `/api/Extend/WtXsckd`, @@ -1574,13 +1587,13 @@ }, getSpOptionLabel(item) { const base = ((item.spbm || '') + ' ' + (item.F_Spmc || '')).trim() - const c = this.productCostPreviewMap[item.F_Id] - if (c != null && c !== '' && !isNaN(parseFloat(c))) { - return base + ' (成本¥' + parseFloat(c).toFixed(2) + ')' - } - if (!this.costContextCk()) { - return base + ' (选仓库后显示成本)' - } + // const c = this.productCostPreviewMap[item.F_Id] + // if (c != null && c !== '' && !isNaN(parseFloat(c))) { + // return base + ' (成本¥' + parseFloat(c).toFixed(2) + ')' + // } + // if (!this.costContextCk()) { + // return base + ' (选仓库后显示成本)' + // } return base }, async loadProductCostPreviewMap() { diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/detail-view.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/detail-view.vue new file mode 100644 index 0000000..364379f --- /dev/null +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/detail-view.vue @@ -0,0 +1,579 @@ + + + + + + + + {{ cellText(detail.id) }} + + {{ djztLabel }} + + + + + + + 收款金额(与列表一致) + {{ displayCollectionAmount }} + + + + + 有原价时收款=原价−优惠;组合支付以 skmx 汇总为准 + + + + + + + + {{ formatDjrq(detail.djrq) }} + + + + + + {{ cellText(detail.djlx || '销售出库单') }} + + + + + + {{ formatLy(detail.ly) }} + + + + + + {{ labelFromOptions(detail.cjckId || detail.cjck, cjckOptions) }} + + + + + + {{ cellText(detail.jsr) }} + + + + + + {{ cellText(detail.hysjh) }} + + + + + + + 出库明细 + (列表不换行展示) + + + + + + + + {{ labelFromOptions(scope.row.ckck, cjckOptions) }} + + + + + + + + {{ cellText(scope.row.spmc) }} + + + + + + {{ cellText(scope.row.sl) }} + + + + + {{ formatMoneyCol(scope.row.dj) }} + + + + + {{ formatMoneyCol(scope.row.je) }} + + + + + {{ formatMoneyCol(scope.row.cbje) }} + + + + + + {{ sn }} + + 无 + + + + + + + + + {{ labelFromOptions(detail.skzh, skzhOptions) }} + + + + + + {{ displayOriginalPrice }} + + + + + + {{ displayDiscountAmount }} + + + + + + {{ formatMoneyCol(detail.cbje) }} + + + + + + {{ cellText(detail.zdr) }} + + + + + + {{ cellText(detail.shr) }} + + + + + + {{ cellText(detail.gzr) }} + + + + {{ cellText(detail.bz) }} + + + + + + 暂无数据 + + + + + + + + diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue index 5f4be17..a228ea3 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsckd/index.vue @@ -78,8 +78,9 @@ - - + + + @@ -138,20 +139,25 @@ + + {{ formatLy(scope.row.ly) }} + 已审核 一级已审 + 草稿 + 无需审核 待审核 {{ scope.row.djzt || '待审核' }} - + - 查看 - 编辑 - 一级审核 - 二级审核 + 查看 + 编辑 + 一级审核 + 二级审核 删除 @@ -160,6 +166,7 @@ + @@ -167,10 +174,11 @@ import request from '@/utils/request' import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import NCCForm from './Form' + import DetailView from './detail-view' import ExportBox from './ExportBox' import { previewDataInterface } from '@/api/systemData/dataInterface' export default { - components: { NCCForm, ExportBox }, + components: { NCCForm, DetailView, ExportBox }, data() { return { showAll: false, @@ -200,6 +208,7 @@ sidx: "", }, formVisible: false, + detailVisible: false, exportBoxVisible: false, columnList: [ { prop: 'id', label: '单据编号' }, @@ -228,6 +237,33 @@ this.getskzhOptions(); }, methods: { + /** 收银台/抖音等:不走 ERP 二级审核、仅查看 */ + isSkipErpAuditSource(row) { + if (!row) return false + const ly = row.ly + if (ly === '门店' || ly === '抖音订单' || ly === '抖音抓单') return true + const bz = row.bz != null && row.bz !== '' ? String(row.bz).trim() : '' + if (bz.startsWith('抖音订单:')) return true + return false + }, + /** 后台来源且草稿可编辑 */ + canEditDraft(row) { + return !this.isSkipErpAuditSource(row) && row.djzt === '草稿' + }, + canFirstApprove(row) { + if (this.isSkipErpAuditSource(row)) return false + if (row.djzt === '草稿' || row.djzt === '已审核') return false + return row.djzt === '待审核' || row.djzt === '' || row.djzt == null + }, + canSecondApprove(row) { + return !this.isSkipErpAuditSource(row) && row.djzt === '一级已审' + }, + formatLy(ly) { + if (ly == null || ly === '') return '无' + if (ly === '门店') return '门店(收银台)' + if (ly === '抖音订单') return '抖音订单' + return ly + }, // ✅ 原价:优先使用后端存储的 ydje(与收银台订单原价一致),无则用 收款+优惠 兼容旧数据 getDisplayOriginalPrice(row) { const ydje = row.ydje != null && row.ydje !== ''; @@ -392,10 +428,17 @@ }) }).catch(() => { }) }, - addOrUpdateHandle(id, isDetail) { + openDetail(id) { + if (!id) return + this.detailVisible = true + this.$nextTick(() => { + if (this.$refs.NCCDetailView) this.$refs.NCCDetailView.init(id) + }) + }, + addOrUpdateHandle(id) { this.formVisible = true this.$nextTick(() => { - this.$refs.NCCForm.init(id, isDetail) + this.$refs.NCCForm.init(id, false) }) }, exportData() { @@ -428,6 +471,7 @@ }, refresh(isrRefresh) { this.formVisible = false + this.detailVisible = false if (isrRefresh) this.reset() }, reset() { diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/Form.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/Form.vue index 3570cbf..fd92a9f 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/Form.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/Form.vue @@ -1,7 +1,7 @@ - - + + - + @@ -215,7 +215,7 @@ 取 消 - 确 定 + 确 定 @@ -233,7 +233,6 @@ return { loading: false, visible: false, - isDetail: false, dataForm: { id:'', id:undefined, @@ -324,10 +323,9 @@ goBack() { this.$emit('refresh') }, - init(id, isDetail) { + init(id) { this.dataForm.id = id || 0; this.visible = true; - this.isDetail = isDetail || false; this.$nextTick(() => { this.$refs['elForm'].resetFields(); if (this.dataForm.id) { @@ -358,8 +356,11 @@ // 同步明细表的入库仓库与主表保持一致 this.syncDetailWarehouses(); - // 计算总金额 - this.updateTotalAmount(); + // 主表退款金额 skje 以服务端为准(收银台选择的实退金额),不能用明细 je 合计覆盖, + // 否则会出现列表 320、详情被算成 388 等不一致。 + if (this.dataForm.skje == null || this.dataForm.skje === '') { + this.updateTotalAmount(); + } }) } else { // 新建时确保wtXsckdMxList为空数组 diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/detail-view.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/detail-view.vue new file mode 100644 index 0000000..f0ae8d6 --- /dev/null +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/detail-view.vue @@ -0,0 +1,494 @@ + + + + + + + + + {{ cellText(detail.id) }} + + {{ djztLabel }} + + + + + + + + 退款金额(收银台实退) + {{ formatMoneyCol(detail.skje) }} + + + + + 与明细「金额」合计可能不一致(议价、部分退等以本金额为准) + + + + + + + + {{ formatDjrq(detail.djrq) }} + + + + + + {{ cellText(detail.djlx || '销售退货单') }} + + + + + + {{ cellText(detail.cjck) }} + + + + + + {{ cellText(detail.jsr) }} + + + + + + + 退货明细 + (列表不换行展示) + + + + + + + + {{ labelFromOptions(scope.row.ckck, cjckOptions) }} + + + + + + + + {{ cellText(scope.row.spmc) }} + + + + + + {{ cellText(scope.row.sl) }} + + + + + {{ formatMoneyCol(scope.row.dj) }} + + + + + {{ formatMoneyCol(scope.row.je) }} + + + + + {{ cellText(scope.row.description) }} + + + + + + {{ sn }} + + 无 + + + + + + + + + {{ labelFromOptions(detail.skzh, skzhOptions) }} + + + + + + {{ cellText(detail.shr) }} + + + + + + {{ cellText(detail.gzr) }} + + + + {{ cellText(detail.bz) }} + + + + + + 暂无数据 + + + + + + + + diff --git a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/index.vue b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/index.vue index cd86894..e6d44af 100644 --- a/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/index.vue +++ b/Antis.Erp.Plat/antis-ncc-admin/src/views/wtXsthd/index.vue @@ -133,6 +133,7 @@ + @@ -140,10 +141,11 @@ import request from '@/utils/request' import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import NCCForm from './Form' + import DetailView from './detail-view' import ExportBox from './ExportBox' import { previewDataInterface } from '@/api/systemData/dataInterface' export default { - components: { NCCForm, ExportBox }, + components: { NCCForm, DetailView, ExportBox }, data() { return { showAll: false, @@ -171,6 +173,7 @@ sidx: "", }, formVisible: false, + detailVisible: false, exportBoxVisible: false, columnList: [ { prop: 'id', label: '单据编号' }, @@ -325,9 +328,16 @@ }).catch(() => { }) }, addOrUpdateHandle(id, isDetail) { + if (isDetail) { + this.detailVisible = true + this.$nextTick(() => { + if (this.$refs.NCCDetailView) this.$refs.NCCDetailView.init(id) + }) + return + } this.formVisible = true this.$nextTick(() => { - this.$refs.NCCForm.init(id, isDetail) + this.$refs.NCCForm.init(id) }) }, exportData() { @@ -360,6 +370,7 @@ }, refresh(isrRefresh) { this.formVisible = false + this.detailVisible = false if (isrRefresh) this.reset() }, reset() { diff --git a/Antis.Erp.Plat/douyin/DouyinLogistics.API/Services/OrderService.cs b/Antis.Erp.Plat/douyin/DouyinLogistics.API/Services/OrderService.cs index 31034f4..7efd445 100644 --- a/Antis.Erp.Plat/douyin/DouyinLogistics.API/Services/OrderService.cs +++ b/Antis.Erp.Plat/douyin/DouyinLogistics.API/Services/OrderService.cs @@ -1307,7 +1307,8 @@ public class OrderService djlx = "销售出库单", kh = defaultKh, gys = "", - djzt = "待审核", + // 抖音发货带出单不走 ERP 二级审核,与收银台一致视为已生效 + djzt = "已审核", ly = "抖音订单", skmx = "", wtXsckdMxList = salesOrderDetails diff --git a/Antis.Erp.Plat/netcore/src/Modularity/Extend/NCC.Extend/WtXsckdService.cs b/Antis.Erp.Plat/netcore/src/Modularity/Extend/NCC.Extend/WtXsckdService.cs index 5aa0457..1c4e297 100644 --- a/Antis.Erp.Plat/netcore/src/Modularity/Extend/NCC.Extend/WtXsckdService.cs +++ b/Antis.Erp.Plat/netcore/src/Modularity/Extend/NCC.Extend/WtXsckdService.cs @@ -336,7 +336,8 @@ namespace NCC.Extend.WtXsckd bz = xsckd.Bz, djlx = xsckd.Djlx, - djzt = xsckd.Djzt + djzt = xsckd.Djzt, + ly = xsckd.Ly }).MergeTable().OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); var pageRows = data.list?.ToList() ?? new List(); await EnrichWtXsckdListWarehouseDisplayAsync(pageRows); @@ -973,7 +974,8 @@ namespace NCC.Extend.WtXsckd gys = SqlFunc.Subqueryable().Where(u => u.Id == xsckd.Gys).Select(u => u.Gysmc), bz = xsckd.Bz, djlx = xsckd.Djlx, - djzt = xsckd.Djzt + djzt = xsckd.Djzt, + ly = xsckd.Ly }).MergeTable().OrderBy(sidx + " " + input.sort).ToListAsync(); await EnrichWtXsckdListWarehouseDisplayAsync(data); return data; @@ -1137,6 +1139,8 @@ namespace NCC.Extend.WtXsckd EnsureBjhcbColumn(); var oldHeader = await _db.Queryable().FirstAsync(p => p.Id == id); var oldMxList = await _db.Queryable().Where(u => u.Djbh == id).ToListAsync(); + if (IsSalesOutboundSkipErpAudit(oldHeader)) + throw NCCException.Bah("收银台或抖音等外部来源的销售出库单不允许在此修改"); var entity = input.Adapt(); entity.Bjsx = input.bjsx; @@ -2129,6 +2133,26 @@ ORDER BY t.`商品编号`;"; } /// + /// 销售出库单是否跳过 ERP 二级审核:收银台「门店」、抖音「抖音订单/抖音抓单」、或备注为抖音发货脚本格式(抖音订单:…)。 + /// + private static bool IsSalesOutboundSkipErpAudit(WtXsckdEntity entity) + { + if (entity == null) return false; + if (!string.Equals(entity.Djlx, "销售出库单", StringComparison.Ordinal)) return false; + var ly = entity.Ly?.Trim(); + if (!string.IsNullOrEmpty(ly)) + { + if (string.Equals(ly, "门店", StringComparison.Ordinal)) return true; + if (string.Equals(ly, "抖音订单", StringComparison.Ordinal)) return true; + if (string.Equals(ly, "抖音抓单", StringComparison.Ordinal)) return true; + } + var bz = entity.Bz?.Trim(); + if (!string.IsNullOrEmpty(bz) && bz.StartsWith("抖音订单:", StringComparison.Ordinal)) + return true; + return false; + } + + /// /// 通用两级审核逻辑:根据 wt_shrysz 配置自动适配单级/两级审批 /// [NonAction] @@ -2272,11 +2296,15 @@ ORDER BY t.`商品编号`;"; } /// - /// 审核销售出库单(支持两级审核) + /// 审核销售出库单(支持两级审核)。收银台「门店」、抖音「抖音订单」等外部来源无需在此审核。 /// + /// 销售出库单主键 [HttpPost("ApproveSalesOutbound/{id}")] public async Task ApproveSalesOutbound(string id) { + var header = await _db.Queryable().FirstAsync(p => p.Id == id); + if (header != null && IsSalesOutboundSkipErpAudit(header)) + return new { success = false, message = "收银台或抖音等外部来源的销售出库单无需在此审核" }; return await ApproveDocument(id, "销售出库单"); } diff --git a/Antis.Erp.Plat/sy/settlement.html b/Antis.Erp.Plat/sy/settlement.html index 92fbdc6..318138d 100755 --- a/Antis.Erp.Plat/sy/settlement.html +++ b/Antis.Erp.Plat/sy/settlement.html @@ -967,6 +967,10 @@ "bz": "", // 单据类型 "djlx": "销售出库单", + // 单据来源:与 ERP 后台「门店(收银台)」一致,用于免审、仅查看 + "ly": "门店", + // 收银台成交即生效,不走 ERP 二级审核 + "djzt": "已审核", // 会员手机号码 "hysjh": "", // 销售出库单明细列表 @@ -2469,6 +2473,8 @@ this.info.zdr = this.selectedCashier; this.info.djrq = new Date().toISOString(); // 确保日期时间正确 delete this.info.id; // 让后端生成ID + this.info.ly = '门店'; + this.info.djzt = '已审核'; axios({ url: this.baseUrl + "/api/Extend/wtxsckd", @@ -2785,6 +2791,9 @@ } delete orderData.id; // 让后端生成ID + // 与 info 一致:收银台固定来源与状态(避免 spread 遗漏或被覆盖) + orderData.ly = '门店'; + orderData.djzt = '已审核'; console.log(`✅ 创建${documentType},商品数量: ${items.length},订单金额: ${groupTotalAmount.toFixed(2)}`); -- libgit2 0.21.4
+ + 有原价时收款=原价−优惠;组合支付以 skmx 汇总为准 +
+ + 与明细「金额」合计可能不一致(议价、部分退等以本金额为准) +