From 14ae0e21c8660dbb3ac20a5b0d9db9b6dde3cfb9 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 25 三月 2026 17:07:00 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs | 301 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 286 insertions(+), 15 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index ea45580..dbe680e 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;
+ }
}
// 鐢熸垚鏉$爜鍙�
@@ -3774,15 +3792,15 @@
#region 宸ュ簭姹囨姤鍗曡幏鍙栧搴旀墍浠ュ簭鍒�
[Route("Cj_StationOutBill/getAllHSEQ")]
[HttpGet]
- public object getAllHSEQ(string HInterID)
+ public object getAllHSEQ(int HInterID)
{
try
{
//寰楀埌淇℃伅锛堝澶栨爣璁颁负0鏃讹紝娴佽浆鏍囪涓�1鏃�
- ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillSEQ where HInterID= " + HInterID, "Sc_ProcessExchangeBillSEQ");
+ DataSet DS = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillSEQ where HInterID= " + HInterID, "Sc_ProcessExchangeBillSEQ");
//鍐欏叆淇℃伅
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+ if (DS == null || DS.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -3793,7 +3811,7 @@
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "[0000-1-037]Sucess锛�";
- objJsonResult.data = ds.Tables[0];
+ objJsonResult.data = DS.Tables[0];
return objJsonResult;
}
catch (Exception e)
@@ -4861,6 +4879,259 @@
#endregion
+ #region 宸ュ簭姹囨姤锛屽鏍稿墠淇敼
+ //瀹℃牳锛屽甫缂栬緫鍔熻兘
+ [Route("Cj_StationOutBill/setOtherProperty")]
+ [HttpPost]
+ public object setOtherProperty([FromBody] JObject oMain)
+ {
+ try
+ {
+ var _value = oMain["oMain"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = "[" + sArray[0].ToString() + "]";
+ string user = sArray[1].ToString();
+ ////鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Check", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ List<StationBill> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2);
+ long HInterID = list1[0].HInterID;
+ double HQty = list1[0].HQty;
+ double HBadCount = list1[0].HBadCount;
+ double HWasterQty = list1[0].HWasterQty;
+ long HSourceID = list1[0].HSourceID;
+ string HSourceName = list1[0].HSourceName;
+ long HCenterID = list1[0].HCenterID;
+ long HGroupID = list1[0].HGroupID;
+ long HEmpID = list1[0].HEmpID;
+
+ oCN.BeginTran();
+
+ DataSet ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HInterID=" + HInterID, "Sc_StationOutBillMain");
+
+ if (ds.Tables.Count > 0 && ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+ {
+ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+ //瀹℃牳鍓嶆帶鍒�================================================================================
+ string sql = "exec h_p_Sc_StationOutBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //================================================================================
+
+ if (HQty > 0)
+ {
+
+ oCN.RunProc($"update Sc_StationOutBillMain set HBillStatus = 2, HQty={HQty},HBadCount='{HBadCount}',HWasterQty='{HWasterQty}',HSourceID='{HSourceID}',HCenterID='{HCenterID}',HGroupID={HGroupID},HEmpID={HEmpID},HChecker='{user}',HCheckDate=getdate() where HInterID={HInterID} ");
+
+ }
+ string sReturn = "";
+ //鑾峰彇绯荤粺鍙傛暟
+ oSystemParameter.ShowBill(ref sReturn);
+ //鍒ゆ柇瀹㈡埛涓哄ぉ鎿� 鍚屾閲戣澏宸ュ簭姹囨姤鍗�
+ if (oSystemParameter.omodel.WMS_CampanyName == "澶╂搸")
+ {
+ //鍚屾鍓嶆帶鍒�=========================================
+ ds = oCN.RunProcReturn("Exec h_p_Sc_StationOutBill_BeforeSyncCtrl " + HInterID.ToString() + ", '" + HBillNo + "','" + user + "'", " h_p_Sc_StationOutBill_BeforeSyncCtrl ");
+ if (ds == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-2-012]淇濆瓨鍓嶅垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[0000-1-051]鍚屾澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //=========================================================
+ if (oWebs.set_SaveStationOutBill_CLD(HInterID, HBillNo, user, ref DBUtility.ClsPub.sErrInfo))
+ {
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳淇敼鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+
+
+ }
+ else
+ {
+ oCN.Commit();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦ㄦ垨宸插鏍革紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ュ簭姹囨姤鑷姩鐢熸垚杩涚珯鎺ユ敹鍗�
+ //宸ュ簭姹囨姤寮�宸ユ寜閽嚜鍔ㄥ紑宸�
+ [Route("Cj_StationOutBill/startTranslating")]
+ [HttpGet]
+ public object startTranslating(int HProcExchInterID,int HProcExchEntryID,int HOrgID,int HProcNo,string user)
+ {
+ try
+ {
+ oCN.BeginTran();
+ //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "[3790-2-003]寮�宸ュ崟鏃犵紪杈戞潈闄�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string HBillType = "3790";
+ string HBillNo = "";
+ Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
+ HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ int HBillStatus = 0;
+ string HMaker = user;
+ int HYear = DateTime.Now.Year;
+ double HPeriod = DateTime.Now.Month;
+ string HRemark = "鍑烘垬姹囨姤鍗曡嚜鍔ㄥ紑宸�";//澶囨敞
+ long HICMOInterID = 0;//浠诲姟鍗旾D
+ string HICMOBillNo = "";//浠诲姟鍗�
+ long HProcPlanInterID = 0;
+ long HProcPlanEntryID = 0;
+ string HProcPlanBillNo = "";
+ long HMaterID = 1;//浜у搧ID
+ long HProcID = 1;//褰撳墠宸ュ簭
+ double HICMOQty = 0;//浠诲姟鍗曟暟閲�
+ double HPlanQty = 0;//娴佽浆鍗℃暟閲�
+ long HSourceID = 0;//鐢熶骇璧勬簮ID
+ long HGroupID = 0;//鐝粍ID
+ long HDeptID = 0;
+ long HEmpID = 0;//鎺ユ敹浜篒D
+ string HBarCode = "";//鏉″舰鐮�
+ string HAddr = "";
+ string HBarCodeMaker = "";
+ long HSupID = 0;
+ double HQty = 0;//鎺ユ敹鏁伴噺
+ double HPrice = 0;
+ double HMoney = 0;
+ double HPieceQty = 0;//鎺ユ敹浠舵暟
+ string HSourceName = "";//鐢熶骇璧勬簮鍚嶇О
+ long HCenterID = 0;//宸ヤ綔涓績ID
+ string HOrderProcNO = "";//璁㈠崟璺熻釜鍙�
+ long HPRDOrgID = HOrgID;//缁勭粐ID
+ double HmaterOutqty = 0;//鐧藉澂鍙戝竷
+ string HProcExchBillNo = "";//涓婃枡闃查敊鍗曞崟鎹彿
+ int HMainInterID = 0;//鐧藉澂鍙戝竷
+ oCN.RunProc("Insert Into Sc_StationInBillMain " +
+ "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
+ ",HYear,HPeriod,HRemark" +
+ ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
+ ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" +
+ ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
+ ",HSupID,HQty,HPrice,HMoney,HPieceQty,HSourceName,HCenterID" +
+ ",HProcNo,HOrderProcNO,HMainInterID,HPRDOrgID" +
+ ",HmaterOutqty" +
+ ") " +
+ " values('" + HBillType + "','" + (HBillType) + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
+ "," + HYear + "," + HPeriod + ",'" + HRemark + "'" +
+ "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID +
+ ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID +
+ "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" +
+ "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + ",'" + HSourceName + "'," + HCenterID +
+ ",'" + HProcNo + "','" + HOrderProcNO + "','" + HMainInterID + "'," + HPRDOrgID +
+ "," + HmaterOutqty + ") ");
+
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+
+
+
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "寮�宸ュけ璐ワ紒" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1