From 8d93e394cab1861b6b5bd3ec0d95fa64f84b5b3e Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期四, 04 五月 2023 23:04:38 +0800
Subject: [PATCH] 工序报表
---
WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 211 insertions(+), 14 deletions(-)
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 0a95287..11793f0 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -72,7 +72,7 @@
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
- int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+ int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 2澶嶅埗 3淇敼
string user = sArray[3].ToString();
try
@@ -185,7 +185,7 @@
long HSeOrderEntrySEQ = DetailColl[0].HSeOrderEntrySEQ == null ? 0 : DetailColl[0].HSeOrderEntrySEQ; //閿�鍞鍗曡鍙�,
string HPROJECTNO = DetailColl[0].HPROJECTNO == null ? "''" : DetailColl[0].HPROJECTNO; //椤圭洰缂栧彿,
long HPRODUCTTYPE = DetailColl[0].HPRODUCTTYPE == null ? 0 : DetailColl[0].HPRODUCTTYPE; //浜у搧绫诲瀷,
- long HCOSTRATE = DetailColl[0].HCOSTRATE == null ? 0 : DetailColl[0].HCOSTRATE; // 鏉冮噸,
+ double HCOSTRATE = DetailColl[0].HCOSTRATE == null ? 0 : DetailColl[0].HCOSTRATE; // 鏉冮噸,
long HBASEUNITID = DetailColl[0].HBASEUNITID == null ? 0 : DetailColl[0].HBASEUNITID; //鍩烘湰璁¢噺鍗曚綅,
int i = 0;
@@ -300,12 +300,14 @@
,HPlanBeginDate,HPlanEndDate
,HBeginDate,HEndDate
,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
- ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)
+ ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
+ ,HCOSTRATE,HISBACKFLUSH,HBatchNo,HBomID,HCHECKPRODUCT,HSEQ)
values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},4
- ,0,0,'','',0,0)");
+ ,0,0,'','',0,0
+ ,{oSub.HCOSTRATE},{oSub.HISBACKFLUSH},'{oSub.HBatchNo}',{oSub.HBomID},{oSub.HCHECKPRODUCT},{oSub.HSEQ})");
}
foreach (var _item in _mainList)
@@ -505,6 +507,8 @@
public json AddBillSub_NoTable(string msg3, long HInterID, int OperationType,int HEntryID)
{
ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
+
+
if (oSub.HQty <= 0 || oSub.HQty == null)
{
objJsonResult.code = "0";
@@ -523,14 +527,7 @@
return objJsonResult;
}
- if (oSub.HDeptID == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鐢熶骇杞﹂棿涓嶈兘涓虹┖";
- objJsonResult.data = null;
- return objJsonResult;
- }
+
if (oSub.HUnitID == 0)
{
@@ -556,13 +553,15 @@
,HBeginDate,HEndDate
,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
,HBomID,HEntryCusID,HSTOCKINORGID
- ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)
+ ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney
+ ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark)
values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
,{oSub.HBomID} ,{oSub.HCusID} ,{oSub.HSTOCKINORGID}
- ,0,0,'','',0,0)");
+ ,0,0,'','',0,0
+ ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}')");
objJsonResult.code = "1";
@@ -874,6 +873,204 @@
}
#endregion
+ #region 鐢熶骇浠诲姟鍗� 澶氳鎵归噺涓嬫帹
+ [Route("Sc_ICMOBill/Sc_ICMOReportBill_dh")]
+ [HttpGet]
+ public object Sc_ICMOReportBill_dh(string HInterID, string user, int OrganizationID)
+ {
+ try
+ {
+ //鑾峰彇鍗曟嵁ID
+ string[] HBillNo = HInterID.Split(',');
+ string Error = "";
+ int i = 0;
+ foreach (var item in HBillNo)
+ {
+ string err = "";
+ DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
+ Model.ClsSc_ProcessExchangeBillMain lsmain = new Model.ClsSc_ProcessExchangeBillMain();
+ List<Model.ClsSc_ProcessExchangeBillSub> ls = new List<Model.ClsSc_ProcessExchangeBillSub>();
+ string HBillNOs = "";
+ string hmainid = item.Split('|')[0];
+ string HEntryID = item.Split('|')[1];
+
+ ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 and hmainid=" + hmainid + " and HEntryID=" + HEntryID + " order by 鍗曟嵁鍙� desc", "h_v_IF_ICMOBillList");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ err = "鏃犳暟鎹�! \n";
+ }
+ else
+ {
+ string HNumber = ds.Tables[0].Rows[0]["浜у搧浠g爜"].ToString();
+ HBillNOs = ds.Tables[0].Rows[0]["鍗曟嵁鍙�"].ToString();
+
+ if (ds.Tables[0].Rows[0]["瀹℃牳浜�"].ToString() == "")
+ {
+ err = "鎵�閫夌敓浜ц鍗曚负鏈鏍哥姸鎬侊紝涓嶅厑璁镐笅鎺ㄧ敓鎴愬伐搴忔祦杞崱锛乗n";
+ }
+
+ if (ds.Tables[0].Rows[0]["鍏抽棴浜�"].ToString() != "")
+ {
+ err = "鎵�閫夌敓浜ц鍗曚负宸插叧闂姸鎬侊紝涓嶅厑璁镐笅鎺ㄧ敓鎴愬伐搴忔祦杞崱锛乗n";
+ }
+
+ if (ds.Tables[0].Rows[0]["浣滃簾浜�"].ToString() != "")
+ {
+ err = "鎵�閫夌敓浜ц鍗曚负宸蹭綔搴熺姸鎬侊紝涓嶅厑璁镐笅鎺ㄧ敓鎴愬伐搴忔祦杞崱锛乗n";
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_S_Sc_ICMOBillList where hmainid=" + hmainid + " and HEntryID=" + HEntryID + " and HSTOCKINORGID='" + OrganizationID + "'", "h_v_S_Sc_ICMOBillList");
+
+ if (double.Parse(ds.Tables[0].Rows[0]["娴佽浆鍗℃暟閲�"].ToString()) == 0)
+ {
+ err = "鎵�閫夌敓浜ц鍗曞凡鍏ㄩ儴涓嬫帹鐢熸垚宸ュ簭娴佽浆鍗★紝鍓╀綑鍙笅鎺ㄦ暟閲忎负0锛屼笉鍏佽涓嬫帹鐢熸垚宸ュ簭娴佽浆鍗★紒\n";
+ }
+ lsmain.HMaker = user; //鍒跺崟浜�
+ lsmain.HBillType = "3772";
+ lsmain.HBillSubType = "3772";
+ lsmain.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
+ lsmain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ lsmain.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ lsmain.HICMOInterID = long.Parse(ds.Tables[0].Rows[0]["hmainid"].ToString());
+ lsmain.HICMOBillNo = ds.Tables[0].Rows[0]["鐢熶骇璁㈠崟鍙�"].ToString();
+ lsmain.HICMOEntryID = long.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString());
+ lsmain.HOrderProcNO = ds.Tables[0].Rows[0]["璁㈠崟璺熻釜鍙�"].ToString();
+ lsmain.HMaterID = long.Parse(ds.Tables[0].Rows[0]["hmaterid"].ToString());
+ lsmain.HMaterID2 = long.Parse(ds.Tables[0].Rows[0]["hmaterid"].ToString());
+ lsmain.HMaterNumber = ds.Tables[0].Rows[0]["鐗╂枡浠g爜"].ToString();
+ lsmain.HMaterModel = ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
+ lsmain.HBatchNo = ds.Tables[0].Rows[0]["鎵瑰彿"].ToString();
+ lsmain.HSplitNo =1;//閮芥槸1
+ lsmain.HUnitID = long.Parse(ds.Tables[0].Rows[0]["hunitid"].ToString());
+ lsmain.HUnitNumber = ds.Tables[0].Rows[0]["璁¢噺鍗曚綅浠g爜"].ToString();
+ lsmain.HPlanQty = double.Parse(ds.Tables[0].Rows[0]["璁″垝鐢熶骇鏁伴噺"].ToString());
+ lsmain.HQty = double.Parse(ds.Tables[0].Rows[0]["娴佽浆鍗℃暟閲�"].ToString());
+ lsmain.HPlanBeginDate = DateTime.Parse(ds.Tables[0].Rows[0]["璁″垝寮�宸ユ棩鏈�"].ToString());
+ lsmain.HPlanEndDate = DateTime.Parse(ds.Tables[0].Rows[0]["璁″垝瀹屽伐鏃ユ湡"].ToString());
+ lsmain.HWorkShopID = long.Parse(ds.Tables[0].Rows[0]["hdeptid"].ToString());
+ lsmain.HProdMaterCode = ds.Tables[0].Rows[0]["浜у搧CODE"].ToString();
+ lsmain.HSeOrderBillNo = ds.Tables[0].Rows[0]["閿�鍞鍗曞彿"].ToString();
+ lsmain.HCusShortName = ds.Tables[0].Rows[0]["瀹㈡埛绠�绉�"].ToString();
+ lsmain.HCusNeedMaterial = ds.Tables[0].Rows[0]["瀹㈡埛瑕佹眰鏉愭枡鎴愬垎"].ToString();
+ lsmain.HPlanSendGoodsDate = ds.Tables[0].Rows[0]["棰勮鍑鸿揣鏃ユ湡"].ToString()==""?DateTime.Now.ToString(): ds.Tables[0].Rows[0]["棰勮鍑鸿揣鏃ユ湡"].ToString();
+ lsmain.HSellDate = DateTime.Now.ToString();
+ lsmain.HPRDORGID = OrganizationID;
+ lsmain.HProdMaterName = ds.Tables[0].Rows[0]["浜у搧鍚嶇О"].ToString();
+ lsmain.HCusName = ds.Tables[0].Rows[0]["瀹㈡埛鍚嶇О"].ToString();
+ lsmain.HWorkRemark = ds.Tables[0].Rows[0]["鐢熶骇澶囨敞"].ToString();
+ lsmain.HImportNote = ds.Tables[0].Rows[0]["閲嶈鎻愮ず"].ToString();
+ lsmain.HPicNumVer = ds.Tables[0].Rows[0]["鍥惧彿鐗堟湰"].ToString();
+ lsmain.HPicNumAssemble = ds.Tables[0].Rows[0]["鎬昏鍥惧彿"].ToString();
+ lsmain.HMaterTexture = ds.Tables[0].Rows[0]["鏉愯川"].ToString();
+ lsmain.HProductNum = ds.Tables[0].Rows[0]["鎴愬搧缂栧彿"].ToString();
+ lsmain.HVerNum = ds.Tables[0].Rows[0]["鐗堟湰"].ToString();
+ //lsmain.HCusNumber = ds.Tables[0].Rows[0]["婧愬崟瀹㈡埛缂栫爜"].ToString();
+ //lsmain.HPickLabel = ds.Tables[0].Rows[0]["鍖呰鏍囪瘑"].ToString();
+ //lsmain.HPickLabelNumber = ds.Tables[0].Rows[0]["鍖呰鏍囪瘑缂栫爜"].ToString();
+ //lsmain.HXTNumber = ds.Tables[0].Rows[0]["鑺綋鐗╂枡浠g爜"].ToString();
+ //lsmain.HXTModel = ds.Tables[0].Rows[0]["鑺綋瑙勬牸鍨嬪彿"].ToString();
+ lsmain.HWidth = double.Parse(ds.Tables[0].Rows[0]["HWidth"].ToString());
+ lsmain.HWeight = double.Parse(ds.Tables[0].Rows[0]["HWeight"].ToString());
+ lsmain.HAuxUnit = int.Parse(ds.Tables[0].Rows[0]["HAuxUnit"].ToString());
+ lsmain.HRemark2 = ds.Tables[0].Rows[0]["澶囨敞"].ToString();
+ lsmain.HEmpID = long.Parse(ds.Tables[0].Rows[0]["HEmpID"].ToString());
+ lsmain.HCusID = long.Parse(ds.Tables[0].Rows[0]["HCusID"].ToString());
+ lsmain.HColorRemark = ds.Tables[0].Rows[0]["鏌撹壊瑕佹眰"].ToString();
+ lsmain.HBLFlag = ds.Tables[0].Rows[0]["HBLFlag"].ToString() == "0" ? false : true;
+ lsmain.HAuxQty = 0;
+ lsmain.HAuxUnit = 0;
+
+
+ ds = oCN.RunProcReturn("select top 1000 * from h_v_Gy_RoutingBillList a left join Gy_Process p on a.hprocid = p.HItemID where 鐗╂枡浠g爜='" + HNumber + "' and 榛樿宸ヨ壓=1", "h_v_Gy_RoutingBillList");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ err = "鎵�閫夌敓浜ц鍗曞搴旂墿鏂欐湭璁剧疆瀵瑰簲鐨勫伐鑹鸿矾绾匡紝涓嶅厑璁镐笅鎺ㄧ敓鎴愬伐搴忔祦杞崱锛乗n";
+ }
+ else
+ {
+ lsmain.HRoutingBillID = ds.Tables[0].Rows[0]["hmainid"].ToString();
+ oBill.omodel = lsmain;
+
+ int j = 0;
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ if (row["HTProcessFlag"].ToString() == "False")
+ {
+ ClsSc_ProcessExchangeBillSub sub = new ClsSc_ProcessExchangeBillSub();
+ sub.HEntryID = j + 1;
+ sub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ sub.HProcNo = long.Parse(row["宸ュ簭鍙�"].ToString());
+ sub.HProcID = long.Parse(row["HProcID"].ToString());
+ sub.HProcNumber = row["宸ュ簭浠g爜"].ToString();
+ sub.HWorkRemark = row["琛ㄤ綋澶囨敞"].ToString();
+ sub.HCenterID = long.Parse(row["HCenterID"].ToString());
+ sub.HSupID = long.Parse(row["HSupID"].ToString());
+ sub.HSupFlag = row["濮斿鏍囪"].ToString() == "False" ? false : true;
+ sub.HQty = lsmain.HQty;
+ sub.HTechnologyParameter = row["宸ヨ壓鍙傛暟"].ToString();
+ sub.HPicNum = row["鍥剧焊缂栧彿"].ToString();
+ sub.HProcCheckNote = row["鏈伐搴忕‘璁よ褰�"].ToString();
+ sub.HDeptID = 0;
+ sub.HDeptNumber = "";
+ sub.HOutPrice = 0;
+ sub.HRemark = "";
+ sub.HRelationQty_In =0;
+ sub.HRelationQty_Out = 0;
+ sub.HRelationQty_WWOrder = 0;
+ sub.HRelationQty_Bad = 0;
+ sub.HOverRate = 0;
+ sub.HMaxQty = 0;
+ sub.HPassRate = 0;
+ sub.HSumPassRate = 0;
+ j++;
+ oBill.DetailColl.Add(sub);
+ }
+ }
+
+ }
+ }
+
+ bool bResult = false;
+ if (err != "")
+ {
+ Error += "鐢熶骇璁㈠崟鍗曟嵁鍙�:" + HBillNOs + "\n" + err;
+ }
+ else
+ {
+ oBill.omodel.HBillNo = DBUtility.ClsPub.CreateBillCode("3772", ref DBUtility.ClsPub.sExeReturnInfo,true);
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ oBill.DetailColl.Clear();
+
+ if (!bResult)
+ {
+ Error += "淇濆瓨澶辫触,鐢熶骇璁㈠崟鍗曟嵁鍙�:" + HBillNOs + "\n" + err;
+ }
+ else
+ {
+ i++;
+ }
+ }
+ }
+ Error = "鎴愬姛:" + i + "琛� !!! " + Error;
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = Error;
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "涓嬫帹澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鐢熶骇浠诲姟鍗曡幏鍙栬溅闂�
[Route("Sc_ICMOBill/GetHDeptList")]
[HttpGet]
--
Gitblit v1.9.1