From 61afd41b3b2e3511a9c597ddd8e171c96b0253a7 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期四, 28 七月 2022 10:05:21 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs | 136 +++++++++++++++++++++++++++++--------------- 1 files changed, 89 insertions(+), 47 deletions(-) diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" index 72ad2b7..c816dcc 100644 --- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" +++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" @@ -211,7 +211,7 @@ ")", ref DBUtility.ClsPub.sExeReturnInfo); //淇敼涓婄骇涓洪潪鏈骇浠g爜 oCn.RunProc("Update Gy_StockCheckItem set HEndflag=0 where HItemID=" + oBill.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); - + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; @@ -290,7 +290,7 @@ } #endregion - + #region 鐩樼偣鍒嗘瀽鍒楄〃 [Route("Gy_StockCheckItemBill/Get_InventoryAnalysisList")] @@ -304,9 +304,9 @@ { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); //鍒ゆ柇鏄惁閫夋嫨鐩樼偣鏂规锛屾槸=>锛堢敤鐩樼偣鏂规瀛愯〃鍋氬姣旓級锛屽惁=>锛堢敤鍣ㄥ叿妗f鍋氬姣旓級 - if (sID==null|| sID == "") + if (sID == null || sID == "") { - if (sWhere=="pk") + if (sWhere == "pk") { sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK"); } @@ -319,7 +319,7 @@ { if (sWhere == "pk") { - sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK2 WHERE HInterID="+ sID); + sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisPK '{sID}'"); } else { @@ -449,6 +449,10 @@ string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 string user = sArray[1].ToString();//user string userID = sArray[2].ToString();//userID + string sName = sArray[3].ToString();//鐩樼偣鏂规 + //鏌ヨ鐩樼偣鏂规鍒涘缓鏃ユ湡 + DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem"); + string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString(); //杞寲鏍煎紡 ListModels oListModels = new ListModels(); @@ -461,7 +465,6 @@ { var HBarCode = item.HBarCode; var HItemID = item.HItemID; - string HDate = item.HMakeDate; string HBillNo = ""; Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈� DataSet ds1 = new DataSet(); @@ -478,9 +481,9 @@ ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + ") " + - " values('3814','3814'," + HInterID + ",'" + HBillNo + "','" + HDate+"'"+ - ", '" + user + "',getdate()" + - ", " + dr["HSupID"].ToString() + ", 1," + dr["HNowSupID"].ToString() + ",0,0,0,0" + + " values('3814','3814'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + + ", '" + user + "','" + HDate+ + "', " + dr["HSupID"].ToString() + ", 1," + dr["HNowSupID"].ToString() + ",0,0,0,0" + ", 0," + dr["HDeptID"].ToString() + ",' ',0" + ") "; string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, @@ -498,7 +501,7 @@ oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID); oCn.Commit(); } - + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; @@ -533,6 +536,10 @@ string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 string user = sArray[1].ToString();//user string userID = sArray[2].ToString();//userID + string sName = sArray[3].ToString();//鐩樼偣鏂规 + //鏌ヨ鐩樼偣鏂规鍒涘缓鏃ユ湡 + DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem"); + string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString(); //杞寲鏍煎紡 ListModels oListModels = new ListModels(); @@ -546,7 +553,6 @@ var HBarCode = item.HBarCode; var HItemID = item.HItemID; string HBillNo = ""; - string HDate = item.HMakeDate; Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈� DataSet ds1 = new DataSet(); ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain"); @@ -562,11 +568,11 @@ ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + ") " + " values('3827','3827'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + - ", '" + user + "',getdate()" + - ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + ",isnull('" + dr["HNowSupID"].ToString() + "',0),0,0,0,0" + + ", '" + user + "','" +HDate+ + "', " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + ",isnull('" + dr["HNowSupID"].ToString() + "',0),0,0,0,0" + ", 0," + dr["HDeptID"].ToString() + ",'',0" + ") "; - + string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID, HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID, @@ -574,7 +580,7 @@ "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," + "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0" + ",0,0,0," + userID + ",0,100005,'')"); - + //涓昏〃 oCn.BeginTran(); oCn.RunProc(sql); @@ -582,7 +588,7 @@ oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID); oCn.Commit(); } - + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; @@ -617,6 +623,11 @@ string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 string user = sArray[1].ToString();//user string userID = sArray[2].ToString();//userID + string sName = sArray[3].ToString();//鐩樼偣鏂规 + //鏌ヨ鐩樼偣鏂规鍒涘缓鏃ユ湡 + DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem"); + string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString(); + //杞寲鏍煎紡 ListModels oListModels = new ListModels(); @@ -629,34 +640,58 @@ var HBarCode = item.HBarCode; var HItemID = item.HItemID; string HBillNo = ""; - string HDate = item.HMakeDate; + string sql, sql1; Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈� + HInterID = DBUtility.ClsPub.CreateBillID("3828", ref DBUtility.ClsPub.sExeReturnInfo); + HBillNo = DBUtility.ClsPub.CreateBillCode("3828", ref DBUtility.ClsPub.sExeReturnInfo, true); DataSet ds1 = new DataSet(); ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain"); - ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp"); DataRow dr = ds.Tables[0].Rows[0]; - DataRow dr1 = ds1.Tables[0].Rows[0]; - HInterID = DBUtility.ClsPub.CreateBillID("3832", ref DBUtility.ClsPub.sExeReturnInfo); - HBillNo = DBUtility.ClsPub.CreateBillCode("3832", ref DBUtility.ClsPub.sExeReturnInfo, true); - - string sql = "Insert Into Sc_MouldStockBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + - ",HMaker,HMakeDate" + - ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + - ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + - ") " + - " values('3832','3832'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + - ", '" + user + "',getdate()" + - ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + - ", 0," + dr["HDeptID"].ToString() + ",' ',0" + - ") "; - string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, + if (HItemID == 0) + { + sql = "Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HMaker,HMakeDate,HRemark" + + ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('3828','3828'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + + ", '" + user + "','"+ HDate + "','" + sName + "'" + + ",0,0," + dr["HNowSupID"].ToString() + ",0,0,0,0" + + ", 0," + dr["HDeptID"].ToString() + ",' ',0" + + ") "; + sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID, HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID, - HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'',0,0,'',''," + - "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," + - "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0" - + ",0,0,0," + userID + ",0,100005,'')"); + HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'" + sName.ToString() + "',0,0,'',''," + + "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + ",0,0," + + "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + ",0,0,0,0" + + ",0,0,0," + userID + ",0,100005,'')"); + } + else + { + ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp"); + DataRow dr1 = ds1.Tables[0].Rows[0]; + sql = "Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HMaker,HMakeDate,HRemark" + + ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('3832','3832'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + + ", '" + user + "',getdate()" + ",'" + sName + "'" + + ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + + ", 0," + dr["HDeptID"].ToString() + ",' ',0" + + ") "; + sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, + HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,HMaterID,HPropertyID,HSecUnitRate,HSecUnitID,HUnitID, + HBatchNo,HQtyMust,HQty,HPrice,HMoney,HDesignLife,HLeaveLife,HUseLife,HWHID,HSCWHID,HSPID,HSCSPID,HSPGroupID,HCorrespondentTypeID,HCorrespondentID, + HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID) values(" + HInterID + ",1,'',getdate(),0,'" + sName.ToString() + "',0,0,'',''," + + "0,0," + dr["HInterID"].ToString() + ",0," + dr["HSecUnitRate"].ToString() + ",0," + dr["HUnitID"].ToString() + ",0," + dr["HProdQty"].ToString() + "," + dr1["HQty"].ToString() + ",0," + + "0," + dr["HDesignLife"].ToString() + "," + dr["HLeaveLife"].ToString() + "," + dr["HUseLife"].ToString() + "," + dr1["HCorrespondentID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0" + + ",0,0,0," + userID + ",0,100005,'')"); + } + //涓昏〃 oCn.BeginTran(); @@ -699,6 +734,10 @@ string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 string user = sArray[1].ToString();//user string userID = sArray[2].ToString();//userID + string sName = sArray[3].ToString();//鐩樼偣鏂规 + //鏌ヨ鐩樼偣鏂规鍒涘缓鏃ユ湡 + DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem"); + string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString(); //杞寲鏍煎紡 ListModels oListModels = new ListModels(); @@ -711,7 +750,6 @@ var HBarCode = item.HBarCode; var HItemID = item.HItemID; string HBillNo = ""; - string HDate = item.HMakeDate; Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈� DataSet ds1 = new DataSet(); ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain"); @@ -728,8 +766,8 @@ ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + ") " + " values('3802','3802'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + - ", '" + user + "',getdate()" + - ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + + ", '" + user + "','" +HDate+ + "', " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + ", 0," + dr["HDeptID"].ToString() + ",' ',0" + ") "; string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, @@ -747,7 +785,7 @@ oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID); oCn.Commit(); } - + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; @@ -774,12 +812,17 @@ public object MakeProdBack([FromBody] JObject msg) { try - { var _value = msg["msg"].ToString(); + { + var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString();//琛ㄦ牸鏁版嵁 string user = sArray[1].ToString();//user string userID = sArray[2].ToString();//userID + string sName = sArray[3].ToString();//鐩樼偣鏂规 + //鏌ヨ鐩樼偣鏂规鍒涘缓鏃ユ湡 + DataSet dd = oCn.RunProcReturn("select * from Gy_StockCheckItem where HName=" + sName, "Gy_StockCheckItem"); + string HDate = dd.Tables[0].Rows[0]["HMakeTime"].ToString(); //杞寲鏍煎紡 ListModels oListModels = new ListModels(); @@ -792,7 +835,6 @@ var HBarCode = item.HBarCode; var HItemID = item.HItemID; string HBillNo = ""; - string HDate = item.HMakeDate; Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈� DataSet ds1 = new DataSet(); ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain"); @@ -809,8 +851,8 @@ ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" + ") " + " values('3803','3803'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + - ", '" + user + "',getdate()" + - ", " + dr["HNowSupID"].ToString() + "," + dr["HNowSupTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + + ", '" + user + "','" +HDate+ + "', " + dr["HNowSupID"].ToString() + "," + dr["HNowSupTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" + ", 0," + dr["HDeptID"].ToString() + ",' ',0" + ") "; string sql1 = string.Format(@"Insert Into Sc_MouldStockBillSub (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID, @@ -828,7 +870,7 @@ oCn.RunProc("update Sc_MouldStockBillMain_Temp set HCheckStatus=1 where HitemID=" + HItemID); oCn.Commit(); } - + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; -- Gitblit v1.9.1