From 807bb9a2b4d6db408ebdded1cff41f3094eac11e Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 24 三月 2026 15:00:40 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs | 40 +++++++++++++++++++++++++++++-----------
1 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 20c015e..c55dcbc 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1425,9 +1425,9 @@
decimal baseQtyPerPiece = Math.Floor(HQty / HPieceQty);
decimal remainderQty = HQty % HPieceQty;
- // 璁$畻姣忓紶鏉$爜鐨勫熀纭�閲嶉噺锛堝噣閲嶅拰姣涢噸鐩稿悓锛�
- decimal baseWeightPerPiece = Math.Floor(totalWeight / HPieceQty * 10000) / 10000; // 淇濈暀4浣嶅皬鏁�
- decimal remainderWeight = totalWeight - (baseWeightPerPiece * HPieceQty);
+ /// 閲嶉噺鍧囧垎鍩虹鍊间笌浣欐暟
+ decimal baseWeightPerPiece = totalWeight / HPieceQty;
+ decimal remainderWeight = totalWeight % HPieceQty;
// 鏌ヨ鍘熷鍗曟嵁淇℃伅
ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HInterID='" + HInterID + "'", "Sc_StationOutBillMain");
@@ -1439,18 +1439,36 @@
// 寰幆鐢熸垚鏉$爜
for (int i = 0; i < barcodeCount; i++)
{
- // 璁$畻褰撳墠鏉$爜鐨勬暟閲�
- decimal currentQty = baseQtyPerPiece;
- if (i < remainderQty) // 濡傛灉鏈変綑鏁帮紝鍓峃寮犳潯鐮佸悇鍔�1
+ // ====================== 淇鏁伴噺璁$畻 ======================
+ decimal currentQty;
+ if (barcodeCount == 1)
{
- currentQty += 1;
+ // 鍙湁1浠舵椂锛岀洿鎺ヤ娇鐢ㄦ�绘暟閲忥紝涓嶅仛鍙栨暣鎷嗗垎
+ currentQty = HQty;
+ }
+ else
+ {
+ currentQty = baseQtyPerPiece;
+ // 鏈変綑鏁板垯鍓峃鏉″悇鍔�1锛堝彧閽堝鏁存暟浣欐暟鍦烘櫙锛�
+ if (i < remainderQty)
+ {
+ currentQty += 1;
+ }
}
- // 璁$畻褰撳墠鏉$爜鐨勯噸閲忥紙鍑�閲嶅拰姣涢噸鐩稿悓锛�
- decimal currentWeight = baseWeightPerPiece;
- if (i < Math.Ceiling(remainderWeight / baseWeightPerPiece) && remainderWeight > 0)
+ // ====================== 淇閲嶉噺璁$畻 ======================
+ decimal currentWeight;
+ if (barcodeCount == 1)
{
- currentWeight += baseWeightPerPiece; // 閲嶉噺浣欐暟涔熷垎鎽婂埌鍓嶅嚑寮犳潯鐮�
+ currentWeight = totalWeight;
+ }
+ else
+ {
+ currentWeight = baseWeightPerPiece;
+ if (i < remainderWeight)
+ {
+ currentWeight += baseWeightPerPiece;
+ }
}
// 鐢熸垚鏉$爜鍙�
--
Gitblit v1.9.1