From 57f8663c91050c0ef837d656fb8b801b07eab357 Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期五, 04 十月 2024 18:52:09 +0800 Subject: [PATCH] 密码修改页面添加修改金蝶云账号 --- WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 465 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 438 insertions(+), 27 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 8fdcc66..edab874 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" @@ -9,6 +9,7 @@ using System.Data; using System.Data.SqlClient; using System.Web.Http; +using System.Windows.Forms; using WebAPI.Models; namespace WebAPI.Controllers @@ -110,6 +111,26 @@ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒�========================================= + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_BeforeSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_BeforeSaveCtrl_New"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= //涓昏〃 oCN.RunProc(@"Insert Into Sc_ICMOBillMain (HBillType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID @@ -244,13 +265,34 @@ ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney ,HINSTOCKTYPE,HCHECKPRODUCT,HQAIP,HISBACKFLUSH,HREQSRC,HSTOCKINQUASELAUXQTY,HSeOrderEntrySEQ,HPROJECTNO,HPRODUCTTYPE,HCOSTRATE,HBASEUNITID - ,HSTOCKINORGID) + ,HSTOCKINORGID,HOrderLevID ) values({HInterID},{i},{(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},{oSub.HSTATUS} - ,0,0,'','',0,0,{HINSTOCKTYPE},{HCHECKPRODUCT},{HQAIP},{HISBACKFLUSH},{HREQSRC},{HSTOCKINQUASELAUXQTY},{HSeOrderEntrySEQ},{HPROJECTNO},{HPRODUCTTYPE},{HCOSTRATE},{HBASEUNITID},{oSub.HSTOCKINORGID})"); + ,0,0,'','',0,0,{HINSTOCKTYPE},{HCHECKPRODUCT},{HQAIP},{HISBACKFLUSH},{HREQSRC},{HSTOCKINQUASELAUXQTY},{HSeOrderEntrySEQ},{HPROJECTNO},{HPRODUCTTYPE},{HCOSTRATE},{HBASEUNITID},{oSub.HSTOCKINORGID},{oSub.HOrderLevID})"); } + + //淇濆瓨鍚庢帶鍒�========================================= + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_AfterSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_AfterSaveCtrl_New"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= objJsonResult.code = "1"; objJsonResult.count = 1; @@ -266,7 +308,7 @@ { try { - //LogService.Write(sMainSub.ToString()); + LogService.Write("鐢熶骇璁㈠崟"+sMainSub.ToString()); var model = sMainSub["model"].ToString(); var entry = sMainSub["model"]["HENTRY"].ToString(); var _model = sMainSub["model"]["HPPBOMMAINENTRY"].ToString(); @@ -282,18 +324,30 @@ oCN.RunProc(sql); sql = $"delete Sc_ICMOBillSub where HinterID = {mainList[0].HInterID}"; oCN.RunProc(sql); + + LogService.Write("鐢熶骇璁㈠崟" + @"Insert Into Sc_ICMOBillMain + (HBillType,HInterID,HBillNo,HDate,HPRDORGID + ,HYear,HPeriod,HRemark,HMaker,HMakeDate,HChecker,HCheckDate + ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID + ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HBillStatus + ,HOWNERID,HOWNERTYPEID,HComboXSLX) + values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID + + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate(),'" + mainList[0].HMaker + "',getdate()" + + ",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID + + "," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','',2" + + "," + mainList[0].HOWNERID + ",'" + mainList[0].HOWNERTYPEID + "','" + mainList[0].HComboXSLX + "') "); //涓昏〃 oCN.RunProc(@"Insert Into Sc_ICMOBillMain (HBillType,HInterID,HBillNo,HDate,HPRDORGID - ,HYear,HPeriod,HRemark,HMaker,HMakeDate + ,HYear,HPeriod,HRemark,HMaker,HMakeDate,HChecker,HCheckDate ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate,HBillStatus - ,HOWNERID,HOWNERTYPEID) + ,HOWNERID,HOWNERTYPEID,HComboXSLX) values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID + - "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate()" + + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate(),'" + mainList[0].HMaker + "',getdate()" + ",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID + "," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','',2" + - ","+ mainList[0].HOWNERID + ",'"+ mainList[0].HOWNERTYPEID + "') "); + ","+ mainList[0].HOWNERID + ",'"+ mainList[0].HOWNERTYPEID + "','" + mainList[0].HComboXSLX + "') "); //淇濆瓨涓昏〃 foreach (var oSub in subList) { @@ -307,7 +361,7 @@ 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 + ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},'{oSub.HSTATUS}' ,0,0,'','',0,0 ,{oSub.HCOSTRATE},{oSub.HISBACKFLUSH},'{oSub.HBatchNo}',{oSub.HBomID},{oSub.HCHECKPRODUCT},{oSub.HSEQ},{oSub.HSTOCKINORGID})"); } @@ -412,6 +466,7 @@ int OperationType = int.Parse(sArray[1].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼 string user = sArray[2].ToString(); int HEntryID = int.Parse(sArray[3].ToString()); + string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О try { @@ -430,6 +485,7 @@ long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + string HMainSourceBillSubType = mainList[0].HMainSourceBillSubType; long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐 DateTime HDate = mainList[0].HDate;//鏃ユ湡 string HRemark = mainList[0].HRemark;//澶囨敞 @@ -443,24 +499,52 @@ //double? HPlanQty = mainList[0].HPlanQty == null ? 0 : mainList[0].HPlanQty;//璁″垝鏁伴噺 string HMaker = user;//鍒跺崟浜� string HIsStockQty = mainList[0].HIsStockQty; + string HIsStockQty_SeOrderBill = mainList[0].HIsStockQty_SeOrderBill; string HRemark3 = mainList[0].HRemark3; + + //淇濆瓨鍓嶆帶鍒�========================================= + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_BeforeSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_BeforeSaveCtrl_New"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_ICMOBillList"); - if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板 + if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板 { //涓昏〃 oCN.RunProc(@"Insert Into Sc_ICMOBillMain - (HBillType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID + (HBillType,HMainSourceBillSubType,HBillStatus,HInterID,HBillNo,HDate,HPRDORGID ,HYear,HPeriod,HRemark,HMaker,HMakeDate ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate - ,HIsStockQty,HRemark3) - values('3710',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID + + ,HIsStockQty,HIsStockQty_SeOrderBill,HRemark3) + values('3710','" + (HMainSourceBillSubType==null?"":HMainSourceBillSubType) + "',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" + ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID + "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" + - ",'"+ HIsStockQty + "','"+ HRemark3 + "') "); + ",'"+ HIsStockQty + "','" + HIsStockQty_SeOrderBill + "','"+ HRemark3 + "') "); + + + + LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo); + oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo); + } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) { @@ -475,15 +559,56 @@ //淇敼 oCN.RunProc("update Sc_ICMOBillMain set " + + "HMainSourceBillSubType='" + (HMainSourceBillSubType == null ? "" : HMainSourceBillSubType) + "'," + "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + - ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + ",HIsStockQty='"+ HIsStockQty + "',HRemark3='" + HRemark3 + "' where HInterID=" + HInterID); + ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + ",HIsStockQty='"+ HIsStockQty + "',HIsStockQty_SeOrderBill='" + HIsStockQty_SeOrderBill + "',HRemark3='" + HRemark3 + "' where HInterID=" + HInterID); + + //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲� + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID); //鍒犻櫎瀛愯〃 oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'"); + + LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼鐢熶骇璁㈠崟鍗曟嵁:" + HBillNo); + oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼鐢熶骇璁㈠崟鍗曟嵁锛�" + HBillNo + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo); } //淇濆瓨瀛愯〃 objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID); + + + //鍙嶅啓婧愬崟-閿�鍞鍗曟暟鎹� + if ((OperationType == 1 || OperationType == 2 || OperationType == 4)) + { + //鐢熶骇璁㈠崟鏂板鍥炲~閿�鍞鍗曞叧鑱旀暟閲� + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID); + } + else if (OperationType == 3) + { + //鐢熶骇璁㈠崟鏂板鍥炲~閿�鍞鍗曞叧鑱旀暟閲� + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Add " + HInterID); + } + + //淇濆瓨鍚庢帶鍒�========================================= + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBill_AfterSaveCtrl_New " + HInterID, "h_p_Sc_ICMOBill_AfterSaveCtrl_New"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + //========================================================= if (objJsonResult.code == "0") { @@ -560,14 +685,14 @@ ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS ,HBomID,HEntryCusID,HSTOCKINORGID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney - ,HAuxQty,HAuxUnit,HWidth,HWeight,HColorRemark) + ,HAuxQty,HAuxUnit,HAuxQty2,HAuxUnit2,HWidth,HWeight,HColorRemark,HCusMaterName,HCusModel,HOrderPickRemark,HCusMaterNumber,HWidth_New,HWeight_New,HMaterModel,HRemark_New,HPlanOrderProcNo) 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 - ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}')"); + ,{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',0,0 + ,{oSub.HAuxQty},{oSub.HAuxUnit},{oSub.HAuxQty2},{oSub.HAuxUnit2},{oSub.HWidth},{oSub.HWeight},'{oSub.HColorRemark}','{oSub.HCusMaterName}','{oSub.HCusModel}','{oSub.HOrderPickRemark}','{oSub.HCusMaterNumber}',{oSub.HWidth_New},{oSub.HWeight_New},'{oSub.HModel}','{oSub.HRemark_New}','{oSub.HPlanOrderProcNo}')"); objJsonResult.code = "1"; @@ -583,6 +708,7 @@ [HttpGet] public object CheckSc_ICMOReportBill(string HInterID,int Type, string user) { + string sql = ""; try { //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� @@ -605,12 +731,47 @@ } ClsPub.CurUserName = user; - oCN.BeginTran();//寮�濮嬩簨鍔� + + ds = oCN.RunProcReturn("select * from Sc_ICMOBillMain where HInterID = " + int.Parse(HInterID), "Sc_ICMOBillMain"); + string HBillNo = ""; + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + } //Type 1 瀹℃牳 2 鍙嶅鏍� if (Type == 1) { - if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + //瀹℃牳鍓嶆帶鍒� + sql = "exec h_p_Sc_ICMOBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_ICMOBill_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 (!BillOld.CheckBill(int.Parse(HInterID),HBillNo, "h_p_Sc_ICMOBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; @@ -621,7 +782,28 @@ } else { - if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + //鍙嶅鏍稿墠鎺у埗 + sql = "exec h_p_Sc_ICMOBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_ICMOBill_BeforeUnCheckCtrl"); + 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 (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Sc_ICMOBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); @@ -643,8 +825,6 @@ return objJsonResult; } } - - oCN.Commit();//鎻愪氦浜嬪姟 objJsonResult.code = "0"; objJsonResult.count = 1; @@ -820,6 +1000,8 @@ { try { + string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Drop", 1, false, user)) { @@ -838,7 +1020,45 @@ objJsonResult.data = null; return objJsonResult; } - oCN.BeginTran();//寮�濮嬩簨鍔� + + string HBillNo = ""; + ds = oCN.RunProcReturn("select * from Sc_ICMOBillMain where HInterID=" + HInterID, "Sc_ICMOBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + else + { + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + } + + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Sc_ICMOBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_ICMOBill_BeforeDelCtrl"); + 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; + } + //================================================================================== + + ds = oCN.RunProcReturn("select * from Sc_ICMOBillMain where HInterID=" + HInterID, "Sc_ICMOBillMain"); if (ds == null || ds.Tables[0].Rows.Count == 0) { @@ -865,8 +1085,6 @@ } } - - if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) { objJsonResult.code = "0"; @@ -876,8 +1094,76 @@ return objJsonResult; ; } + var DataSet = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HICMOBillNo='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() +"'", "Sc_ProcessExchangeBillMain"); + + if (DataSet.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄥ伐搴忔祦杞崱,涓嶅厑璁稿垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + DataSet = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where 婧愬崟鍗曞彿='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_ProductInBillList"); + + if (DataSet.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄧ敓浜у叆搴撳崟,涓嶅厑璁稿垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + DataSet = oCN.RunProcReturn("select * from h_v_IF_MateOutBillList where 婧愬崟鍗曞彿='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_MateOutBillList"); + + if (DataSet.Tables[0].Rows.Count > 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭笅鎺ㄧ敓浜ч鏂欏崟,涓嶅厑璁稿垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + + oCN.BeginTran();//寮�濮嬩簨鍔� + //鐢熶骇璁㈠崟鍒犻櫎鍥炲~閿�鍞鍗曞叧鑱旀暟閲� + oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToICMO_Delete " + HInterID); + + oCN.RunProc("delete from Sc_ICMOBillMain where HInterID=" + HInterID); oCN.RunProc("delete from Sc_ICMOBillSub where HInterID=" + HInterID); + + LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鍒犻櫎鐢熶骇璁㈠崟鍗曟嵁:" + ds.Tables[0].Rows[0]["HBillNo"].ToString()); + oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鍒犻櫎鐢熶骇璁㈠崟鍗曟嵁锛�" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-鐢熶骇璁㈠崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_Sc_ICMOBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Sc_ICMOBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + oCN.Commit();//鎻愪氦浜嬪姟 objJsonResult.code = "0"; objJsonResult.count = 1; @@ -888,6 +1174,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString(); @@ -1098,13 +1385,13 @@ #region 鐢熶骇浠诲姟鍗曡幏鍙栬溅闂� [Route("Sc_ICMOBill/GetHDeptList")] [HttpGet] - public object GetHDeptList() + public object GetHDeptList(string HOrgID) { try { DataSet oDs = new DataSet(); //========== - oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department", "Gy_Department"); + oDs = oCN.RunProcReturn("select HItemID,HName from Gy_Department where HUSEORGID="+ HOrgID, "Gy_Department"); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇鎴愬姛锛�"; @@ -1931,5 +2218,129 @@ } #endregion + + #region 鐢熶骇浠诲姟鍗曡鍗曞寘瑁呭娉� 淇濆瓨鍔熻兘 + [Route("Sc_ICMOBill/ICMOBillSaveRemark")] + [HttpGet] + public object ICMOBillSaveRemark(string HInterID,string HEntryID, string HOrderPickRemark) + { + try + { + if (string.IsNullOrEmpty(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛丠InterID涓嶈兘涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + oCN.BeginTran(); + oCN.RunProc("update Sc_ICMOBillSub set HOrderPickRemark = '" + HOrderPickRemark + "' where HInterID = " + HInterID + " and HEntryID = " + HEntryID + ""); + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓鸿繘琛屾帓浜х殑鐢熶骇璁㈠崟 鍒楄〃 + [Route("Sc_ICMOBill/NotInDayPlan")] + [HttpGet] + public object Sc_ICMOBillList_NotInDayPlan(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOList_NotInDayPlan where 1 = 1" + sWhere , "h_v_Sc_ICMOList_NotInDayPlan"); + + if (ds == null && ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Sucess锛佹病鏈夋煡璇㈠埌鐩稿叧鏁版嵁"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鐢熶骇璁㈠崟 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栫敓浜ц鍗曟暟鎹� + [Route("Sc_ICMOBill/loadSc_ICMOBill_Push")] + [HttpGet] + public object loadSc_ICMOBill_Push(long HInterID, long HSubID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_ICMOBillList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1