From b922bafe8d28d9d21291382de05b69988426a324 Mon Sep 17 00:00:00 2001 From: vayne Date: Thu, 20 Jun 2024 09:38:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=AD=E8=AF=81=E9=87=87=E8=B4=AD=E9=A2=9D?= =?UTF-8?q?=E5=92=8C=E9=94=80=E5=94=AE=E9=A2=9D=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jnpf/jnpf-upload-pound/index.vue | 2 +- .../scm/form/purchaseReceiptVoucher/index.vue | 181 ++++++++++++------ jnpf-app/utils/jnpf.js | 81 ++++++++ .../jnpf/service/impl/VoucherServiceImpl.java | 4 +- .../main/java/jnpf/entity/VoucherEntity.java | 4 +- .../jnpf/entity/VoucherProductEntity.java | 4 +- .../java/jnpf/model/voucher/VoucherForm.java | 4 +- 7 files changed, 211 insertions(+), 69 deletions(-) diff --git a/jnpf-app/components/jnpf/jnpf-upload-pound/index.vue b/jnpf-app/components/jnpf/jnpf-upload-pound/index.vue index cff2e9ba..7452dfa0 100644 --- a/jnpf-app/components/jnpf/jnpf-upload-pound/index.vue +++ b/jnpf-app/components/jnpf/jnpf-upload-pound/index.vue @@ -125,7 +125,7 @@ url: data.data.url }) this.$emit('input', this.fileList) - this.$emit('change', this.fileList) + this.$emit('change', this.fileList, data) } else { lists.splice(index, 1) this.$u.toast(data.msg) diff --git a/jnpf-app/pages/scm/form/purchaseReceiptVoucher/index.vue b/jnpf-app/pages/scm/form/purchaseReceiptVoucher/index.vue index a50ad44a..a3666345 100644 --- a/jnpf-app/pages/scm/form/purchaseReceiptVoucher/index.vue +++ b/jnpf-app/pages/scm/form/purchaseReceiptVoucher/index.vue @@ -88,7 +88,7 @@ - @@ -103,8 +103,8 @@ - + @@ -129,28 +129,34 @@ + + + + + + - - + + - + interfaceId="545146513462930117" :pageSize="20" placeholder="请选择" type="popup" + :style='{"width":"100%"}'>{ "fieldName": "", "field": "subjectId", "defaultValue": "", "jnpfKey": "popupSelect", "dataType": "varchar", "id": "spNokw1", "relationField": "supplierId", "required": "0" } - @@ -158,7 +164,7 @@ - @@ -166,31 +172,31 @@ - + placeholder="数字文本" :step="1" @input="UpdateWeight(dataForm.voucherProductList[i])"> - + placeholder="数字文本" :step="1" @input="UpdateWeight(dataForm.voucherProductList[i])"> - + placeholder="数字文本" :step="1" @input="UpdateWeight(dataForm.voucherProductList[i])"> - @@ -198,7 +204,7 @@ - @@ -206,17 +212,17 @@ - - + @@ -276,20 +282,26 @@ + + + + + + - - + + - - @@ -297,7 +309,7 @@ - @@ -305,7 +317,7 @@ - @@ -313,17 +325,17 @@ - - + @@ -374,7 +386,7 @@ dataForm: { id: "", voucherCode: '', - voucherType: "", + voucherType: "1", preparationTime: "", associateThirdSuppliers: "", deliveryType: "", @@ -396,8 +408,9 @@ vehiclePictures: [], voucherStatus: "4", documentType: "1", - voucherproductList: [], - vouchervehicleList: [], + voucherProductList: [], + voucherVehicleList: [], + businessType: "1", }, rules: { voucherType: [{ @@ -631,11 +644,11 @@ menuId: '', jurisdictionType: '', ruleList: { - voucherproductList: { + voucherProductList: { 'productId': '商品名称不能为空', 'unit': '单位不能为空', }, - vouchervehicleList: { + voucherVehicleList: { 'vehicleNumber': '车牌号不能为空', }, }, @@ -663,7 +676,7 @@ vehiclePictures: [], voucherStatus: [], documentType: [], - voucherproductproductId: [], + voucherproductproductId: [{ "fieldName": "", "field": "subjectId", "defaultValue": "", "jnpfKey": "popupSelect", "dataType": "varchar", "id": "spNokw1", "relationField": "supplierId", "required": "0" }], voucherproductspec: [], voucherproductunit: [], voucherproductgrossWeight: [], @@ -678,7 +691,7 @@ vouchervehiclecarrier: [], }, regList: { - voucherproductList: { + voucherProductList: { productId: [], spec: [], unit: [], @@ -689,7 +702,7 @@ clearWeight: [], remark: [], }, - vouchervehicleList: { + voucherVehicleList: { vehicleId: [], driverName: [], telephone: [], @@ -800,13 +813,61 @@ } }, methods: { + //凭证识别 + poundlistUploadSuccess(val, res) { + if (res && res.data) { + this.dataForm.poundCode = res.data.deliveryNumber + this.dataForm.vehicleId = '1' + this.dataForm.supplierId = res.data.supplierId + this.dataForm.customerId = res.data.customerId + if (res.data.vehicleId) { + this.dataForm.voucherVehicleList.push(res.data) + } + let item = { + productId: '', + spec: undefined, + unit: undefined, + grossWeight: res.data.crossWeight == '' ? 0 : res.data.crossWeight, + tareWeight: res.data.tareWeight == '' ? 0 : res.data.tareWeight, + buckleWeight: undefined, + netWeight: res.data.netWeight == '' ? 0 : res.data.netWeight, + remark: undefined, + printTime: undefined, + } + item.buckleWeight = this.jnpf.floatSub(this.jnpf.floatSub(item.grossWeight, item.tareWeight), item.netWeight); + this.dataForm.voucherProductList.push(item) + } else { + this.dataForm.poundCode = ''; + this.dataForm.vehicleId = ''; + this.dataForm.supplierId = ''; + this.dataForm.customerId = ''; + this.dataForm.voucherVehicleList = []; + this.dataForm.voucherProductList = []; + } + }, + //选择商品带出信息 + productChangeData(a, b) { + this.dataForm.voucherProductList[0].spec = b.spec + if (b.orderMainUnitIds) { + var unitName = JSON.parse(b.orderMainUnitIds); + var optArray = []; + for (let i = 0; i < unitName.length; i++) { + this.dataForm.voucherProductList[0].unit = unitName[0]; + var opt = {}; + opt.fullName = unitName[i]; + opt.id = unitName[i]; + optArray.push(opt); + } + this.dataForm.voucherProductList[0].deliveryproductrelationdeliveryUnitOptions = optArray; + } + }, //子表车牌号赋值 vehicleChange(val) { - this.dataForm.vouchervehicleList = [] + this.dataForm.voucherVehicleList = [] let item = { - vehicleName: val + vehicleNumber: val } - this.dataForm.vouchervehicleList.push(item) + this.dataForm.voucherVehicleList.push(item) }, //编辑其他重量,更新净重 UpdateWeight(row) { @@ -990,7 +1051,7 @@ return timeDataValue; }, voucherproduct() { - let table = this.dataForm.voucherproductList + let table = this.dataForm.voucherProductList let summaryField = [] let summaryFieldName = {} let data = {} @@ -1015,7 +1076,7 @@ return data; }, vouchervehicle() { - let table = this.dataForm.vouchervehicleList + let table = this.dataForm.voucherVehicleList let summaryField = [] let summaryFieldName = {} let data = {} @@ -1128,7 +1189,7 @@ }, addvoucherproductList() { let value = {} - this.tableKey = 'voucherproductList'; + this.tableKey = 'voucherProductList'; this.getvoucherproductList(value) this.childIndex = -1 this.collapse() @@ -1140,7 +1201,7 @@ content: '确认删除该条信息吗?', success: function(res) { if (res.confirm) { - that.dataForm.voucherproductList.splice(index, 1); + that.dataForm.voucherProductList.splice(index, 1); that.collapse() } } @@ -1162,14 +1223,14 @@ ...item, ...value } - this.dataForm.voucherproductList.push(result) - this.childIndex = this.dataForm.voucherproductList.length - 1 + this.dataForm.voucherProductList.push(result) + this.childIndex = this.dataForm.voucherProductList.length - 1 this.isEdit = true this.isEdit = false }, addvouchervehicleList() { let value = {} - this.tableKey = 'vouchervehicleList'; + this.tableKey = 'voucherVehicleList'; this.getvouchervehicleList(value) this.childIndex = -1 this.collapse() @@ -1181,7 +1242,7 @@ content: '确认删除该条信息吗?', success: function(res) { if (res.confirm) { - that.dataForm.vouchervehicleList.splice(index, 1); + that.dataForm.voucherVehicleList.splice(index, 1); that.collapse() } } @@ -1198,8 +1259,8 @@ ...item, ...value } - this.dataForm.vouchervehicleList.push(result) - this.childIndex = this.dataForm.vouchervehicleList.length - 1 + this.dataForm.voucherVehicleList.push(result) + this.childIndex = this.dataForm.voucherVehicleList.length - 1 this.isEdit = true this.isEdit = false }, @@ -1212,10 +1273,10 @@ this.dataForm = _dataAll this.isEdit = true this.dataAll() - for (let i = 0; i < _dataAll.voucherproductList.length; i++) { + for (let i = 0; i < _dataAll.voucherProductList.length; i++) { this.childIndex = i } - for (let i = 0; i < _dataAll.vouchervehicleList.length; i++) { + for (let i = 0; i < _dataAll.voucherVehicleList.length; i++) { this.childIndex = i } this.childIndex = -1 diff --git a/jnpf-app/utils/jnpf.js b/jnpf-app/utils/jnpf.js index f7d9b6c1..bce840b9 100644 --- a/jnpf-app/utils/jnpf.js +++ b/jnpf-app/utils/jnpf.js @@ -4,6 +4,87 @@ const jnpf = { goBack() { uni.navigateBack() }, + /** + * 解决两个数相加精度丢失问题 + * @param a + * @param b + * @returns {Number} + */ + floatAdd(a, b) { + var c, d, e; + if(undefined==a||null==a||""==a||isNaN(a)){a=0;} + if(undefined==b||null==b||""==b||isNaN(b)){b=0;} + try { + c = a.toString().split(".")[1].length; + } catch (f) { + c = 0; + } + try { + d = b.toString().split(".")[1].length; + } catch (f) { + d = 0; + } + e = Math.pow(10, Math.max(c, d)); + return (this.floatMul(a, e) + this.floatMul(b, e)) / e; + }, + /** + * 解决两个数相减精度丢失问题 + * @param a + * @param b + * @returns {Number} + */ + floatSub(a, b) { + var c, d, e; + if(undefined==a||null==a||""==a||isNaN(a)){a=0;} + if(undefined==b||null==b||""==b||isNaN(b)){b=0;} + try { + c = a.toString().split(".")[1].length; + } catch (f) { + c = 0; + } + try { + d = b.toString().split(".")[1].length; + } catch (f) { + d = 0; + } + e = Math.pow(10, Math.max(c, d)); + return (this.floatMul(a, e) - this.floatMul(b, e)) / e; + }, + /** + * 解决两个数相乘精度丢失问题 + * @param a + * @param b + * @returns {Number} + */ + floatMul(a, b) { + var c = 0, + d = a.toString(), + e = b.toString(); + try { + c += d.split(".")[1].length; + } catch (f) {} + try { + c += e.split(".")[1].length; + } catch (f) {} + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); + }, + /** + * 解决两个数相除精度丢失问题 + * @param a + * @param b + * @returns + */ + floatDiv(a, b) { + var c, d, e = 0, + f = 0; + try { + e = a.toString().split(".")[1].length; + } catch (g) {} + try { + f = b.toString().split(".")[1].length; + } catch (g) {} + return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), this.floatMul(c / d, Math.pow(10, f - e)); + }, handelFormat(format) { let formatObj = { 'yyyy': 'yyyy', diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-biz/src/main/java/jnpf/service/impl/VoucherServiceImpl.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-biz/src/main/java/jnpf/service/impl/VoucherServiceImpl.java index 25ad6b3e..7a3130ef 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-biz/src/main/java/jnpf/service/impl/VoucherServiceImpl.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-biz/src/main/java/jnpf/service/impl/VoucherServiceImpl.java @@ -1030,8 +1030,8 @@ public class VoucherServiceImpl extends ServiceImpl contractLQueryWrapper=new QueryWrapper<>(); contractLQueryWrapper.lambda().eq(ContractLEntity::getContractNumber, voucherEntity.getPurchaseContractNo()); diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherEntity.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherEntity.java index 430e4a7b..0c220563 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherEntity.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherEntity.java @@ -151,9 +151,9 @@ public class VoucherEntity { @TableField("SALE_CONTRACT_NO") private String saleContractNo; @TableField("PURCHASE_AMOUNT") - private String purchaseAmount; + private BigDecimal purchaseAmount; @TableField("SALE_AMOUNT") - private String saleAmount; + private BigDecimal saleAmount; @TableField("VOUCHER_RELATION") private String voucherRelation; diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherProductEntity.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherProductEntity.java index 0461c938..3e5461c9 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherProductEntity.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/entity/VoucherProductEntity.java @@ -150,11 +150,11 @@ public class VoucherProductEntity { private String saleContractNo; /** 销售额 **/ @TableField(exist = false) - private String saleAmount; + private BigDecimal saleAmount; /** 采购合同 **/ @TableField(exist = false) private String purchaseContractNo; /** 采购额 **/ @TableField(exist = false) - private String purchaseAmount; + private BigDecimal purchaseAmount; } diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/model/voucher/VoucherForm.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/model/voucher/VoucherForm.java index 9e438d51..a60f557d 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/model/voucher/VoucherForm.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-entity/src/main/java/jnpf/model/voucher/VoucherForm.java @@ -148,8 +148,8 @@ public class VoucherForm { private String saleContractNo; /** 采购额 **/ @JsonProperty("purchaseAmount") - private String purchaseAmount; + private BigDecimal purchaseAmount; /** 销售额 **/ @JsonProperty("saleAmount") - private String saleAmount; + private BigDecimal saleAmount; }