From 4a71279770509d6876265b64002779c035295e3c Mon Sep 17 00:00:00 2001 From: yxj <yxj@hz-kingdee.com> Date: 星期四, 27 六月 2024 14:11:54 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/POStockInBillController.cs | 4848 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 4,779 insertions(+), 69 deletions(-) diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs index 401da54..8c671f1 100644 --- a/WebAPI/Controllers/POStockInBillController.cs +++ b/WebAPI/Controllers/POStockInBillController.cs @@ -1,5 +1,6 @@ 锘縰sing DBUtility; using Model; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SQLHelper; using System; @@ -14,6 +15,8 @@ using WebAPI; using WebAPI.Code; using WebAPI.Models; +using WebAPI.Utility; + namespace WebAPI.Controllers { /** @@ -26,14 +29,14 @@ public Int64 HWhID;//浠撳簱ID public Int64 HSPID;//浠撲綅ID - public string HSupName=string.Empty; - public string HDeptName=string.Empty; - public string HWhName=string.Empty; - public string HSPName=string.Empty; + public string HSupName = string.Empty; + public string HDeptName = string.Empty; + public string HWhName = string.Empty; + public string HSPName = string.Empty; public Int64 HInterID;//鏈崟ID public string HBillNo; - public string HSourceBillNo=string.Empty; + public string HSourceBillNo = string.Empty; public string HBillType = "1201";//鍗曟嵁绫诲瀷 public string sBillCode = "ICStockBill"; public string sTranType = "1"; @@ -43,16 +46,18 @@ public string sSourceTypeName = "閲囪喘璁㈠崟"; public string sRedBlue2 = "钃濆瓧"; //public bool sRedBlue = false; - public WebServer webserver =new WebServer(); - public DataSet ds =new DataSet(); - public ClsGy_BarCodeBill_WMS_Model_View oView =new ClsGy_BarCodeBill_WMS_Model_View(); - public ClsKF_PonderationBillMain_Temp model =new ClsKF_PonderationBillMain_Temp(); + public WebServer webserver = new WebServer(); + public DataSet ds = new DataSet(); + public ClsGy_BarCodeBill_WMS_Model_View oView = new ClsGy_BarCodeBill_WMS_Model_View(); + public ClsKF_PonderationBillMain_Temp model = new ClsKF_PonderationBillMain_Temp(); public ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public double sRelQty = 0; - // private DataBaseServices objDataBaseServices = new DataBaseServices(); + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + // private DataBaseServices objDataBaseServices = new DataBaseServices(); private JsonResult objJsonResult = new JsonResult(); - // private string msgModel = "{{\"count\":{0},\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}"; + // private string msgModel = "{{\"count\":{0},\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}"; public static string GetSession(string sMsg) { @@ -73,34 +78,3056 @@ /// <returns></returns> [Route("POStockInBill/get_CheckTypeByBarCode_Json")] [HttpGet] - public Object get_CheckTypeByBarCode_Json(string sCode, Int64 sInterID, string sBillNo, string sBillType, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID) + //public Object get_CheckTypeByBarCode_Json(string sCode, Int64 sInterID, string sBillNo, string sBillType, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID) + //{ + // try + // { + // string sErrMsg = ""; + // string sJXCode = ""; + // if (oSystemParameter.omodel.WMS_CampanyName == "瀹夌憺") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + // { + // sJXCode = POStockInBillController.JX_Json(sCode, sInterID, HBillType, HOWNERID, sBillNo, sMaker); + // SourceFlag = true; + // } + // else + // { + // sJXCode = sCode; + // } + + + + // //var sJXCode = POStockInBillController.JX_Json(sCode, sInterID, HBillType, HOWNERID, HBillNo, sMaker); + // //if (sRedBlue == true) + // //{ + // // HBillType = "1239"; + // //} + // //oBar = webserver.get_CheckTypeByBarCode(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, ref DBUtility.ClsPub.sErrInfo); + // WebS.WebService1 oWebs = new WebS.WebService1(); + // WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS(); + // string sExpressNumber = ""; + // WebSoBar = oWebs.get_CheckTypeByBarCode_All(sJXCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); + // //WebSoBar = oWebs.get_ba(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); + // if (WebSoBar == null) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = DBUtility.ClsPub.sErrInfo; + // objJsonResult.data = null; + // return objJsonResult; + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = DBUtility.ClsPub.sErrInfo; + // objJsonResult.data = WebSoBar; + // return objJsonResult; + // } + // } + // catch (Exception e) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = e.Message + ";" + e.StackTrace; + // objJsonResult.data = null; + // return objJsonResult; + // } + + //} + + + public object get_CheckTypeByBarCode_Json(string sCode, long sInterID, string sBillNo, string sBillType, string sMaker, long WhID, long SPID, double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, long HOWNERID) { - //if (sRedBlue == true) - //{ - // HBillType = "1239"; - //} - //oBar = webserver.get_CheckTypeByBarCode(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, ref DBUtility.ClsPub.sErrInfo); - WebS.WebService1 oWebs = new WebS.WebService1(); - WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS(); - string sExpressNumber = ""; - WebSoBar = oWebs.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); - if (WebSoBar == null) + object result; + try { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = DBUtility.ClsPub.sErrInfo; - objJsonResult.data = null; - return objJsonResult; + WebS.WebService1 oWebs = new WebS.WebService1(); + WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS(); + string hexpressNumber = ""; + WebSoBar = oWebs.get_CheckTypeByBarCode_All(sCode, sInterID, this.HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, hexpressNumber, ref ClsPub.sErrInfo); + bool flag = WebSoBar == null; + if (flag) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = ClsPub.sErrInfo; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + else + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 1; + this.objJsonResult.Message = ClsPub.sErrInfo; + this.objJsonResult.data = WebSoBar; + result = this.objJsonResult; + } } - else + catch (Exception ex) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 1; + this.objJsonResult.Message = ex.Message + ";" + ex.StackTrace; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + return result; + } + + + + /// <summary> + /// 鐢熶骇姹囨姤/鎵潯鐮�/鐩存帴璋冪敤webservice + /// </summary> + /// <returns></returns> + [Route("ICMOReportBill/get_CheckTypeByBarCode_Json1")] + [HttpGet] + public Object get_CheckTypeByBarCode_Json1(string sCode, Int64 sInterID, string sBillType, string sBillNo, string sMaker, Int64 WhID, Int64 SPID, Double sQty, bool sRedBlue, bool SourceFlag, string sSourceBillNo, string sSourceType, Int64 HOWNERID) + { + try + { + //if (sRedBlue == true) + //{ + // HBillType = "1239"; + //} + //oBar = webserver.get_CheckTypeByBarCode(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, ref DBUtility.ClsPub.sErrInfo); + WebS.WebService1 oWebs = new WebS.WebService1(); + WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS(); + string sExpressNumber = ""; + WebSoBar = oWebs.get_CheckTypeByBarCode_All(sCode, sInterID, sBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); + if (WebSoBar == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; + objJsonResult.data = WebSoBar; + return objJsonResult; + } + } + catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message = DBUtility.ClsPub.sErrInfo; - objJsonResult.data = WebSoBar; + objJsonResult.Message = e.Message + ";" + e.StackTrace; + objJsonResult.data = null; return objJsonResult; } + } + + + //[Route("kf_PoStockInBill/JX_Json")] + //[HttpGet] + //public static string JX_Json(string sBarCodeNew, Int64 hinterid, string HBillType,Int64 HOrgID,string HBillNo,string HMaker) + //{ + // try + // { + // //1.鍒ゆ柇绯荤粺鍙傛暟鏄惁瀹夌憺 涓嶆槸瀹夌憺 鐩存帴璺虫帀 + // //濡傛灉鏄畨鐟� 璧颁笅闈� + + // //瑙f瀽鏉$爜 + // //濡傛灉鍦ㄦ潯鐮佹。妗堥噷闈� 涓嶅鐞� 娌℃湁鐨勮瘽 瀛樺叆鏉$爜妗f + + // //鏍规嵁瑙f瀽鐨勭墿鏂� + 鎵规 鍒ゆ柇 鏉$爜涓存椂琛� 璁板綍鏄惁瀛樺湪 娌℃湁鐨勮瘽 杩涜鎵簮鍗曠殑鍔ㄤ綔 + + + // //鍔犱簡 鐢熶骇鏃ユ湡 鏈夋晥鏈熻嚦 淇濊川鏈熸爣蹇� + + // Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + // //if (oSystemParameter.omodel.WMS_CampanyName == "瀹夌憺") + // //{ + // string HTM = ""; + // //閲囪喘鍏ュ簱 + // if (HBillType == "1201") + // { + // string[] sArray = sBarCodeNew.Split('@'); + // string HMaterNumber = ""; + // HMaterNumber = sArray[0]; + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sArray[4]); + // string HBarchNo = ""; + // HBarchNo = sArray[6]; + + // DateTime HSCRQ = ClsPub.isDate(sArray[3]); + // DateTime HYXQZ = ClsPub.isDate(sArray[5]); + + // //閲囪喘璁㈠崟鍙� + // string HPOOrderBillNo = ""; + // HPOOrderBillNo = ClsPub.isStrNull(sArray[8]); + + + + // Int64 HMaterID = 0; + + // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + // DataSet Dss; + // Dss = oCn.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + + // DataSet Dss1; + // Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + + + // HTM = HOrgNumber + HMaterID + HBarchNo; + + // //濡傛灉鏉$爜妗f涓嶅瓨鍦� 杩涜瀛樺叆鏉$爜妗f鐨勫姩浣� + // //鏍规嵁鐗╂枡 + 鎵规 + 閲囪喘璁㈠崟鍙� 鎵惧埌瀵瑰簲鐨勬敹鏂欓�氱煡鍗曞彿 + // DataSet Dss2; + // Dss2 = oCn.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FSRCBILLNO= '" + HPOOrderBillNo + "' and FMATERIALID = " + HMaterID, "h_v_RECEIVEQuery"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["FMATERIALID"]); + // Int64 HSourceInterID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["fid"]); + // Int64 HSourceEntryID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["FENTRYID"]); + // string HSourceBillNo = Pub_Class.ClsPub.isStrNull(Dss2.Tables[0].Rows[0]["FBILLNO"]); + // //鍒ゆ柇鏉$爜妗f鏄惁瀛樺湪璇ユ潯鐮� + // //濡傛灉瀛樺湪 鍐嶅垽鏂壂鐮佷复鏃惰〃鏄惁瀛樺湪璇ユ潯鐮� + // //濡傛灉涓嶅瓨鍦� 杩涜鎵簮鍗曠殑鏂规硶 + // DataSet Dss5; + // Dss5 = oCn.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + // DataSet Dss6; + // Dss6 = oCn.RunProcReturn(" select * from KF_PonderationBillMain_Temp where HBarCode= '" + HTM + "' and HInterID = " + hinterid.ToString() + " and HBillType = '" + HBillType + "' and hsourcebillno = '" + HSourceBillNo + "' ", "KF_PonderationBillMain_Temp"); + // if (Dss6.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + // POStockInBillController POStockInBill = new POStockInBillController(); + // POStockInBill.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", HSourceBillNo, hinterid, HBillNo); + + // } + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBarchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','1103',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ.ToShortDateString() + "','" + HYXQZ.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + // DataSet Dss7; + // Dss7 = oCn.RunProcReturn(" select * from KF_PonderationBillMain_Temp where HBarCode= '" + HTM + "' and HInterID = " + hinterid.ToString() + " and HBillType = '" + HBillType + "' and hsourcebillno = '" + HSourceBillNo + "' ", "KF_PonderationBillMain_Temp"); + // if (Dss7.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + // POStockInBillController POStockInBill = new POStockInBillController(); + // POStockInBill.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", HSourceBillNo, hinterid, HBillNo); + + // } + + // } + // } + // //浜у搧鍏ュ簱 + // if(HBillType == "1202") + // { + // string HMaterNumber = ""; + // HMaterNumber = sBarCodeNew.Substring(0, 10); + // string HSCRQ = ""; + // HSCRQ = "20" + sBarCodeNew.Substring(10, 6); + // Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); + // Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); + // Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); + + // string HBatchNo = ""; + // HBatchNo = sBarCodeNew.Substring(16, 11); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + // DataSet ds; + // Int64 HMaterID = 0; + // DataSet Dss1; + // Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + // ds = oCN.RunProcReturn("select * from h_v_SCStockInCheckBill_Json where HYear =" + Year + " and HMonth = " + Month + " and HDay = " + Day + " and HMaterID = " + HMaterID.ToString() + "and 鎵规 = '" + HBatchNo.ToString() + "'", "h_v_SCStockInCheckBill_Json"); + // Int64 HSourceInterID = Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceInterID"]); + // Int64 HSourceEntryID = Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0]["HSourceEntryID"]); + // string HSourceBillNo = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBillNo"]); + // DataSet Dss; + // Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + // HTM = HOrgNumber + HMaterID + HBatchNo; + + + // DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + // string HYXQZ = "20" + sBarCodeNew.Substring(27, 6); + // Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4)); + // Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2)); + // Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2)); + // DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1); + + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sBarCodeNew.Substring(33,3)); + + // DataSet Dss5; + // Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + // DataSet Dss6; + // Dss6 = oCN.RunProcReturn(" select * from KF_PonderationBillMain_Temp where HBarCode= '" + HTM + "' and HInterID = " + hinterid.ToString() + " and HBillType = '" + HBillType + "' and hsourcebillno = '" + HSourceBillNo + "' ", "KF_PonderationBillMain_Temp"); + // if (Dss6.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + // WEBSController WEBS = new WEBSController(); + // WEBS.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, HSourceBillNo, "3714", HMaker,HOrgID); + + // } + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','3714',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + // DataSet Dss7; + // Dss7 = oCN.RunProcReturn(" select * from KF_PonderationBillMain_Temp where HBarCode= '" + HTM + "' and HInterID = " + hinterid.ToString() + " and HBillType = '" + HBillType + "' and hsourcebillno = '" + HSourceBillNo + "' ", "KF_PonderationBillMain_Temp"); + // if (Dss7.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + // WEBSController WEBS = new WEBSController(); + // WEBS.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, HSourceBillNo, "3714", HMaker, HOrgID); + + // } + + // } + + // } + // //鐢熶骇閫�鏂� + // if (HBillType == "1244") + // { + // string HMaterNumber = ""; + // HMaterNumber = sBarCodeNew.Substring(0, 10); + // string HSCRQ = ""; + // HSCRQ = "20" + sBarCodeNew.Substring(10, 6); + // Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); + // Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); + // Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); + + // string HBatchNo = ""; + // HBatchNo = sBarCodeNew.Substring(16, 11); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + // Int64 HMaterID = 0; + // DataSet Dss1; + // Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + // DataSet Dss; + // Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + // HTM = HOrgNumber + HMaterID + HBatchNo; + + + // DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + // string HYXQZ = "20" + sBarCodeNew.Substring(27, 6); + // Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4)); + // Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2)); + // Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2)); + // DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1); + + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sBarCodeNew.Substring(33, 3)); + + // DataSet Dss5; + // Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", 0,0,'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //璋冩嫧鍗� + // if (HBillType == "1207") + // { + // string HMaterNumber = ""; + // HMaterNumber = sBarCodeNew.Substring(0, 10); + // string HSCRQ = ""; + // HSCRQ = "20" + sBarCodeNew.Substring(10, 6); + // Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); + // Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); + // Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); + + // string HBatchNo = ""; + // HBatchNo = sBarCodeNew.Substring(16, 11); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + // Int64 HMaterID = 0; + // DataSet Dss1; + // Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + // DataSet Dss; + // Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + // HTM = HOrgNumber + HMaterID + HBatchNo; + + + // DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + // string HYXQZ = "20" + sBarCodeNew.Substring(27, 6); + // Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4)); + // Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2)); + // Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2)); + // DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1); + + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sBarCodeNew.Substring(33, 3)); + + // DataSet Dss5; + // Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", 0,0,'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //鍏朵粬鍑哄簱鍗� + // if (HBillType == "1206") + // { + // string HMaterNumber = ""; + // HMaterNumber = sBarCodeNew.Substring(0, 10); + // string HSCRQ = ""; + // HSCRQ = "20" + sBarCodeNew.Substring(10, 6); + // Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); + // Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); + // Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); + + // string HBatchNo = ""; + // HBatchNo = sBarCodeNew.Substring(16, 11); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + // Int64 HMaterID = 0; + // DataSet Dss1; + // Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + // DataSet Dss; + // Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + // HTM = HOrgNumber + HMaterID + HBatchNo; + + + // DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + // string HYXQZ = "20" + sBarCodeNew.Substring(27, 6); + // Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4)); + // Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2)); + // Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2)); + // DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1); + + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sBarCodeNew.Substring(33, 3)); + + // DataSet Dss5; + // Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", 0,0,'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //棰嗘枡鍑哄簱鏍¢獙 + // if (HBillType == "1204") + // { + // string[] sArray = sBarCodeNew.Split('@'); + // string HMaterNumber = ""; + // HMaterNumber = sArray[0]; + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sArray[4]); + // string HBarchNo = ""; + // HBarchNo = sArray[6]; + + // DateTime HSCRQ = ClsPub.isDate(sArray[3]); + // DateTime HYXQZ = ClsPub.isDate(sArray[5]); + + // //閲囪喘璁㈠崟鍙� + // string HPOOrderBillNo = ""; + // HPOOrderBillNo = ClsPub.isStrNull(sArray[8]); + + + + // Int64 HMaterID = 0; + + // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + // DataSet Dss; + // Dss = oCn.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + + // DataSet Dss1; + // Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + + + // HTM = HOrgNumber + HMaterID + HBarchNo; + + + // DataSet Dss5; + // Dss5 = oCn.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBarchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", " + 0 + "," + 0 + ",'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ.ToShortDateString() + "','" + HYXQZ.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //鐢熶骇琛ユ枡鏍¢獙 + // if (HBillType == "1254") + // { + // string[] sArray = sBarCodeNew.Split('@'); + // string HMaterNumber = ""; + // HMaterNumber = sArray[0]; + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sArray[4]); + // string HBarchNo = ""; + // HBarchNo = sArray[6]; + + // DateTime HSCRQ = ClsPub.isDate(sArray[3]); + // DateTime HYXQZ = ClsPub.isDate(sArray[5]); + + // //閲囪喘璁㈠崟鍙� + // string HPOOrderBillNo = ""; + // HPOOrderBillNo = ClsPub.isStrNull(sArray[8]); + + + + // Int64 HMaterID = 0; + + // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + // DataSet Dss; + // Dss = oCn.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + + // DataSet Dss1; + // Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + + + // HTM = HOrgNumber + HMaterID + HBarchNo; + + + // DataSet Dss5; + // Dss5 = oCn.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBarchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", " + 0 + "," + 0 + ",'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ.ToShortDateString() + "','" + HYXQZ.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //閿�鍞嚭搴撴牎楠� + // if (HBillType == "1205") + // { + // string HMaterNumber = ""; + // HMaterNumber = sBarCodeNew.Substring(0, 10); + // string HSCRQ = ""; + // HSCRQ = "20" + sBarCodeNew.Substring(10, 6); + // Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); + // Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); + // Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); + + // string HBatchNo = ""; + // HBatchNo = sBarCodeNew.Substring(16, 11); + // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + // Int64 HMaterID = 0; + // DataSet Dss1; + // Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + // HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + // string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + // string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + // Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + // DataSet Dss; + // Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + // string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + // HTM = HOrgNumber + HMaterID + HBatchNo; + + + // DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + // string HYXQZ = "20" + sBarCodeNew.Substring(27, 6); + // Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4)); + // Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2)); + // Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2)); + // DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1); + + // Int64 HQty = 0; + // HQty = ClsPub.isInt(sBarCodeNew.Substring(33, 3)); + + // DataSet Dss5; + // Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + // if (Dss5.Tables[0].Rows.Count > 0) + // { + + // } + // else + // { + + + + // string ModName = "85"; + // var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + // Int64 HSupID = 0; + // oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + // ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + // ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + // ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + // ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + // ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + // ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + // ") values (" + // + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + // + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + // + ", 0,0,'','',0" + // + ", 0,'',0,0,0,''" + // + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()" + // + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + // + ",0,0,0" + // + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + + // } + + // } + // //objJsonResult.code = "0"; + // //objJsonResult.count = 1; + // //objJsonResult.Message = DBUtility.ClsPub.sErrInfo; + // //objJsonResult.data = ; + // return HTM; + + // } + // catch (Exception e) + // { + // //objJsonResult.code = "0"; + // //objJsonResult.count = 1; + // //objJsonResult.Message = e.Message + ";" + e.StackTrace; + // //objJsonResult.data = null; + // return e.Message + ";" + e.StackTrace; + // } + + //} + + + + + + [Route("kf_PoStockInBill/JX_Json")] + [HttpGet] + public static string JX_Json(string sBarCodeNew, long hinterid, string HBillType, long HOrgID, string HBillNo, string HMaker) + { + string result; + try + { + Pub_Class.ClsXt_SystemParameter clsXt_SystemParameter = new Pub_Class.ClsXt_SystemParameter(); + WebS.ClsXt_SystemParameterMain oSystemParameterMain = new WebS.ClsXt_SystemParameterMain(); + string text = ""; + string text1 = ""; + //gy_billnumber 鍗曟嵁绫诲瀷琛� + bool flag = HBillType == "1201"; //WMS 閲囪喘鍏ュ簱 + if (flag) + { + string[] array = sBarCodeNew.Split(new char[] + { + '@' + }); + string str = array[0]; //鐗╂枡浠g爜 + long num = (long)ClsPub.isInt(array[4]); + string text2 = array[6]; + DateTime dateTime = ClsPub.isDate(array[3]); + DateTime dateTime2 = ClsPub.isDate(array[5]); + string str2 = ClsPub.isStrNull(array[8]); + ClsCN clsCN = new ClsCN(); + DataSet dataSet = clsCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str3 = ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HNumber"]); + + + //鐢ㄦ媶鍒嗗嚭鏉ョ殑鐗╂枡浠g爜鏌ヨ鐗╂枡琛ㄩ噷鐨勬柊鐗╂枡缂栫爜 + DataSet Dss7; + Dss7 = clsCN.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + //鏂扮墿鏂欒〃閲屾病鏈夎繑鍥炴暟鎹垯鏌ヨ鐗╂枡琛ㄩ噷鐨勬棫鐗╂枡缂栫爜 + DataSet Dss8; + Dss8 = clsCN.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str + "'", "T_BD_MATERIAL"); + str = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + + DataSet dataSet2 = clsCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num2 = ClsPub.isLong(dataSet2.Tables[0].Rows[0]["HItemID"]); + string text3 = ClsPub.isStrNull(dataSet2.Tables[0].Rows[0]["HName"]); + string text4 = ClsPub.isStrNull(dataSet2.Tables[0].Rows[0]["HModel"]); + long num3 = (long)ClsPub.isInt(dataSet2.Tables[0].Rows[0]["HUnitID"]); + text = str3 + num2.ToString() + text2 + "#" + num; + text1 = str3 + num2.ToString() + text2; + //鎵炬簮鍗� + DataSet dataSet3 = clsCN.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FSRCBILLNO= '" + str2 + "' and FLOT_TEXT = '" + text2 + "' and FMATERIALID = " + num2.ToString(), "h_v_RECEIVEQuery"); + //DataSet dataSet3 = clsCN.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FLOT_TEXT= '" + text2 + "' and FPRODUCEDATE = '" + dateTime + "' and FMATERIALID = " + num2.ToString(), "h_v_RECEIVEQuery"); + num2 = ClsPub.isLong(dataSet3.Tables[0].Rows[0]["FMATERIALID"]); + long num4 = ClsPub.isLong(dataSet3.Tables[0].Rows[0]["fid"]); + long num5 = ClsPub.isLong(dataSet3.Tables[0].Rows[0]["FENTRYID"]); + string text5 = ClsPub.isStrNull(dataSet3.Tables[0].Rows[0]["FBILLNO"]); + DataSet dataSet4 = clsCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag2 = dataSet4.Tables[0].Rows.Count > 0; + if (flag2) + { + DataSet dataSet5 = clsCN.RunProcReturn(string.Concat(new string[] + { + //鎵爜涓存椂璁板綍琛� + " select * from KF_PonderationBillMain_Temp where HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text5, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag3 = dataSet5.Tables[0].Rows.Count > 0; + if (!flag3) + { + //POStockInBillController postockInBillController = new POStockInBillController(); + ////鎵簮鍗曟柟娉� + //postockInBillController.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo); + + WEBSController webscontroller4 = new WEBSController(); + object obj4 = webscontroller4.get_SourceBarCode_POStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID); + + + + } + } + else + { + string billCode = "85"; + long num6 = ClsPub.CreateBillID_Prod(billCode, ref ClsPub.sExeReturnInfo); + long num7 = 0L; + clsCN.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num2.ToString(), + ",", + num3.ToString(), + ",", + num.ToString(), + ",'", + text2, + "',", + num7.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num.ToString(), + ", ", + num4.ToString(), + ",", + num5.ToString(), + ",'", + text5.ToString(), + "','1103',0, 0,'',0,0,0,'',0,'','','", + dateTime.ToShortDateString(), + "','", + dateTime2.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num6.ToString(), + ",1,0,0,0,'", + text3, + "','", + text4, + "','',0,'','',1)" + })); + DataSet dataSet6 = clsCN.RunProcReturn(string.Concat(new string[] + { + " select * from KF_PonderationBillMain_Temp where HBarCode= '", + text1, + "' and HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text5, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag4 = dataSet6.Tables[0].Rows.Count > 0; + if (!flag4) + { + //POStockInBillController postockInBillController2 = new POStockInBillController(); + //postockInBillController2.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo); + + WEBSController webscontroller4 = new WEBSController(); + object obj4 = webscontroller4.get_SourceBarCode_POStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID); + } + } + } + bool flag5 = HBillType == "1202"; //WMS 鐢熶骇鍏ュ簱 + if (flag5) + { + string text6 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text7 = text6.Substring(0, 1); + bool flag6 = text7.Contains("W") || text7.Contains("N"); + if (flag6) + { + string text8 = sBarCodeNew.Substring(0, 10);//鍟嗗搧鐮� 鍟嗗搧鐮�+鐗╂枡浠g爜+鐢熶骇鏃ユ湡+鎵规+澶辨晥鏃ユ湡+涓�浣嶅瓧姣�+涓変綅鏁板瓧 + string str4 = sBarCodeNew.Substring(10, 10);//鐗╂枡浠g爜 + string text9 = "20" + sBarCodeNew.Substring(20, 6); + long num8 = (long)ClsPub.isInt(text9.Substring(0, 4)); //骞� + long num9 = (long)ClsPub.isInt(text9.Substring(4, 2)); //鏈� + long num10 = (long)ClsPub.isInt(text9.Substring(6, 2)); //鏃� + long num11 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3));//鍚庝笁浣嶆案杩滈兘鏄暟瀛� + string text10 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10);//澶辨晥鏃ユ湡+涓�浣嶅瓧姣�+涓変綅鏁板瓧 + string text11 = "20" + text10.Substring(0, 6); + long num12 = (long)ClsPub.isInt(text11.Substring(0, 4)); + long num13 = (long)ClsPub.isInt(text11.Substring(4, 2)); + long num14 = (long)ClsPub.isInt(text11.Substring(6, 2)); + DateTime dateTime3 = ClsPub.isDate(string.Concat(new string[] + { + num12.ToString(), + "-", + num13.ToString(), + "-", + num14.ToString() + })); + string text12 = sBarCodeNew.Remove(0, 26); + string text13 = text12.Remove(text12.Length - 10, 10); + ClsCN clsCN2 = new ClsCN(); + + + DataSet Dss7; + Dss7 = clsCN2.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str4 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN2.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str4 + "'", "T_BD_MATERIAL"); + str4 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str4 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet7 = clsCN2.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str4 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num15 = ClsPub.isLong(dataSet7.Tables[0].Rows[0]["HItemID"]); + string text14 = ClsPub.isStrNull(dataSet7.Tables[0].Rows[0]["HName"]); + string text15 = ClsPub.isStrNull(dataSet7.Tables[0].Rows[0]["HModel"]); + long num16 = (long)ClsPub.isInt(dataSet7.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet8 = clsCN2.RunProcReturn(string.Concat(new string[] + { + "select * from h_v_SCStockInCheckBill_Json where HYear =", + num8.ToString(), + " and HMonth = ", + num9.ToString(), + " and HDay = ", + num10.ToString(), + " and HMaterID = ", + num15.ToString(), + "and 鎵规 = '", + text13.ToString(), + "'" + }), "h_v_SCStockInCheckBill_Json"); + long num17 = ClsPub.isLong(dataSet8.Tables[0].Rows[0]["HSourceInterID"]); + long num18 = ClsPub.isLong(dataSet8.Tables[0].Rows[0]["HSourceEntryID"]); + string text16 = ClsPub.isStrNull(dataSet8.Tables[0].Rows[0]["HBillNo"]); + DataSet dataSet9 = clsCN2.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str5 = ClsPub.isStrNull(dataSet9.Tables[0].Rows[0]["HNumber"]); + text = str5 + num15.ToString() + text13 + text9 + "#" + num11; + text1 = str5 + num15.ToString() + text13 + text9; + DateTime dateTime4 = ClsPub.isDate(string.Concat(new string[] + { + num8.ToString(), + "-", + num9.ToString(), + "-", + num10.ToString() + })); + DataSet dataSet10 = clsCN2.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag7 = dataSet10.Tables[0].Rows.Count > 0; + if (flag7) + { + DataSet dataSet11 = clsCN2.RunProcReturn(string.Concat(new string[] + { + " select * from KF_PonderationBillMain_Temp where HBarCode= '", + text1, + "' and HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text16, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag8 = dataSet11.Tables[0].Rows.Count > 0; + if (!flag8) + { + WEBSController webscontroller = new WEBSController(); + object obj = webscontroller.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, text16, "3714", HMaker, HOrgID); + } + } + else + { + string billCode2 = "85"; + long num19 = ClsPub.CreateBillID_Prod(billCode2, ref ClsPub.sExeReturnInfo); + long num20 = 0L; + clsCN2.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num15.ToString(), + ",", + num16.ToString(), + ",", + num11.ToString(), + ",'", + text13, + "',", + num20.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num11.ToString(), + ", ", + num17.ToString(), + ",", + num18.ToString(), + ",'", + text16.ToString(), + "','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime4.ToShortDateString(), + "','", + dateTime3.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num19.ToString(), + ",1,0,0,0,'", + text14, + "','", + text15, + "','',0,'','',1)" + })); + DataSet dataSet12 = clsCN2.RunProcReturn(string.Concat(new string[] + { + " select * from KF_PonderationBillMain_Temp where HBarCode= '", + text1, + "' and HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text16, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag9 = dataSet12.Tables[0].Rows.Count > 0; + if (!flag9) + { + WEBSController webscontroller2 = new WEBSController(); + object obj2 = webscontroller2.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, text16, "3714", HMaker, HOrgID); + } + } + } + else + { + /*鍓嶅崄浣嶇墿鏂欎唬鐮侊紝鍚庡叚浣嶇敓鏁堟棩鏈燂紝鍊掓暟鍓嶄笁浣嶆槸鏁板瓧鍓嶅叚浣嶆槸澶辨晥鏃ユ湡 */ + string str6 = sBarCodeNew.Substring(0, 10);//鐗╂枡浠g爜 + string text17 = "20" + sBarCodeNew.Substring(10, 6); + long num21 = (long)ClsPub.isInt(text17.Substring(0, 4)); + long num22 = (long)ClsPub.isInt(text17.Substring(4, 2)); + long num23 = (long)ClsPub.isInt(text17.Substring(6, 2)); + long num24 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text18 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text19 = "20" + text18.Substring(0, 6); + long num25 = (long)ClsPub.isInt(text19.Substring(0, 4)); + long num26 = (long)ClsPub.isInt(text19.Substring(4, 2)); + long num27 = (long)ClsPub.isInt(text19.Substring(6, 2)); + DateTime dateTime5 = ClsPub.isDate(string.Concat(new string[] + { + num25.ToString(), + "-", + num26.ToString(), + "-", + num27.ToString() + })); + string text20 = sBarCodeNew.Remove(0, 16); //SAE1300100 230309 2303704 250308 010 + string text21 = text20.Remove(text20.Length - 9 , 9); //SAE1300100230309 2303704 250308010 + ClsCN clsCN3 = new ClsCN(); + DataSet dataSet13 = clsCN3.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str6 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num28 = ClsPub.isLong(dataSet13.Tables[0].Rows[0]["HItemID"]); + string text22 = ClsPub.isStrNull(dataSet13.Tables[0].Rows[0]["HName"]); + string text23 = ClsPub.isStrNull(dataSet13.Tables[0].Rows[0]["HModel"]); + long num29 = (long)ClsPub.isInt(dataSet13.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet14 = clsCN3.RunProcReturn(string.Concat(new string[] + { + "select * from h_v_SCStockInCheckBill_Json where HYear =", + num21.ToString(), + " and HMonth = ", + num22.ToString(), + " and HDay = ", + num23.ToString(), + " and HMaterID = ", + num28.ToString(), + "and 鎵规 = '", + text21.ToString(), + "'" + }), "h_v_SCStockInCheckBill_Json"); + long num30 = ClsPub.isLong(dataSet14.Tables[0].Rows[0]["HSourceInterID"]); + long num31 = ClsPub.isLong(dataSet14.Tables[0].Rows[0]["HSourceEntryID"]); + string text24 = ClsPub.isStrNull(dataSet14.Tables[0].Rows[0]["HBillNo"]); + DataSet dataSet15 = clsCN3.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str7 = ClsPub.isStrNull(dataSet15.Tables[0].Rows[0]["HNumber"]); + text = str7 + num28.ToString() + text21 + text17 + "#" + num24; + text1 = str7 + num28.ToString() + text21 + text17; + DateTime dateTime6 = ClsPub.isDate(string.Concat(new string[] + { + num21.ToString(), + "-", + num22.ToString(), + "-", + num23.ToString() + })); + DataSet dataSet16 = clsCN3.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag10 = dataSet16.Tables[0].Rows.Count > 0; + if (flag10) + { + DataSet dataSet17 = clsCN3.RunProcReturn(string.Concat(new string[] + { + " select * from KF_PonderationBillMain_Temp where HBarCode= '", + text1, + "' and HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text24, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag11 = dataSet17.Tables[0].Rows.Count > 0; + if (!flag11) + { + WEBSController webscontroller3 = new WEBSController(); + object obj3 = webscontroller3.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, text24, "3714", HMaker, HOrgID); + } + } + else + { + //鍙兘鍜屼粬浠殑鐧诲綍缁勭粐鏈夊叧绯� + string billCode3 = "85"; + long num32 = ClsPub.CreateBillID_Prod(billCode3, ref ClsPub.sExeReturnInfo); + long num33 = 0L; + clsCN3.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num28.ToString(), + ",", + num29.ToString(), + ",", + num24.ToString(), + ",'", + text21, + "',", + num33.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num24.ToString(), + ", ", + num30.ToString(), + ",", + num31.ToString(), + ",'", + text24.ToString(), + "','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime6.ToShortDateString(), + "','", + dateTime5.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num32.ToString(), + ",1,0,0,0,'", + text22, + "','", + text23, + "','',0,'','',1)" + })); + DataSet dataSet18 = clsCN3.RunProcReturn(string.Concat(new string[] + { + " select * from KF_PonderationBillMain_Temp where HBarCode= '", + text1, + "' and HInterID = ", + hinterid.ToString(), + " and HBillType = '", + HBillType, + "' and hsourcebillno = '", + text24, + "' " + }), "KF_PonderationBillMain_Temp"); + bool flag12 = dataSet18.Tables[0].Rows.Count > 0; + if (!flag12) + { + WEBSController webscontroller4 = new WEBSController(); + object obj4 = webscontroller4.get_SourceBarCode_ProductIn_Json(hinterid, HBillNo, HBillType, text24, "3714", HMaker, HOrgID); + } + } + } + } + bool flag13 = HBillType == "1244"; //WMS 鐢熶骇閫�鏂欏崟 + if (flag13) + { + bool flag14 = sBarCodeNew.Contains("@"); + if (flag14) + { + string[] array2 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str8 = array2[0]; + Double num34 = (long)ClsPub.isDoule(array2[4]); + string text25 = array2[6]; + DateTime dateTime7 = ClsPub.isDate(array2[3]); + DateTime dateTime8 = ClsPub.isDate(array2[5]); + string text26 = ClsPub.isStrNull(array2[8]); + ClsCN clsCN4 = new ClsCN(); + DataSet dataSet19 = clsCN4.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str9 = ClsPub.isStrNull(dataSet19.Tables[0].Rows[0]["HNumber"]); + + DataSet Dss7; + Dss7 = clsCN4.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str8 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN4.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str8 + "'", "T_BD_MATERIAL"); + str8 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str8 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + + + DataSet dataSet20 = clsCN4.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str8 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num35 = ClsPub.isLong(dataSet20.Tables[0].Rows[0]["HItemID"]); + string text27 = ClsPub.isStrNull(dataSet20.Tables[0].Rows[0]["HName"]); + string text28 = ClsPub.isStrNull(dataSet20.Tables[0].Rows[0]["HModel"]); + long num36 = (long)ClsPub.isInt(dataSet20.Tables[0].Rows[0]["HUnitID"]); + //鏉$爜鐢熸垚瑙勫垯 缁勭粐浠g爜 + 鐗╂枡ID + 鎵规鍙� + # + 鏁伴噺 鐢ㄤ簬鎵规鐮� 姣忔鎵爜绱鏁伴噺 + text = str9 + num35.ToString() + text25 + "#" + num34; + text1 = str9 + num35.ToString() + text25; + DataSet dataSet21 = clsCN4.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag15 = dataSet21.Tables[0].Rows.Count > 0; + if (!flag15) + { + string billCode4 = "85"; + long num37 = ClsPub.CreateBillID_Prod(billCode4, ref ClsPub.sExeReturnInfo); + long num38 = 0L; + clsCN4.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num35.ToString(), + ",", + num36.ToString(), + ",", + num34.ToString(), + ",'", + text25, + "',", + num38.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num34.ToString(), + ", 0,0,'','1244',0, 0,'',0,0,0,'',0,'','','", + dateTime7.ToShortDateString(), + "','", + dateTime8.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num37.ToString(), + ",1,0,0,0,'", + text27, + "','", + text28, + "','',0,'','',1)" + })); + } + } + else + { + string text29 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text30 = text29.Substring(0, 1); + bool flag16 = text30.Contains("W") || text30.Contains("N"); + if (flag16) + { + string text31 = sBarCodeNew.Substring(0, 10); + string str10 = sBarCodeNew.Substring(10, 10); + string text32 = "20" + sBarCodeNew.Substring(20, 6); + long num39 = (long)ClsPub.isInt(text32.Substring(0, 4)); + long num40 = (long)ClsPub.isInt(text32.Substring(4, 2)); + long num41 = (long)ClsPub.isInt(text32.Substring(6, 2)); + long num42 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text33 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text34 = "20" + text33.Substring(0, 6); + long num43 = (long)ClsPub.isInt(text34.Substring(0, 4)); + long num44 = (long)ClsPub.isInt(text34.Substring(4, 2)); + long num45 = (long)ClsPub.isInt(text34.Substring(6, 2)); + DateTime dateTime9 = ClsPub.isDate(string.Concat(new string[] + { + num43.ToString(), + "-", + num44.ToString(), + "-", + num45.ToString() + })); + string text35 = sBarCodeNew.Remove(0, 26); + string text36 = text35.Remove(text35.Length - 10, 10); + ClsCN clsCN5 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN5.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str10 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN5.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str10 + "'", "T_BD_MATERIAL"); + str10 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str10 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + + DataSet dataSet22 = clsCN5.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str10 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num46 = ClsPub.isLong(dataSet22.Tables[0].Rows[0]["HItemID"]); + string text37 = ClsPub.isStrNull(dataSet22.Tables[0].Rows[0]["HName"]); + string text38 = ClsPub.isStrNull(dataSet22.Tables[0].Rows[0]["HModel"]); + long num47 = (long)ClsPub.isInt(dataSet22.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet23 = clsCN5.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str11 = ClsPub.isStrNull(dataSet23.Tables[0].Rows[0]["HNumber"]); + text = str11 + num46.ToString() + text36 + "#" + num42; + text1 = str11 + num46.ToString() + text36; + DateTime dateTime10 = ClsPub.isDate(string.Concat(new string[] + { + num39.ToString(), + "-", + num40.ToString(), + "-", + num41.ToString() + })); + DataSet dataSet24 = clsCN5.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag17 = dataSet24.Tables[0].Rows.Count > 0; + if (!flag17) + { + string billCode5 = "85"; + long num48 = ClsPub.CreateBillID_Prod(billCode5, ref ClsPub.sExeReturnInfo); + long num49 = 0L; + clsCN5.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num46.ToString(), + ",", + num47.ToString(), + ",", + num42.ToString(), + ",'", + text36, + "',", + num49.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num42.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime10.ToShortDateString(), + "','", + dateTime9.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num48.ToString(), + ",1,0,0,0,'", + text37, + "','", + text38, + "','',0,'','',1)" + })); + } + } + else + { + string str12 = sBarCodeNew.Substring(0, 10); + string text39 = "20" + sBarCodeNew.Substring(10, 6); + long num50 = (long)ClsPub.isInt(text39.Substring(0, 4)); + long num51 = (long)ClsPub.isInt(text39.Substring(4, 2)); + long num52 = (long)ClsPub.isInt(text39.Substring(6, 2)); + long num53 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text40 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text41 = "20" + text40.Substring(0, 6); + long num54 = (long)ClsPub.isInt(text41.Substring(0, 4)); + long num55 = (long)ClsPub.isInt(text41.Substring(4, 2)); + long num56 = (long)ClsPub.isInt(text41.Substring(6, 2)); + DateTime dateTime11 = ClsPub.isDate(string.Concat(new string[] + { + num54.ToString(), + "-", + num55.ToString(), + "-", + num56.ToString() + })); + string text42 = sBarCodeNew.Remove(0, 16); + string text43 = text42.Remove(text42.Length - 9, 9); + ClsCN clsCN6 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN6.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str12 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN6.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str12 + "'", "T_BD_MATERIAL"); + str12 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str12 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet25 = clsCN6.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str12 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num57 = ClsPub.isLong(dataSet25.Tables[0].Rows[0]["HItemID"]); + string text44 = ClsPub.isStrNull(dataSet25.Tables[0].Rows[0]["HName"]); + string text45 = ClsPub.isStrNull(dataSet25.Tables[0].Rows[0]["HModel"]); + long num58 = (long)ClsPub.isInt(dataSet25.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet26 = clsCN6.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str13 = ClsPub.isStrNull(dataSet26.Tables[0].Rows[0]["HNumber"]); + text = str13 + num57.ToString() + text43 + "#" + num53; + text1 = str13 + num57.ToString() + text43; + DateTime dateTime12 = ClsPub.isDate(string.Concat(new string[] + { + num50.ToString(), + "-", + num51.ToString(), + "-", + num52.ToString() + })); + DataSet dataSet27 = clsCN6.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag18 = dataSet27.Tables[0].Rows.Count > 0; + if (!flag18) + { + string billCode6 = "85"; + long num59 = ClsPub.CreateBillID_Prod(billCode6, ref ClsPub.sExeReturnInfo); + long num60 = 0L; + clsCN6.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num57.ToString(), + ",", + num58.ToString(), + ",", + num53.ToString(), + ",'", + text43, + "',", + num60.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num53.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime12.ToShortDateString(), + "','", + dateTime11.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num59.ToString(), + ",1,0,0,0,'", + text44, + "','", + text45, + "','',0,'','',1)" + })); + } + } + } + } + bool flag19 = HBillType == "1207"; //WMS 鐩存帴璋冩嫧 + if (flag19) + { + bool flag20 = sBarCodeNew.Contains("@"); + if (flag20) + { + string[] array3 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str14 = array3[0]; + //long num61 = (long)ClsPub.isInt(array3[4]); + Double num61 = ClsPub.isDoule(array3[4]); + string text46 = array3[6]; + DateTime dateTime13 = ClsPub.isDate(array3[3]); + DateTime dateTime14 = ClsPub.isDate(array3[5]); + string text47 = ClsPub.isStrNull(array3[8]); + ClsCN clsCN7 = new ClsCN(); + DataSet dataSet28 = clsCN7.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str15 = ClsPub.isStrNull(dataSet28.Tables[0].Rows[0]["HNumber"]); + + DataSet Dss7; + Dss7 = clsCN7.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str14 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN7.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str14 + "'", "T_BD_MATERIAL"); + str14 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str14 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet29 = clsCN7.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str14 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num62 = ClsPub.isLong(dataSet29.Tables[0].Rows[0]["HItemID"]); + string text48 = ClsPub.isStrNull(dataSet29.Tables[0].Rows[0]["HName"]); + string text49 = ClsPub.isStrNull(dataSet29.Tables[0].Rows[0]["HModel"]); + long num63 = (long)ClsPub.isInt(dataSet29.Tables[0].Rows[0]["HUnitID"]); + + text = str15 + num62.ToString() + text46 + dateTime13.Year.ToString() + dateTime13.Month.ToString() + dateTime13.Day.ToString() + "#" + num61; + text1 = str15 + num62.ToString() + text46 + dateTime13.Year.ToString() + dateTime13.Month.ToString() + dateTime13.Day.ToString(); + DataSet dataSet30 = clsCN7.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag21 = dataSet30.Tables[0].Rows.Count > 0; + if (!flag21) + { + string billCode7 = "85"; + long num64 = ClsPub.CreateBillID_Prod(billCode7, ref ClsPub.sExeReturnInfo); + long num65 = 0L; + clsCN7.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num62.ToString(), + ",", + num63.ToString(), + ",", + num61.ToString(), + ",'", + text46, + "',", + num65.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num61.ToString(), + ", 0,0,'','1207',0, 0,'',0,0,0,'',0,'','','", + dateTime13.ToShortDateString(), + "','", + dateTime14.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num64.ToString(), + ",1,0,0,0,'", + text48, + "','", + text49, + "','',0,'','',1)" + })); + } + } + else + { + string text50 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text51 = text50.Substring(0, 1); + bool flag22 = text51.Contains("W") || text51.Contains("N"); + if (flag22) + { + string text52 = sBarCodeNew.Substring(0, 10); + string str16 = sBarCodeNew.Substring(10, 10); + string text53 = "20" + sBarCodeNew.Substring(20, 6); + long num66 = (long)ClsPub.isInt(text53.Substring(0, 4)); + long num67 = (long)ClsPub.isInt(text53.Substring(4, 2)); + long num68 = (long)ClsPub.isInt(text53.Substring(6, 2)); + long num69 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text54 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text55 = "20" + text54.Substring(0, 6); + long num70 = (long)ClsPub.isInt(text55.Substring(0, 4)); + long num71 = (long)ClsPub.isInt(text55.Substring(4, 2)); + long num72 = (long)ClsPub.isInt(text55.Substring(6, 2)); + DateTime dateTime15 = ClsPub.isDate(string.Concat(new string[] + { + num70.ToString(), + "-", + num71.ToString(), + "-", + num72.ToString() + })); + string text56 = sBarCodeNew.Remove(0, 26); + string text57 = text56.Remove(text56.Length - 10, 10); + ClsCN clsCN8 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN8.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str16 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN8.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str16 + "'", "T_BD_MATERIAL"); + str16 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str16 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet31 = clsCN8.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str16 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num73 = ClsPub.isLong(dataSet31.Tables[0].Rows[0]["HItemID"]); + string text58 = ClsPub.isStrNull(dataSet31.Tables[0].Rows[0]["HName"]); + string text59 = ClsPub.isStrNull(dataSet31.Tables[0].Rows[0]["HModel"]); + long num74 = (long)ClsPub.isInt(dataSet31.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet32 = clsCN8.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str17 = ClsPub.isStrNull(dataSet32.Tables[0].Rows[0]["HNumber"]); + text = str17 + num73.ToString() + text57 + text53 + "#" + num69; + text1 = str17 + num73.ToString() + text57 + text53; + DateTime dateTime16 = ClsPub.isDate(string.Concat(new string[] + { + num66.ToString(), + "-", + num67.ToString(), + "-", + num68.ToString() + })); + DataSet dataSet33 = clsCN8.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag23 = dataSet33.Tables[0].Rows.Count > 0; + if (!flag23) + { + string billCode8 = "85"; + long num75 = ClsPub.CreateBillID_Prod(billCode8, ref ClsPub.sExeReturnInfo); + long num76 = 0L; + clsCN8.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num73.ToString(), + ",", + num74.ToString(), + ",", + num69.ToString(), + ",'", + text57, + "',", + num76.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num69.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime16.ToShortDateString(), + "','", + dateTime15.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num75.ToString(), + ",1,0,0,0,'", + text58, + "','", + text59, + "','',0,'','',1)" + })); + } + } + else + { + string str18 = sBarCodeNew.Substring(0, 10); + string text60 = "20" + sBarCodeNew.Substring(10, 6); + long num77 = (long)ClsPub.isInt(text60.Substring(0, 4)); + long num78 = (long)ClsPub.isInt(text60.Substring(4, 2)); + long num79 = (long)ClsPub.isInt(text60.Substring(6, 2)); + long num80 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text61 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text62 = "20" + text61.Substring(0, 6); + long num81 = (long)ClsPub.isInt(text62.Substring(0, 4)); + long num82 = (long)ClsPub.isInt(text62.Substring(4, 2)); + long num83 = (long)ClsPub.isInt(text62.Substring(6, 2)); + DateTime dateTime17 = ClsPub.isDate(string.Concat(new string[] + { + num81.ToString(), + "-", + num82.ToString(), + "-", + num83.ToString() + })); + string text63 = sBarCodeNew.Remove(0, 16); + string text64 = text63.Remove(text63.Length - 9, 9); + ClsCN clsCN9 = new ClsCN(); + DataSet dataSet34 = clsCN9.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str18 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num84 = ClsPub.isLong(dataSet34.Tables[0].Rows[0]["HItemID"]); + string text65 = ClsPub.isStrNull(dataSet34.Tables[0].Rows[0]["HName"]); + string text66 = ClsPub.isStrNull(dataSet34.Tables[0].Rows[0]["HModel"]); + long num85 = (long)ClsPub.isInt(dataSet34.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet35 = clsCN9.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str19 = ClsPub.isStrNull(dataSet35.Tables[0].Rows[0]["HNumber"]); + text = str19 + num84.ToString() + text64 + text60 + "#" + num80; + text1 = str19 + num84.ToString() + text64 + text60; + DateTime dateTime18 = ClsPub.isDate(string.Concat(new string[] + { + num77.ToString(), + "-", + num78.ToString(), + "-", + num79.ToString() + })); + DataSet dataSet36 = clsCN9.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "' and HProduceDate = '" + dateTime18 + "'", "Gy_BarCodeBill"); + bool flag24 = dataSet36.Tables[0].Rows.Count > 0; + if (!flag24) + { + string billCode9 = "85"; + long num86 = ClsPub.CreateBillID_Prod(billCode9, ref ClsPub.sExeReturnInfo); + long num87 = 0L; + clsCN9.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num84.ToString(), + ",", + num85.ToString(), + ",", + num80.ToString(), + ",'", + text64, + "',", + num87.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num80.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime18.ToShortDateString(), + "','", + dateTime17.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num86.ToString(), + ",1,0,0,0,'", + text65, + "','", + text66, + "','',0,'','',1)" + })); + } + } + } + } + bool flag25 = HBillType == "1206"; //WMS 閿�鍞嚭搴� + if (flag25) + { + bool flag26 = sBarCodeNew.Contains("@"); + if (flag26) + { + string[] array4 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str20 = array4[0]; + long num88 = (long)ClsPub.isInt(array4[4]); + string text67 = array4[6]; + DateTime dateTime19 = ClsPub.isDate(array4[3]); + DateTime dateTime20 = ClsPub.isDate(array4[5]); + string text68 = ClsPub.isStrNull(array4[8]); + ClsCN clsCN10 = new ClsCN(); + DataSet dataSet37 = clsCN10.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str21 = ClsPub.isStrNull(dataSet37.Tables[0].Rows[0]["HNumber"]); + + DataSet Dss7; + Dss7 = clsCN10.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str20 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN10.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str20 + "'", "T_BD_MATERIAL"); + str20 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str20 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet38 = clsCN10.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str20 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num89 = ClsPub.isLong(dataSet38.Tables[0].Rows[0]["HItemID"]); + string text69 = ClsPub.isStrNull(dataSet38.Tables[0].Rows[0]["HName"]); + string text70 = ClsPub.isStrNull(dataSet38.Tables[0].Rows[0]["HModel"]); + long num90 = (long)ClsPub.isInt(dataSet38.Tables[0].Rows[0]["HUnitID"]); + text = str21 + num89.ToString() + text67 + "#" + num88; + text1 = str21 + num89.ToString() + text67; + DataSet dataSet39 = clsCN10.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag27 = dataSet39.Tables[0].Rows.Count > 0; + if (!flag27) + { + string billCode10 = "85"; + long num91 = ClsPub.CreateBillID_Prod(billCode10, ref ClsPub.sExeReturnInfo); + long num92 = 0L; + clsCN10.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num89.ToString(), + ",", + num90.ToString(), + ",", + num88.ToString(), + ",'", + text67, + "',", + num92.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num88.ToString(), + ", 0,0,'','1206',0, 0,'',0,0,0,'',0,'','','", + dateTime19.ToShortDateString(), + "','", + dateTime20.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num91.ToString(), + ",1,0,0,0,'", + text69, + "','", + text70, + "','',0,'','',1)" + })); + } + } + else + { + string text71 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text72 = text71.Substring(0, 1); + bool flag28 = text72.Contains("W") || text72.Contains("N"); + if (flag28) + { + string text73 = sBarCodeNew.Substring(0, 10); + string str22 = sBarCodeNew.Substring(10, 10); + string text74 = "20" + sBarCodeNew.Substring(20, 6); + long num93 = (long)ClsPub.isInt(text74.Substring(0, 4)); + long num94 = (long)ClsPub.isInt(text74.Substring(4, 2)); + long num95 = (long)ClsPub.isInt(text74.Substring(6, 2)); + long num96 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text75 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text76 = "20" + text75.Substring(0, 6); + long num97 = (long)ClsPub.isInt(text76.Substring(0, 4)); + long num98 = (long)ClsPub.isInt(text76.Substring(4, 2)); + long num99 = (long)ClsPub.isInt(text76.Substring(6, 2)); + DateTime dateTime21 = ClsPub.isDate(string.Concat(new string[] + { + num97.ToString(), + "-", + num98.ToString(), + "-", + num99.ToString() + })); + string text77 = sBarCodeNew.Remove(0, 26); + string text78 = text77.Remove(text77.Length - 10, 10); + ClsCN clsCN11 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN11.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str22 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN11.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str22 + "'", "T_BD_MATERIAL"); + str22 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str22 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet40 = clsCN11.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str22 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num100 = ClsPub.isLong(dataSet40.Tables[0].Rows[0]["HItemID"]); + string text79 = ClsPub.isStrNull(dataSet40.Tables[0].Rows[0]["HName"]); + string text80 = ClsPub.isStrNull(dataSet40.Tables[0].Rows[0]["HModel"]); + long num101 = (long)ClsPub.isInt(dataSet40.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet41 = clsCN11.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str23 = ClsPub.isStrNull(dataSet41.Tables[0].Rows[0]["HNumber"]); + text = str23 + num100.ToString() + text78 + "#" + num96; + text1 = str23 + num100.ToString() + text78; + DateTime dateTime22 = ClsPub.isDate(string.Concat(new string[] + { + num93.ToString(), + "-", + num94.ToString(), + "-", + num95.ToString() + })); + DataSet dataSet42 = clsCN11.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag29 = dataSet42.Tables[0].Rows.Count > 0; + if (!flag29) + { + string billCode11 = "85"; + long num102 = ClsPub.CreateBillID_Prod(billCode11, ref ClsPub.sExeReturnInfo); + long num103 = 0L; + clsCN11.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num100.ToString(), + ",", + num101.ToString(), + ",", + num96.ToString(), + ",'", + text78, + "',", + num103.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num96.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime22.ToShortDateString(), + "','", + dateTime21.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num102.ToString(), + ",1,0,0,0,'", + text79, + "','", + text80, + "','',0,'','',1)" + })); + } + } + else + { + string str24 = sBarCodeNew.Substring(0, 10); + string text81 = "20" + sBarCodeNew.Substring(10, 6); + long num104 = (long)ClsPub.isInt(text81.Substring(0, 4)); + long num105 = (long)ClsPub.isInt(text81.Substring(4, 2)); + long num106 = (long)ClsPub.isInt(text81.Substring(6, 2)); + long num107 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text82 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text83 = "20" + text82.Substring(0, 6); + long num108 = (long)ClsPub.isInt(text83.Substring(0, 4)); + long num109 = (long)ClsPub.isInt(text83.Substring(4, 2)); + long num110 = (long)ClsPub.isInt(text83.Substring(6, 2)); + DateTime dateTime23 = ClsPub.isDate(string.Concat(new string[] + { + num108.ToString(), + "-", + num109.ToString(), + "-", + num110.ToString() + })); + string text84 = sBarCodeNew.Remove(0, 16); + string text85 = text84.Remove(text84.Length - 9, 9); + ClsCN clsCN12 = new ClsCN(); + + + DataSet Dss7; + Dss7 = clsCN12.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str24 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN12.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str24 + "'", "T_BD_MATERIAL"); + str24 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str24 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + + DataSet dataSet43 = clsCN12.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str24 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num111 = ClsPub.isLong(dataSet43.Tables[0].Rows[0]["HItemID"]); + string text86 = ClsPub.isStrNull(dataSet43.Tables[0].Rows[0]["HName"]); + string text87 = ClsPub.isStrNull(dataSet43.Tables[0].Rows[0]["HModel"]); + long num112 = (long)ClsPub.isInt(dataSet43.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet44 = clsCN12.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str25 = ClsPub.isStrNull(dataSet44.Tables[0].Rows[0]["HNumber"]); + text = str25 + num111.ToString() + text85 + "#" + num107; + text1 = str25 + num111.ToString() + text85; + DateTime dateTime24 = ClsPub.isDate(string.Concat(new string[] + { + num104.ToString(), + "-", + num105.ToString(), + "-", + num106.ToString() + })); + DataSet dataSet45 = clsCN12.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag30 = dataSet45.Tables[0].Rows.Count > 0; + if (!flag30) + { + string billCode12 = "85"; + long num113 = ClsPub.CreateBillID_Prod(billCode12, ref ClsPub.sExeReturnInfo); + long num114 = 0L; + clsCN12.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num111.ToString(), + ",", + num112.ToString(), + ",", + num107.ToString(), + ",'", + text85, + "',", + num114.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num107.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime24.ToShortDateString(), + "','", + dateTime23.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num113.ToString(), + ",1,0,0,0,'", + text86, + "','", + text87, + "','',0,'','',1)" + })); + } + } + } + } + bool flag31 = HBillType == "1204"; //WMS 鐢熶骇棰嗘枡 + if (flag31) + { + bool flag32 = sBarCodeNew.Contains("@"); + if (flag32) + { + string[] array5 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str26 = array5[0]; + long num115 = (long)ClsPub.isInt(array5[4]); + string text88 = array5[6]; + DateTime dateTime25 = ClsPub.isDate(array5[3]); + DateTime dateTime26 = ClsPub.isDate(array5[5]); + string text89 = ClsPub.isStrNull(array5[8]); + ClsCN clsCN13 = new ClsCN(); + DataSet dataSet46 = clsCN13.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str27 = ClsPub.isStrNull(dataSet46.Tables[0].Rows[0]["HNumber"]); + + + DataSet Dss7; + Dss7 = clsCN13.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str26 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN13.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str26 + "'", "T_BD_MATERIAL"); + str26 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str26 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet47 = clsCN13.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str26 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num116 = ClsPub.isLong(dataSet47.Tables[0].Rows[0]["HItemID"]); + string text90 = ClsPub.isStrNull(dataSet47.Tables[0].Rows[0]["HName"]); + string text91 = ClsPub.isStrNull(dataSet47.Tables[0].Rows[0]["HModel"]); + long num117 = (long)ClsPub.isInt(dataSet47.Tables[0].Rows[0]["HUnitID"]); + text = str27 + num116.ToString() + text88 + "#" + num115; + text1 = str27 + num116.ToString() + text88; + DataSet dataSet48 = clsCN13.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag33 = dataSet48.Tables[0].Rows.Count > 0; + if (!flag33) + { + string billCode13 = "85"; + long num118 = ClsPub.CreateBillID_Prod(billCode13, ref ClsPub.sExeReturnInfo); + long num119 = 0L; + clsCN13.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num116.ToString(), + ",", + num117.ToString(), + ",", + num115.ToString(), + ",'", + text88, + "',", + num119.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num115.ToString(), + ", 0,0,'','1103',0, 0,'',0,0,0,'',0,'','','", + dateTime25.ToShortDateString(), + "','", + dateTime26.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num118.ToString(), + ",1,0,0,0,'", + text90, + "','", + text91, + "','',0,'','',1)" + })); + } + } + else + { + string text92 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text93 = text92.Substring(0, 1); + bool flag34 = text93.Contains("W") || text93.Contains("N"); + if (flag34) + { + string text94 = sBarCodeNew.Substring(0, 10); + string str28 = sBarCodeNew.Substring(10, 10); + string text95 = "20" + sBarCodeNew.Substring(20, 6); + long num120 = (long)ClsPub.isInt(text95.Substring(0, 4)); + long num121 = (long)ClsPub.isInt(text95.Substring(4, 2)); + long num122 = (long)ClsPub.isInt(text95.Substring(6, 2)); + long num123 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text96 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text97 = "20" + text96.Substring(0, 6); + long num124 = (long)ClsPub.isInt(text97.Substring(0, 4)); + long num125 = (long)ClsPub.isInt(text97.Substring(4, 2)); + long num126 = (long)ClsPub.isInt(text97.Substring(6, 2)); + DateTime dateTime27 = ClsPub.isDate(string.Concat(new string[] + { + num124.ToString(), + "-", + num125.ToString(), + "-", + num126.ToString() + })); + string text98 = sBarCodeNew.Remove(0, 26); + string text99 = text98.Remove(text98.Length - 10, 10); + ClsCN clsCN14 = new ClsCN(); + + + DataSet Dss7; + Dss7 = clsCN14.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str28 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN14.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str28 + "'", "T_BD_MATERIAL"); + str28 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str28 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + + DataSet dataSet49 = clsCN14.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str28 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num127 = ClsPub.isLong(dataSet49.Tables[0].Rows[0]["HItemID"]); + string text100 = ClsPub.isStrNull(dataSet49.Tables[0].Rows[0]["HName"]); + string text101 = ClsPub.isStrNull(dataSet49.Tables[0].Rows[0]["HModel"]); + long num128 = (long)ClsPub.isInt(dataSet49.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet50 = clsCN14.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str29 = ClsPub.isStrNull(dataSet50.Tables[0].Rows[0]["HNumber"]); + text = str29 + num127.ToString() + text99 + "#" + num123; + text1 = str29 + num127.ToString() + text99; + DateTime dateTime28 = ClsPub.isDate(string.Concat(new string[] + { + num120.ToString(), + "-", + num121.ToString(), + "-", + num122.ToString() + })); + DataSet dataSet51 = clsCN14.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag35 = dataSet51.Tables[0].Rows.Count > 0; + if (!flag35) + { + string billCode14 = "85"; + long num129 = ClsPub.CreateBillID_Prod(billCode14, ref ClsPub.sExeReturnInfo); + long num130 = 0L; + clsCN14.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num127.ToString(), + ",", + num128.ToString(), + ",", + num123.ToString(), + ",'", + text99, + "',", + num130.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num123.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime28.ToShortDateString(), + "','", + dateTime27.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num129.ToString(), + ",1,0,0,0,'", + text100, + "','", + text101, + "','',0,'','',1)" + })); + } + } + else + { + string str30 = sBarCodeNew.Substring(0, 10); + string text102 = "20" + sBarCodeNew.Substring(10, 6); + long num131 = (long)ClsPub.isInt(text102.Substring(0, 4)); + long num132 = (long)ClsPub.isInt(text102.Substring(4, 2)); + long num133 = (long)ClsPub.isInt(text102.Substring(6, 2)); + long num134 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text103 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text104 = "20" + text103.Substring(0, 6); + long num135 = (long)ClsPub.isInt(text104.Substring(0, 4)); + long num136 = (long)ClsPub.isInt(text104.Substring(4, 2)); + long num137 = (long)ClsPub.isInt(text104.Substring(6, 2)); + DateTime dateTime29 = ClsPub.isDate(string.Concat(new string[] + { + num135.ToString(), + "-", + num136.ToString(), + "-", + num137.ToString() + })); + string text105 = sBarCodeNew.Remove(0, 16); + string text106 = text105.Remove(text105.Length - 9, 9); + ClsCN clsCN15 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN15.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str30 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN15.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str30 + "'", "T_BD_MATERIAL"); + str30 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str30 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet52 = clsCN15.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str30 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num138 = ClsPub.isLong(dataSet52.Tables[0].Rows[0]["HItemID"]); + string text107 = ClsPub.isStrNull(dataSet52.Tables[0].Rows[0]["HName"]); + string text108 = ClsPub.isStrNull(dataSet52.Tables[0].Rows[0]["HModel"]); + long num139 = (long)ClsPub.isInt(dataSet52.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet53 = clsCN15.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str31 = ClsPub.isStrNull(dataSet53.Tables[0].Rows[0]["HNumber"]); + text = str31 + num138.ToString() + text106 + "#" + num134; + text1 = str31 + num138.ToString() + text106; + DateTime dateTime30 = ClsPub.isDate(string.Concat(new string[] + { + num131.ToString(), + "-", + num132.ToString(), + "-", + num133.ToString() + })); + DataSet dataSet54 = clsCN15.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag36 = dataSet54.Tables[0].Rows.Count > 0; + if (!flag36) + { + string billCode15 = "85"; + long num140 = ClsPub.CreateBillID_Prod(billCode15, ref ClsPub.sExeReturnInfo); + long num141 = 0L; + clsCN15.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num138.ToString(), + ",", + num139.ToString(), + ",", + num134.ToString(), + ",'", + text106, + "',", + num141.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num134.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime30.ToShortDateString(), + "','", + dateTime29.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num140.ToString(), + ",1,0,0,0,'", + text107, + "','", + text108, + "','',0,'','',1)" + })); + } + } + } + } + bool flag37 = HBillType == "1254" /*鐢熶骇琛ユ枡*/ || HBillType == "1211" || HBillType == "1255"; + if (flag37) + { + bool flag38 = sBarCodeNew.Contains("@"); + if (flag38) + { + string[] array6 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str32 = array6[0]; + long num142 = (long)ClsPub.isInt(array6[4]); + string text109 = array6[6]; + DateTime dateTime31 = ClsPub.isDate(array6[3]); + DateTime dateTime32 = ClsPub.isDate(array6[5]); + string text110 = ClsPub.isStrNull(array6[8]); + ClsCN clsCN16 = new ClsCN(); + DataSet dataSet55 = clsCN16.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str33 = ClsPub.isStrNull(dataSet55.Tables[0].Rows[0]["HNumber"]); + + + DataSet Dss7; + Dss7 = clsCN16.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str32 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN16.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str32 + "'", "T_BD_MATERIAL"); + str32 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str32 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet56 = clsCN16.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str32 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num143 = ClsPub.isLong(dataSet56.Tables[0].Rows[0]["HItemID"]); + string text111 = ClsPub.isStrNull(dataSet56.Tables[0].Rows[0]["HName"]); + string text112 = ClsPub.isStrNull(dataSet56.Tables[0].Rows[0]["HModel"]); + long num144 = (long)ClsPub.isInt(dataSet56.Tables[0].Rows[0]["HUnitID"]); + text = str33 + num143.ToString() + text109 + "#" + num142; + text1 = str33 + num143.ToString() + text109; + DataSet dataSet57 = clsCN16.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag39 = dataSet57.Tables[0].Rows.Count > 0; + if (!flag39) + { + string billCode16 = "85"; + long num145 = ClsPub.CreateBillID_Prod(billCode16, ref ClsPub.sExeReturnInfo); + long num146 = 0L; + clsCN16.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num143.ToString(), + ",", + num144.ToString(), + ",", + num142.ToString(), + ",'", + text109, + "',", + num146.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num142.ToString(), + ", 0,0,'','1103',0, 0,'',0,0,0,'',0,'','','", + dateTime31.ToShortDateString(), + "','", + dateTime32.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num145.ToString(), + ",1,0,0,0,'", + text111, + "','", + text112, + "','',0,'','',1)" + })); + } + } + else + { + string text113 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text114 = text113.Substring(0, 1); + bool flag40 = text114.Contains("W") || text114.Contains("N"); + if (flag40) + { + string text115 = sBarCodeNew.Substring(0, 10); + string str34 = sBarCodeNew.Substring(10, 10); + string text116 = "20" + sBarCodeNew.Substring(20, 6); + long num147 = (long)ClsPub.isInt(text116.Substring(0, 4)); + long num148 = (long)ClsPub.isInt(text116.Substring(4, 2)); + long num149 = (long)ClsPub.isInt(text116.Substring(6, 2)); + long num150 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text117 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text118 = "20" + text117.Substring(0, 6); + long num151 = (long)ClsPub.isInt(text118.Substring(0, 4)); + long num152 = (long)ClsPub.isInt(text118.Substring(4, 2)); + long num153 = (long)ClsPub.isInt(text118.Substring(6, 2)); + DateTime dateTime33 = ClsPub.isDate(string.Concat(new string[] + { + num151.ToString(), + "-", + num152.ToString(), + "-", + num153.ToString() + })); + string text119 = sBarCodeNew.Remove(0, 26); + string text120 = text119.Remove(text119.Length - 10, 10); + ClsCN clsCN17 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN17.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str34 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN17.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str34 + "'", "T_BD_MATERIAL"); + str34 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str34 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet58 = clsCN17.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str34 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num154 = ClsPub.isLong(dataSet58.Tables[0].Rows[0]["HItemID"]); + string text121 = ClsPub.isStrNull(dataSet58.Tables[0].Rows[0]["HName"]); + string text122 = ClsPub.isStrNull(dataSet58.Tables[0].Rows[0]["HModel"]); + long num155 = (long)ClsPub.isInt(dataSet58.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet59 = clsCN17.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str35 = ClsPub.isStrNull(dataSet59.Tables[0].Rows[0]["HNumber"]); + text = str35 + num154.ToString() + text120 + "#" + num150; + text1 = str35 + num154.ToString() + text120; + DateTime dateTime34 = ClsPub.isDate(string.Concat(new string[] + { + num147.ToString(), + "-", + num148.ToString(), + "-", + num149.ToString() + })); + DataSet dataSet60 = clsCN17.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag41 = dataSet60.Tables[0].Rows.Count > 0; + if (!flag41) + { + string billCode17 = "85"; + long num156 = ClsPub.CreateBillID_Prod(billCode17, ref ClsPub.sExeReturnInfo); + long num157 = 0L; + clsCN17.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num154.ToString(), + ",", + num155.ToString(), + ",", + num150.ToString(), + ",'", + text120, + "',", + num157.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num150.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime34.ToShortDateString(), + "','", + dateTime33.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num156.ToString(), + ",1,0,0,0,'", + text121, + "','", + text122, + "','',0,'','',1)" + })); + } + } + else + { + string str36 = sBarCodeNew.Substring(0, 10); + string text123 = "20" + sBarCodeNew.Substring(10, 6); + long num158 = (long)ClsPub.isInt(text123.Substring(0, 4)); + long num159 = (long)ClsPub.isInt(text123.Substring(4, 2)); + long num160 = (long)ClsPub.isInt(text123.Substring(6, 2)); + long num161 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text124 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text125 = "20" + text124.Substring(0, 6); + long num162 = (long)ClsPub.isInt(text125.Substring(0, 4)); + long num163 = (long)ClsPub.isInt(text125.Substring(4, 2)); + long num164 = (long)ClsPub.isInt(text125.Substring(6, 2)); + DateTime dateTime35 = ClsPub.isDate(string.Concat(new string[] + { + num162.ToString(), + "-", + num163.ToString(), + "-", + num164.ToString() + })); + string text126 = sBarCodeNew.Remove(0, 16); + string text127 = text126.Remove(text126.Length - 9, 9); + ClsCN clsCN18 = new ClsCN(); + + + DataSet Dss7; + Dss7 = clsCN18.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str36 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN18.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str36 + "'", "T_BD_MATERIAL"); + str36 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str36 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet61 = clsCN18.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str36 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num165 = ClsPub.isLong(dataSet61.Tables[0].Rows[0]["HItemID"]); + string text128 = ClsPub.isStrNull(dataSet61.Tables[0].Rows[0]["HName"]); + string text129 = ClsPub.isStrNull(dataSet61.Tables[0].Rows[0]["HModel"]); + long num166 = (long)ClsPub.isInt(dataSet61.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet62 = clsCN18.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str37 = ClsPub.isStrNull(dataSet62.Tables[0].Rows[0]["HNumber"]); + text = str37 + num165.ToString() + text127 + "#" + num161; + text1 = str37 + num165.ToString() + text127; + DateTime dateTime36 = ClsPub.isDate(string.Concat(new string[] + { + num158.ToString(), + "-", + num159.ToString(), + "-", + num160.ToString() + })); + DataSet dataSet63 = clsCN18.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag42 = dataSet63.Tables[0].Rows.Count > 0; + if (!flag42) + { + string billCode18 = "85"; + long num167 = ClsPub.CreateBillID_Prod(billCode18, ref ClsPub.sExeReturnInfo); + long num168 = 0L; + clsCN18.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num165.ToString(), + ",", + num166.ToString(), + ",", + num161.ToString(), + ",'", + text127, + "',", + num168.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num161.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime36.ToShortDateString(), + "','", + dateTime35.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num167.ToString(), + ",1,0,0,0,'", + text128, + "','", + text129, + "','',0,'','',1)" + })); + } + } + } + } + bool flag43 = HBillType == "1205"; + if (flag43) + { + bool flag44 = sBarCodeNew.Contains("@"); + if (flag44) + { + string[] array7 = sBarCodeNew.Split(new char[] + { + '@' + }); + string str38 = array7[0]; + long num169 = (long)ClsPub.isInt(array7[4]); + string text130 = array7[6]; + DateTime dateTime37 = ClsPub.isDate(array7[3]); + DateTime dateTime38 = ClsPub.isDate(array7[5]); + string text131 = ClsPub.isStrNull(array7[8]); + ClsCN clsCN19 = new ClsCN(); + DataSet dataSet64 = clsCN19.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str39 = ClsPub.isStrNull(dataSet64.Tables[0].Rows[0]["HNumber"]); + + DataSet Dss7; + Dss7 = clsCN19.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str38 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN19.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str38 + "'", "T_BD_MATERIAL"); + str38 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str38 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet65 = clsCN19.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str38 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num170 = ClsPub.isLong(dataSet65.Tables[0].Rows[0]["HItemID"]); + string text132 = ClsPub.isStrNull(dataSet65.Tables[0].Rows[0]["HName"]); + string text133 = ClsPub.isStrNull(dataSet65.Tables[0].Rows[0]["HModel"]); + long num171 = (long)ClsPub.isInt(dataSet65.Tables[0].Rows[0]["HUnitID"]); + text = str39 + num170.ToString() + text130 + "#" + num169; + text1 = str39 + num170.ToString() + text130; + DataSet dataSet66 = clsCN19.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag45 = dataSet66.Tables[0].Rows.Count > 0; + if (!flag45) + { + string billCode19 = "85"; + long num172 = ClsPub.CreateBillID_Prod(billCode19, ref ClsPub.sExeReturnInfo); + long num173 = 0L; + clsCN19.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num170.ToString(), + ",", + num171.ToString(), + ",", + num169.ToString(), + ",'", + text130, + "',", + num173.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num169.ToString(), + ", 0,0,'','1103',0, 0,'',0,0,0,'',0,'','','", + dateTime37.ToShortDateString(), + "','", + dateTime38.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num172.ToString(), + ",1,0,0,0,'", + text132, + "','", + text133, + "','',0,'','',1)" + })); + } + } + else + { + string text134 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); + string text135 = text134.Substring(0, 1); + bool flag46 = text135.Contains("W") || text135.Contains("N"); + if (flag46) + { + string text136 = sBarCodeNew.Substring(0, 10); + string str40 = sBarCodeNew.Substring(10, 10); + string text137 = "20" + sBarCodeNew.Substring(20, 6); + long num174 = (long)ClsPub.isInt(text137.Substring(0, 4)); + long num175 = (long)ClsPub.isInt(text137.Substring(4, 2)); + long num176 = (long)ClsPub.isInt(text137.Substring(6, 2)); + long num177 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text138 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 10); + string text139 = "20" + text138.Substring(0, 6); + long num178 = (long)ClsPub.isInt(text139.Substring(0, 4)); + long num179 = (long)ClsPub.isInt(text139.Substring(4, 2)); + long num180 = (long)ClsPub.isInt(text139.Substring(6, 2)); + DateTime dateTime39 = ClsPub.isDate(string.Concat(new string[] + { + num178.ToString(), + "-", + num179.ToString(), + "-", + num180.ToString() + })); + string text140 = sBarCodeNew.Remove(0, 26); + string text141 = text140.Remove(text140.Length - 10, 10); + ClsCN clsCN20 = new ClsCN(); + + DataSet Dss7; + Dss7 = clsCN20.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str40 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN20.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str40 + "'", "T_BD_MATERIAL"); + str40 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str40 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet67 = clsCN20.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str40 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num181 = ClsPub.isLong(dataSet67.Tables[0].Rows[0]["HItemID"]); + string text142 = ClsPub.isStrNull(dataSet67.Tables[0].Rows[0]["HName"]); + string text143 = ClsPub.isStrNull(dataSet67.Tables[0].Rows[0]["HModel"]); + long num182 = (long)ClsPub.isInt(dataSet67.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet68 = clsCN20.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str41 = ClsPub.isStrNull(dataSet68.Tables[0].Rows[0]["HNumber"]); + text = str41 + num181.ToString() + text141 + "#" + num177; + text1 = str41 + num181.ToString() + text141; + DateTime dateTime40 = ClsPub.isDate(string.Concat(new string[] + { + num174.ToString(), + "-", + num175.ToString(), + "-", + num176.ToString() + })); + DataSet dataSet69 = clsCN20.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag47 = dataSet69.Tables[0].Rows.Count > 0; + if (!flag47) + { + string billCode20 = "85"; + long num183 = ClsPub.CreateBillID_Prod(billCode20, ref ClsPub.sExeReturnInfo); + long num184 = 0L; + clsCN20.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num181.ToString(), + ",", + num182.ToString(), + ",", + num177.ToString(), + ",'", + text141, + "',", + num184.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num177.ToString(), + ", 0,0,'','',0, 0,'',0,0,0,'',0,'','','", + dateTime40.ToShortDateString(), + "','", + dateTime39.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num183.ToString(), + ",1,0,0,0,'", + text142, + "','", + text143, + "','',0,'','',1)" + })); + } + } + else + { + string str42 = sBarCodeNew.Substring(0, 10); + string text144 = "20" + sBarCodeNew.Substring(10, 6); + long num185 = (long)ClsPub.isInt(text144.Substring(0, 4)); + long num186 = (long)ClsPub.isInt(text144.Substring(4, 2)); + long num187 = (long)ClsPub.isInt(text144.Substring(6, 2)); + long num188 = (long)ClsPub.isInt(sBarCodeNew.Remove(0, sBarCodeNew.Length - 3)); + string text145 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 9); + string text146 = "20" + text145.Substring(0, 6); + long num189 = (long)ClsPub.isInt(text146.Substring(0, 4)); + long num190 = (long)ClsPub.isInt(text146.Substring(4, 2)); + long num191 = (long)ClsPub.isInt(text146.Substring(6, 2)); + DateTime dateTime41 = ClsPub.isDate(string.Concat(new string[] + { + num189.ToString(), + "-", + num190.ToString(), + "-", + num191.ToString() + })); + string text147 = sBarCodeNew.Remove(0, 16); + string text148 = text147.Remove(text147.Length - 9, 9); + ClsCN clsCN21 = new ClsCN(); + + + DataSet Dss7; + Dss7 = clsCN21.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + str42 + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = clsCN21.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + str42 + "'", "T_BD_MATERIAL"); + str42 = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + str42 = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet70 = clsCN21.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + str42 + "' and huseorgid = " + HOrgID.ToString(), "Gy_Material"); + long num192 = ClsPub.isLong(dataSet70.Tables[0].Rows[0]["HItemID"]); + string text149 = ClsPub.isStrNull(dataSet70.Tables[0].Rows[0]["HName"]); + string text150 = ClsPub.isStrNull(dataSet70.Tables[0].Rows[0]["HModel"]); + long num193 = (long)ClsPub.isInt(dataSet70.Tables[0].Rows[0]["HUnitID"]); + DataSet dataSet71 = clsCN21.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID.ToString(), "h_v_CLD_ORGANIZATIONSList"); + string str43 = ClsPub.isStrNull(dataSet71.Tables[0].Rows[0]["HNumber"]); + text = str43 + num192.ToString() + text148 + "#" + num188; + text1 = str43 + num192.ToString() + text148; + DateTime dateTime42 = ClsPub.isDate(string.Concat(new string[] + { + num185.ToString(), + "-", + num186.ToString(), + "-", + num187.ToString() + })); + DataSet dataSet72 = clsCN21.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); + bool flag48 = dataSet72.Tables[0].Rows.Count > 0; + if (!flag48) + { + string billCode21 = "85"; + long num194 = ClsPub.CreateBillID_Prod(billCode21, ref ClsPub.sExeReturnInfo); + long num195 = 0L; + clsCN21.RunProc(string.Concat(new string[] + { + "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty ,HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark ,HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate ,HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID ,HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID ,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag ) values ('", + text1, + "','鎵规鏉$爜',", + num192.ToString(), + ",", + num193.ToString(), + ",", + num188.ToString(), + ",'", + text148, + "',", + num195.ToString(), + ",0,'", + ClsPub.CurUserName, + "',getdate(),0,", + num188.ToString(), + ", 0,0,'','3714',0, 0,'',0,0,0,'',0,'','','", + dateTime42.ToShortDateString(), + "','", + dateTime41.ToShortDateString(), + "','',getdate(), ", + HOrgID.ToString(), + ",", + HOrgID.ToString(), + ",'',", + num194.ToString(), + ",1,0,0,0,'", + text149, + "','", + text150, + "','',0,'','',1)" + })); + } + } + } + } + result = text; + } + catch (Exception ex) + { + result = ex.Message + ";" + ex.StackTrace; + } + return result; + } + + + + + + + /// <summary> /// 涓�閿壂鐮佺孩瀛� /// </summary> @@ -113,7 +3140,7 @@ { HBillType = "1239"; } - oBar = webserver.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID,sExpressNumber, ref DBUtility.ClsPub.sErrInfo); + oBar = webserver.get_CheckTypeByBarCode_All(sCode, sInterID, HBillType, sBillNo, sMaker, WhID, SPID, sQty, sRedBlue, SourceFlag, sSourceBillNo, sSourceType, HOWNERID, sExpressNumber, ref DBUtility.ClsPub.sErrInfo); if (oBar == null) { objJsonResult.code = "0"; @@ -168,16 +3195,16 @@ objJsonResult.count = 0; objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + HSourceBillType; objJsonResult.data = null; - return objJsonResult; + return objJsonResult; } else - { + { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; objJsonResult.data = ds.Tables[0]; return objJsonResult; - + } } catch (Exception ex) @@ -199,12 +3226,12 @@ /// <returns></returns> [Route("POStockInBill/set_SavePonderationBillMain_Temp_Source_Fast_Json")] [HttpGet] - public object set_SavePonderationBillMain_Temp_Source_Fast_Json(string HSourceBillType,string HSourceBillNo, Int64 sInterID, string sBillNo) + public object set_SavePonderationBillMain_Temp_Source_Fast_Json(string HSourceBillType, string HSourceBillNo, Int64 sInterID, string sBillNo) { try { - // DataSet ds = new DataSet(); - // WebServer webserver = new WebServer(); + // DataSet ds = new DataSet(); + // WebServer webserver = new WebServer(); string sWhere = " Where 鍗曟嵁鍙� like '%" + HSourceBillNo.Trim() + "'"; //鏍规嵁婧愬崟绫诲瀷鏉ヨ皟鐢ㄤ笉鍚岀殑WEBS鏂规硶 new if (HSourceBillType == "1102") @@ -213,7 +3240,7 @@ } else if (HSourceBillType == "1103") { - ds = webserver.GetCg_PoInStockBillList(sWhere + " and isnull(HBillSubType,0)=12510 "); + ds = webserver.GetCg_PoInStockBillList(sWhere + ""); } else { @@ -259,14 +3286,356 @@ } catch (Exception ex) { - + objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"+ex.ToString(); + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } + + + + /// <summary> + /// 鍐欏叆涓存椂琛� 鎵簮鍗曠殑鏂规硶 + /// </summary> + /// <param name="HSourceBillNo"></param> + /// <returns></returns> + [Route("ICMOReportBill/set_SavePonderationBillMain_Temp_Source_Fast_Json_New")] + [HttpGet] + public object set_SavePonderationBillMain_Temp_Source_Fast_Json_New(string HSourceBillType, string HSourceBillNo, Int64 sInterID, string sBillNo) + { + try + { + LogService.Write("鎵ц鎴愬姛!"); + // DataSet ds = new DataSet(); + // WebServer webserver = new WebServer(); + string sWhere = " Where 鍗曟嵁鍙� like '%" + HSourceBillNo.Trim() + "'"; + //鏍规嵁婧愬崟绫诲瀷鏉ヨ皟鐢ㄤ笉鍚岀殑WEBS鏂规硶 new + if (HSourceBillType == "3710") + { + ds = webserver.GetSc_ICMOBillList(sWhere + " "); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍,婧愬崟绫诲瀷鏈夐敊璇紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + // + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + HSourceBillType; + objJsonResult.data = null; + return objJsonResult; + //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); + } + else + { + HDeptID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HDeptID"]); + HDeptName = Convert.ToString(ds.Tables[0].Rows[0]["HDeptName"]); + if (webserver.set_SavePonderationBillMain_Temp_Source_Fast(sInterID, sBillNo, "3711", HSourceBillNo, HSourceBillType, "钃濆瓧", ref DBUtility.ClsPub.sErrInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍐欏叆涓存椂琛ㄥけ璐ワ紒" + DBUtility.ClsPub.sErrInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + catch (Exception ex) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + + + + + + [Route("Kf_QCStockInCheckBill_Fast/BarCode_Json")] + [HttpGet] + public object BarCode_Json(string HBarCode,Int64 HOrgID) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //string[] sArray = HBarCode.Split('@'); + //string HMaterNumber = ""; + //HMaterNumber = sArray[0]; + + ////閲囪喘璁㈠崟鍙� + //string HPOOrderBillNo = ""; + //HPOOrderBillNo = ClsPub.isStrNull(sArray[8]); + + + + //Int64 HMaterID = 0; + + + //DataSet Dss1; + //Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + //HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + + + ////鏍规嵁鐗╂枡 + 鎵规 + 閲囪喘璁㈠崟鍙� 鎵惧埌瀵瑰簲鐨勬敹鏂欓�氱煡鍗曞彿 + //DataSet Dss2; + //Dss2 = oCn.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FSRCBILLNO= '" + HPOOrderBillNo + "' and FMATERIALID = " + HMaterID, "h_v_RECEIVEQuery"); + //HMaterID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["FMATERIALID"]); + //string HSourceBillNo = Pub_Class.ClsPub.isStrNull(Dss2.Tables[0].Rows[0]["FBILLNO"]); + + + string HTM = ""; + string[] sArray = HBarCode.Split('@'); + string HMaterNumber = ""; + HMaterNumber = sArray[0]; + Int64 HQty = 0; + HQty = ClsPub.isInt(sArray[4]); + string HBarchNo = ""; + HBarchNo = sArray[6]; + + DateTime HSCRQ = ClsPub.isDate(sArray[3]); + DateTime HYXQZ = ClsPub.isDate(sArray[5]); + + //閲囪喘璁㈠崟鍙� + string HPOOrderBillNo = ""; + HPOOrderBillNo = ClsPub.isStrNull(sArray[8]); + + + + Int64 HMaterID = 0; + + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DataSet Dss; + Dss = oCn.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList"); + string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]); + + DataSet Dss1; + Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + + + HTM = HOrgNumber + HMaterID + HBarchNo; + + //濡傛灉鏉$爜妗f涓嶅瓨鍦� 杩涜瀛樺叆鏉$爜妗f鐨勫姩浣� + //鏍规嵁鐗╂枡 + 鎵规 + 閲囪喘璁㈠崟鍙� 鎵惧埌瀵瑰簲鐨勬敹鏂欓�氱煡鍗曞彿 + DataSet Dss2; + Dss2 = oCn.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FSRCBILLNO= '" + HPOOrderBillNo + "' and FMATERIALID = " + HMaterID, "h_v_RECEIVEQuery"); + HMaterID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["FMATERIALID"]); + Int64 HSourceInterID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["fid"]); + Int64 HSourceEntryID = Pub_Class.ClsPub.isLong(Dss2.Tables[0].Rows[0]["FENTRYID"]); + string HSourceBillNo = Pub_Class.ClsPub.isStrNull(Dss2.Tables[0].Rows[0]["FBILLNO"]); + //鍒ゆ柇鏉$爜妗f鏄惁瀛樺湪璇ユ潯鐮� + //濡傛灉瀛樺湪 鍐嶅垽鏂壂鐮佷复鏃惰〃鏄惁瀛樺湪璇ユ潯鐮� + //濡傛灉涓嶅瓨鍦� 杩涜鎵簮鍗曠殑鏂规硶 + DataSet Dss5; + Dss5 = oCn.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill"); + if (Dss5.Tables[0].Rows.Count > 0) + { + DataSet ds; + ds = oCN.RunProcReturn("select * from h_v_QCStockInCheckBill_Json where HSourceBillNo ='" + HSourceBillNo.ToString() + "'", "h_v_QCStockInCheckBill_Json"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + else + { + + + + string ModName = "85"; + var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); + Int64 HSupID = 0; + oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + + ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + + ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + + ",HCusID,HCusType,HEndDate,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " + + ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + + ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + + ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " + + ") values (" + + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() + + ",'" + HBarchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString() + + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo.ToString() + "','1103',0" + + ", 0,'',0,0,0,''" + + ",0,'','','" + HSCRQ.ToShortDateString() + "','" + HYXQZ.ToShortDateString() + "','',getdate()" + + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1" + + ",0,0,0" + + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)"); + DataSet ds; + ds = oCN.RunProcReturn("select * from h_v_QCStockInCheckBill_Json where HSourceBillNo ='" + HSourceBillNo.ToString() + "'", "h_v_QCStockInCheckBill_Json"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("select * from h_v_QCStockInCheckBill_Json where 鏉$爜缂栧彿 ='" + HBarCode.ToString() + "'", "h_v_QCStockInCheckBill_Json"); + + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + + [Route("Kf_SCStockInCheckBill_Fast/BarCode_Json1")] + [HttpGet] + public object BarCode_Json1(string HBarCode,Int64 HOrgID) + { + try + { + string HMaterNumber = ""; + string HSCRQ = ""; + string HFour = HBarCode.Remove(0, HBarCode.Length - 4); + string HZM = HFour.Substring(0, 1); + string HBatchNo_Old = ""; + string HBatchNo = ""; + Int64 Year = 0; + Int64 Month = 0; + Int64 Day = 0; + if (HZM.Contains("W") || HZM.Contains("N")) + { + string HOldNumber = HBarCode.Substring(0, 10); //鍟嗗搧鐮� 涓嶆槸鐗╂枡缂栫爜 + HMaterNumber = HBarCode.Substring(10, 10); //鐗╂枡缂栫爜 + HSCRQ = "20" + HBarCode.Substring(20, 6); //鐢熶骇鏃ユ湡 + Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); //骞� + Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); //鏈� + Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); //鏃� + HBatchNo_Old = HBarCode.Remove(0, 26); + HBatchNo = HBatchNo_Old.Remove(HBatchNo_Old.Length - 10, 10); + } + else + { + HMaterNumber = HBarCode.Substring(0,10); + HSCRQ = "20" + HBarCode.Substring(10, 6); //鐢熶骇鏃ユ湡 + Year = ClsPub.isInt(HSCRQ.Substring(0, 4)); //骞� + Month = ClsPub.isInt(HSCRQ.Substring(4, 2)); //鏈� + Day = ClsPub.isInt(HSCRQ.Substring(6, 2)); //鏃� + HBatchNo_Old = HBarCode.Remove(0, 16); + HBatchNo = HBatchNo_Old.Remove(HBatchNo_Old.Length - 9, 9); + } + + + + + //鏍规嵁鎷嗗垎鐨勭墿鏂橧D + 鎵规 + 鐢熶骇鏃ユ湡 鑳芥壘鍒板敮涓�鐨勫伐搴忔眹鎶ュ崟 + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + Int64 HMaterID = 0; + DataSet Dss1; + Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and huseorgid = " + HOrgID, "Gy_Material"); + HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]); + string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]); + string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]); + Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]); + + + //DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day); + + + + //Int64 HQty = 0; + //HQty = ClsPub.isInt(HBarCode.Substring(33, 3)); + + + ds = oCN.RunProcReturn("select * from h_v_SCStockInCheckBill_Json where HYear =" + Year.ToString() + "and HMonth = " + Month.ToString() + "and HDay = " + Day.ToString() + " and HMaterID = " + HMaterID.ToString() + "and 鎵规 = '" + HBatchNo.ToString() + "'", "h_v_SCStockInCheckBill_Json"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + //DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + + + + + + + /// <summary> /// 杩斿洖鍑哄叆搴撴潯鐮佷复鏃惰〃 /// </summary> @@ -299,12 +3668,12 @@ } catch (Exception e) { - - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"+e.ToString(); - objJsonResult.data = null; - return objJsonResult; + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; } } /// <summary> @@ -327,7 +3696,7 @@ { objJsonResult.code = "0"; objJsonResult.count = 1; - objJsonResult.Message =""; + objJsonResult.Message = ""; objJsonResult.data = null; return objJsonResult; } @@ -335,7 +3704,7 @@ { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "澶辫触锛�"+DBUtility.ClsPub.sErrInfo; + objJsonResult.Message = "澶辫触锛�" + DBUtility.ClsPub.sErrInfo; objJsonResult.data = null; return objJsonResult; } @@ -363,7 +3732,7 @@ else { - if (webserver.set_SavePonderationBillMain_Temp_Source_SourceBillType(sInterID, sBillNo, HBillType, sBarCode, sRedBlue2, ref HSourceBillNo, ref sSourceTypeName, ref HSupID, ref HSupName, ref HDeptID, ref HDeptName, ref DBUtility.ClsPub.sErrInfo)) + if (webserver.set_SavePonderationBillMain_Temp_Source_SourceBillType(sInterID, sBillNo, HBillType, sBarCode, sRedBlue2, ref HSourceBillNo, ref sSourceTypeName, ref HSupID, ref HSupName, ref HDeptID, ref HDeptName, ref DBUtility.ClsPub.sErrInfo)) { //----------鍒涘缓铏氳〃------------------------ DataTable dt_Main = new DataTable("Json"); @@ -424,7 +3793,7 @@ [HttpGet] public object get_InfoByBarCode_Source_Json(string sBarCode, Int64 sInterID, string sBillNo, Double sQty, Int64 HWHID, Int64 HSPID) { - // string sRedBlue = "钃濆瓧"; + // string sRedBlue = "钃濆瓧"; try { string sErrMsg = ""; @@ -473,12 +3842,12 @@ } catch (Exception e) { - - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鎵爜澶辫触,姝ゆ潯鐮佷笉瀛樺湪锛�"+e.ToString(); - objJsonResult.data = null; - return objJsonResult; + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵爜澶辫触,姝ゆ潯鐮佷笉瀛樺湪锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; } } /// <summary> @@ -487,7 +3856,7 @@ /// <returns></returns> [Route("POStockInBill/set_SavePOStockInBackBill_Json")] [HttpPost] - public object set_SavePOStockInBackBill_Json([FromBody]JObject oMain) + public object set_SavePOStockInBackBill_Json([FromBody] JObject oMain) { var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); @@ -543,7 +3912,7 @@ /// <returns></returns> [Route("POStockInBill/set_SavePOStockInBill_Json")] [HttpPost] - public object set_SavePOStockInBill_Json([FromBody]JObject oMain) + public object set_SavePOStockInBill_Json([FromBody] JObject oMain) { var _value = oMain["oMain"].ToString(); string msg1 = _value.ToString(); @@ -552,8 +3921,8 @@ List<Model.ClsKf_POStockInBillMain> lsmain = new List<Model.ClsKf_POStockInBillMain>(); ListModels oListModels = new ListModels(); lsmain = oListModels.getPOStockInBillMainByJson(msg1); - lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); - lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); + //lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); string sSourceBillType = lsmain[0].HBillType; WebAPI.WebS.ClsKf_POStockInBillMain websLsmain = new WebS.ClsKf_POStockInBillMain(); @@ -565,6 +3934,7 @@ websLsmain.HDeptID = lsmain[0].HDeptID; websLsmain.HWHID = lsmain[0].HWHID; websLsmain.HSCWHID = 0; + //websLsmain.HSPID = lsmain[0].HSPID; websLsmain.HSupID = lsmain[0].HSupID; websLsmain.HKeeperID = lsmain[0].HKeeperID; websLsmain.HSecManagerID = lsmain[0].HSecManagerID; @@ -572,13 +3942,141 @@ websLsmain.HManagerID = 0; websLsmain.HBillerID = lsmain[0].HBillerID; websLsmain.HRemark = ""; - websLsmain.HExplanation = ""; + websLsmain.HExplanation = lsmain[0].HExplanation; websLsmain.HInnerBillNo = ""; websLsmain.HRedBlueFlag = false;//false钃濆瓧 true绾㈠瓧 websLsmain.HMainSourceBillType = lsmain[0].HBillType; - + websLsmain.HMaker = lsmain[0].HMaker; + websLsmain.HSTOCKORGID = lsmain[0].HSTOCKORGID; + websLsmain.HOWNERID = lsmain[0].HSTOCKORGID; if (webserver.set_SavePOStockInBill_New(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //鎴愬姛锛� + //objJsonResult.Message = "鎴愬姛锛佸崟鎹彿涓猴細"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.sErrInfo; //澶辫触锛� + //objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓婁紶澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + + //[Route("POStockInBill/set_SavePOStockInBill_Json")] + //[HttpPost] + //public object set_SavePOStockInBill_Json([FromBody] JObject oMain) + //{ + // string text = oMain["oMain"].ToString(); + // string jsonString = text.ToString(); + // object result; + // try + // { + // List<ClsKf_POStockInBillMain> list = new List<ClsKf_POStockInBillMain>(); + // ListModels listModels = new ListModels(); + // list = listModels.getPOStockInBillMainByJson(jsonString); + // list[0].HYear = ClsPub.isLong(DateTime.Now.Year); + // list[0].HDate = ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); + // string hbillType = list[0].HBillType; + // WebAPI.WebS.ClsKf_POStockInBillMain clsKf_POStockInBillMain = new WebAPI.WebS.ClsKf_POStockInBillMain(); + // clsKf_POStockInBillMain.HInterID = list[0].HInterID; + // clsKf_POStockInBillMain.HBillNo = list[0].HBillNo; + // clsKf_POStockInBillMain.HBillType = "1201"; + // clsKf_POStockInBillMain.HDate = list[0].HDate; + // clsKf_POStockInBillMain.HDeptID = list[0].HDeptID; + // clsKf_POStockInBillMain.HWHID = list[0].HWHID; + // clsKf_POStockInBillMain.HSCWHID = 0L; + // clsKf_POStockInBillMain.HSupID = list[0].HSupID; + // clsKf_POStockInBillMain.HKeeperID = list[0].HKeeperID; + // clsKf_POStockInBillMain.HSecManagerID = list[0].HSecManagerID; + // clsKf_POStockInBillMain.HEmpID = 0L; + // clsKf_POStockInBillMain.HManagerID = 0L; + // clsKf_POStockInBillMain.HBillerID = list[0].HBillerID; + // clsKf_POStockInBillMain.HRemark = ""; + // clsKf_POStockInBillMain.HInnerBillNo = ""; + // clsKf_POStockInBillMain.HRedBlueFlag = false; + // clsKf_POStockInBillMain.HMainSourceBillType = list[0].HBillType; + // clsKf_POStockInBillMain.HExplanation = list[0].HExplanation; + // bool flag = this.webserver.set_SavePOStockInBill_New(clsKf_POStockInBillMain, hbillType, ref ClsPub.sErrInfo); + // if (flag) + // { + // this.objJsonResult.code = "0"; + // this.objJsonResult.count = 1; + // this.objJsonResult.Message = "鎴愬姛锛佸崟鎹彿涓猴細"; + // this.objJsonResult.data = null; + // result = this.objJsonResult; + // } + // else + // { + // this.objJsonResult.code = "0"; + // this.objJsonResult.count = 0; + // this.objJsonResult.Message = "涓婁紶澶辫触锛�" + ClsPub.sErrInfo; + // this.objJsonResult.data = null; + // result = this.objJsonResult; + // } + // } + // catch (Exception ex) + // { + // this.objJsonResult.code = "0"; + // this.objJsonResult.count = 0; + // this.objJsonResult.Message = "涓婁紶澶辫触锛�" + ex.ToString(); + // this.objJsonResult.data = null; + // result = this.objJsonResult; + // } + // return result; + //} + + + /// <summary> + /// 鐢熶骇姹囨姤鍗�/鎻愪氦/鐩存帴璋僿ebservice + /// </summary> + /// <returns></returns> + [Route("ICMOReportBill/set_SaveICMOReportBill_Json")] + [HttpPost] + public object set_SaveICMOReportBill_Json([FromBody] JObject oMain) + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + try + { + List<Model.ClsSc_ICMOReportBillMain> lsmain = new List<Model.ClsSc_ICMOReportBillMain>(); + ListModels oListModels = new ListModels(); + lsmain = oListModels.getICMOReportBillMainByJson(msg1); + lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); + string sSourceBillType = lsmain[0].HBillType; + + WebAPI.WebS.ClsSc_ICMOReportBillMain websLsmain = new WebS.ClsSc_ICMOReportBillMain(); + + websLsmain.HInterID = lsmain[0].HInterID; + websLsmain.HBillNo = lsmain[0].HBillNo; + websLsmain.HBillType = "3711";//鍥哄畾鍊� + websLsmain.HDate = lsmain[0].HDate; + websLsmain.HDeptID = lsmain[0].HDeptID; + websLsmain.HEmpID = 0; + websLsmain.HBillerID = lsmain[0].HBillerID; + websLsmain.HRemark = ""; + websLsmain.HMainSourceBillType = lsmain[0].HBillType; + + + if (webserver.set_SaveICMOReportBill_Json(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; @@ -607,14 +4105,13 @@ [Route("POStockInBill/GetSpName_Json")] [HttpGet] - public object GetSpName_Json(long HSpID, long HWHID,long HStockOrgID, ref string sErrMsg) + public object GetSpName_Json(long HSpID, long HWHID, long HStockOrgID, ref string sErrMsg) { try { ds = webserver.GetSPInfoByIDandHWHIDandOrg(HSpID, HWHID, HStockOrgID, ref sErrMsg); if (ds == null || ds.Tables[0].Rows.Count <= 0) { - objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; @@ -641,8 +4138,6 @@ return objJsonResult; } } - - [Route("POStockInBill/Delete_Json")] [HttpGet] public object Delete_Json(long HInterID, long HMaterID, long HAuxPropID, string HMTONo, long HSourceInterID, long HSourceEntryID, string sHBillType) @@ -650,7 +4145,7 @@ string sErrMsg = string.Empty; try { - if (webserver.set_DelPonderationBillMain_Temp_InterIDAndSource(HInterID, HMaterID,HAuxPropID,HMTONo,HSourceInterID,HSourceEntryID,sHBillType,ref sErrMsg)) + if (webserver.set_DelPonderationBillMain_Temp_InterIDAndSource(HInterID, HMaterID, HAuxPropID, HMTONo, HSourceInterID, HSourceEntryID, sHBillType, ref sErrMsg)) { objJsonResult.code = "0"; objJsonResult.count = 1; @@ -719,7 +4214,7 @@ [Route("POStockInBillList/DisBillEntryList_Mate_Webs_Json")] [HttpGet] - public object DisBillEntryList_Webs_Json(string HBillType,string sWhere) + public object DisBillEntryList_Webs_Json(string HBillType, string sWhere) { try { @@ -779,7 +4274,6 @@ } catch (Exception) { - objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍒犻櫎澶辫触锛�"; @@ -789,5 +4283,1221 @@ } + + [Route("POStockInBillList/AuditPOInStockBillPost_AR")] + [HttpPost] + + public object AuditPOInStockBillPost_AR([FromBody] JObject msg) + { + object result; + try + { + string text = msg["msg"].ToString(); + text = text.Replace("\\", ""); + text = text.Replace("\n", ""); + List<ReciveBill_FastModel> list = JsonConvert.DeserializeObject<List<ReciveBill_FastModel>>(text); + ClsCg_POInStockBill clsCg_POInStockBill = new ClsCg_POInStockBill(); + string hinterID = list[0].HInterID; + string text2 = list[0].FID; + string singleSystemParameter = this.oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref ClsPub.sExeReturnInfo); + string singleSystemParameter2 = this.oSystemParameter.GetSingleSystemParameter("Cg_POInStockBill_ErpAduit", ref ClsPub.sExeReturnInfo); + string singleSystemParameter3 = this.oSystemParameter.GetSingleSystemParameter("Cg_POInStockBill_BarCodeCtl", ref ClsPub.sExeReturnInfo); + string configKey = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DataBaseName"); + string empty = string.Empty; + this.oCn.BeginTran(); + this.oCn.Commit(); + bool flag = singleSystemParameter.Contains("瀹夌憺"); + bool flag2 = flag; + bool flag3 = flag2; + if (flag3) + { + DataSet dataSet = this.oCn.RunProcReturn("exec h_p_ReceiveBill_Fast " + hinterID, "h_p_ReceiveBill_Fast"); + DataRow dataRow = dataSet.Tables[0].Rows[0]; + if (dataSet.Tables[0].Rows.Count == 1 && dataSet.Tables[0].Rows[0]["FRECEIVENumber"].ToString() == "0") + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "瀛樺湪澶氫釜閲囪喘璁㈠崟鍗曟嵁绫诲瀷锛屼笉鍏佽鎻愪氦锛�"; + this.objJsonResult.data = null; + return this.objJsonResult; + } + bool flag4 = dataSet.Tables[0].Rows.Count <= 0; + bool flag5 = flag4; + bool flag6 = flag5; + if (flag6) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "鏈壘鍒板搴旂殑鍗曟嵁"; + this.objJsonResult.data = null; + return this.objJsonResult; + } + bool flag7 = dataSet.Tables[0].Rows.Count >= 0; + bool flag8 = flag7; + bool flag9 = flag8; + if (flag9) + { + JObject jobject = new JObject(); + string text3 = "SLD01_SYS"; + string text4 = "CG"; + bool flag10 = dataRow["FTYPENAME"].ToString().Contains("濮斿"); + bool flag11 = flag10; + bool flag12 = flag11; + if (flag12) + { + text3 = "SLD03_SYS"; + text4 = "WW"; + } + bool flag13 = dataRow["FTYPENAME"].ToString().Contains("璧勪骇"); + bool flag14 = flag13; + bool flag15 = flag14; + if (flag15) + { + text3 = "SLD04_SYS"; + text4 = "ZCCG"; + } + JObject jobject2 = jobject; + string text5 = "FBILLTYPEID"; + JObject jobject3 = new JObject(); + jobject3["Fnumber"] = text3; + jobject2.Add(text5, jobject3); + jobject.Add("FBusinessType", text4); + jobject.Add("FBILLNO", dataRow["HBillNo"].ToString()); + jobject.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); + JObject jobject4 = jobject; + string text6 = "FStockOrgId"; + JObject jobject5 = new JObject(); + jobject5["Fnumber"] = dataRow["FRECEIVENUMBER"].ToString(); + jobject4.Add(text6, jobject5); + JObject jobject6 = jobject; + string text7 = "FPurOrgId"; + JObject jobject7 = new JObject(); + jobject7["Fnumber"] = dataRow["FPURCHASEORGNUMBER"].ToString(); + jobject6.Add(text7, jobject7); + JObject jobject8 = jobject; + string text8 = "FSupplierId"; + JObject jobject9 = new JObject(); + jobject9["Fnumber"] = dataRow["FSUPPLIERNUMBER"].ToString(); + jobject8.Add(text8, jobject9); + JObject jobject10 = jobject; + string text9 = "FPURCHASERID"; + JObject jobject11 = new JObject(); + jobject11["Fnumber"] = dataRow["FPURCHASERNUMBER"].ToString(); + jobject10.Add(text9, jobject11); + jobject.Add("FOwnerTypeIdHead", "BD_Supplier"); + JObject jobject12 = jobject; + string text10 = "FOwnerIdHead"; + JObject jobject13 = new JObject(); + jobject13["Fnumber"] = dataRow["FSUPPLIERNUMBER"].ToString(); + jobject12.Add(text10, jobject13); + JObject jobject14 = jobject; + string text11 = "F_RYMA_Assistant"; + JObject jobject15 = new JObject(); + jobject15["Fnumber"] = dataRow["F_UJDY_Assistant"].ToString(); + jobject14.Add(text11, jobject15); + JArray jarray = new JArray(); + foreach (object obj in dataSet.Tables[0].Rows) + { + DataRow dataRow2 = (DataRow)obj; + JObject jobject16 = new JObject(); + JObject jobject17 = jobject16; + string text12 = "FMaterialId"; + JObject jobject18 = new JObject(); + jobject18["Fnumber"] = dataRow2["FMATERIALNUMBER"].ToString(); + jobject17.Add(text12, jobject18); + JObject jobject19 = jobject16; + string text13 = "FUnitID"; + JObject jobject20 = new JObject(); + jobject20["Fnumber"] = dataRow2["FUNITNUMBER"].ToString(); + jobject19.Add(text13, jobject20); + jobject16.Add("FPreDeliveryDate", DateTime.Now.ToString("yyyy-MM-dd")); + JObject jobject21 = jobject16; + string text14 = "FPriceUnitId"; + JObject jobject22 = new JObject(); + jobject22["Fnumber"] = dataRow2["FUNITNUMBER"].ToString(); + jobject21.Add(text14, jobject22); + JObject jobject23 = jobject16; + string text15 = "FStockUnitID"; + JObject jobject24 = new JObject(); + jobject24["Fnumber"] = dataRow2["FUNITNUMBER"].ToString(); + jobject23.Add(text15, jobject24); + JObject jobject25 = jobject16; + string text16 = "FStockID"; + JObject jobject26 = new JObject(); + jobject26["Fnumber"] = "BJCK-SH.01.005"; + jobject25.Add(text16, jobject26); + jobject16.Add("FActReceiveQty", Convert.ToDecimal(dataRow2["HQTY"])); + jobject16.Add("FOwnerTypeId", "BD_OwnerOrg"); + JObject jobject27 = jobject16; + string text17 = "FOwnerID"; + JObject jobject28 = new JObject(); + jobject28["Fnumber"] = dataRow["FPURCHASEORGNUMBER"].ToString(); + jobject27.Add(text17, jobject28); + jobject16.Add("FSrcId", dataRow2["FID"].ToString()); + jobject16.Add("FSRCFORMID", "PUR_PurchaseOrder"); + jobject16.Add("FSrcBillNo", dataRow2["FBILLNO"].ToString()); + jobject16.Add("FSRCENTRYID", dataRow2["FENTRYID"].ToString()); + jobject16.Add("FORDERBILLNO", dataRow2["FBILLNO"].ToString()); + jobject16.Add("FPOORDERENTRYID", dataRow2["FENTRYID"].ToString()); + jobject16.Add("FGiveAway", dataRow2["FGIVEAWAY"].ToString());//鏄惁璧犲搧 + //jobject16.Add("FPrice", dataRow2["FPRICE"].ToString()); + //jobject16.Add("FTaxPrice", dataRow2["FTAXPRICE"].ToString()); + //jobject16.Add("FEntryTaxRate", dataRow2["FTAXRATE"].ToString()); + JObject jobject29 = jobject16; + string text18 = "FLOT"; + JObject jobject30 = new JObject(); + jobject30["Fnumber"] = dataRow2["hbatchno"].ToString(); + jobject29.Add(text18, jobject30); + jobject16.Add("FLOT_TEXT", dataRow2["hbatchno"].ToString()); + jobject16.Add("FProduceDate", dataRow2["HBeginDate"].ToString()); + jobject16.Add("FExpiryDate", dataRow2["HEndDate"].ToString()); + jobject16.Add("F_BGP_ShouldQty", dataRow2["F_BGP_ShouldQty"].ToString()); + jobject16.Add("FPrice", dataRow2["FPRICE"].ToString()); + jobject16.Add("FTaxPrice", dataRow2["FTAXPRICE"].ToString()); + jobject16.Add("FEntryTaxRate", dataRow2["FTAXRATE"].ToString()); + //jobject16.Add("F_UJDY_Qty", dataRow2["HQTY"].ToString()); + JObject jobject31 = jobject16; + string text19 = "FDetailEntity_Link"; + JArray jarray2 = new JArray(); + JObject jobject32 = new JObject(); + jobject32.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill"); + jobject32.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry"); + jobject32.Add("FDetailEntity_Link_FSBillId", dataRow2["FID"].ToString()); + jobject32.Add("FDetailEntity_Link_FSId", dataRow2["FEntryID"].ToString()); + jarray2.Add(jobject32); + jobject31.Add(text19, jarray2); + jarray.Add(jobject16); + } + jobject.Add("FDetailEntity", jarray); + JObject jobject33 = new JObject(); + JObject jobject34 = jobject33; + string text20 = "FSettleOrgId"; + JObject jobject35 = new JObject(); + jobject35["Fnumber"] = dataRow["FSETTLEORGNUMBER"].ToString(); + jobject34.Add(text20, jobject35); + JObject jobject36 = jobject33; + string text21 = "FSettleCurrId"; + JObject jobject37 = new JObject(); + jobject37["Fnumber"] = dataRow["FSETTLECURRNUMBER"].ToString(); + jobject36.Add(text21, jobject37); + jobject33.Add("FPricePoint", 0); + jobject.Add("FinanceEntity ", jobject33); + JObject jobject38 = new JObject(); + jobject38["Creator"] = ""; + jobject38["NeedUpDateFields"] = new JArray(); + jobject38["NeedReturnFields"] = new JArray(); + jobject38["IsDeleteEntry"] = "false"; + jobject38["SubSystemId"] = ""; + jobject38["IsVerifyBaseDataField"] = "false"; + jobject38["Model"] = jobject; + JObject jobject39 = jobject38; + string text22 = InvokeHelper.Login(); + int num = Extensions.Value<int>(JObject.Parse(text22)["LoginResultType"]); + bool flag16 = num == 0; + bool flag17 = flag16; + bool flag18 = flag17; + if (flag18) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = text22; + this.objJsonResult.data = null; + return this.objJsonResult; + } + string text23 = InvokeHelper.Save("PUR_ReceiveBill", jobject39.ToString()); + bool flag19 = JObject.Parse(text23)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE"; + bool flag20 = !flag19; + bool flag21 = flag20; + if (flag21) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = text23; + this.objJsonResult.data = null; + return this.objJsonResult; + } + string text24 = JObject.Parse(text23)["Result"]["Number"].ToString(); + text2 = JObject.Parse(text23)["Result"]["Id"].ToString(); + } + else + { + LogService.Write("鏀舵枡閫氱煡鍗曞鏍告棤鏁版嵁锛�" + empty, "Vlog", true); + } + } + else + { + JObject jobject40 = new JObject(); + jobject40.Add("Creator", ""); + jobject40.Add("NeedUpDateFields", new JArray()); + jobject40.Add("NeedReturnFields", new JArray()); + jobject40.Add("IsDeleteEntry", "false"); + jobject40.Add("SubSystemId", ""); + jobject40.Add("IsVerifyBaseDataField", ""); + JObject jobject41 = new JObject(); + jobject41.Add("FID", text2); + JArray jarray3 = new JArray(); + foreach (ReciveBill_FastModel reciveBill_FastModel in list) + { + bool flag22 = reciveBill_FastModel.HSQty == 0m; + bool flag23 = !flag22; + bool flag24 = flag23; + if (flag24) + { + JArray jarray4 = jarray3; + JObject jobject42 = new JObject(); + jobject42.Add("FEntryID", reciveBill_FastModel.FEntryID); + jobject42.Add("FActReceiveQty ", reciveBill_FastModel.HSQty); + jarray4.Add(jobject42); + } + } + jobject41.Add("FDetailEntity", jarray3); + jobject40.Add("Model", jobject41); + string text25 = InvokeHelper.Login(); + int num2 = Extensions.Value<int>(JObject.Parse(text25)["LoginResultType"]); + bool flag25 = num2 <= 0; + bool flag26 = flag25; + bool flag27 = flag26; + if (flag27) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = text25; + this.objJsonResult.data = null; + return this.objJsonResult; + } + string text26 = InvokeHelper.Save("PUR_ReceiveBill", jobject40.ToString()); + bool flag28 = JObject.Parse(text26)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE"; + bool flag29 = flag28; + bool flag30 = flag29; + if (flag30) + { + LogService.Write("鏀舵枡閫氱煡鍗曚慨鏀瑰け璐sonRoot:" + jobject40.ToString(), "Vlog", true); + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟洿鏂板け璐�" + text26; + this.objJsonResult.data = null; + return this.objJsonResult; + } + } + var f__AnonymousType = new + { + Ids = text2 + }; + string text27 = InvokeHelper.Submit("PUR_ReceiveBill", JsonConvert.SerializeObject(f__AnonymousType)); + JObject jobject43 = JObject.Parse(text27); + bool flag31 = jobject43["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE"; + bool flag32 = flag31; + bool flag33 = flag32; + if (flag33) + { + LogService.Write("鏀舵枡閫氱煡鍗曟彁浜ゅけ璐sonRoot:" + f__AnonymousType.ToString(), "Vlog", true); + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟彁浜ゅけ璐�" + text27; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + else + { + text27 = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(f__AnonymousType)); + jobject43 = JObject.Parse(text27); + bool flag34 = jobject43["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE"; + bool flag35 = flag34; + bool flag36 = flag35; + if (flag36) + { + LogService.Write("鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot:" + f__AnonymousType.ToString(), "Vlog", true); + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot" + text27; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + else + { + this.objJsonResult.code = "1"; + this.objJsonResult.count = 1; + this.objJsonResult.Message = "鎿嶄綔鎴愬姛锛�"; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + } + } + catch (Exception ex) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "寮傚父锛�" + ex.ToString(); + this.objJsonResult.data = null; + result = this.objJsonResult; + } + return result; + } + + + + //public object AuditPOInStockBillPost_AR([FromBody] JObject msg) + //{ + // string msg1 = msg["msg"].ToString(); + // msg1 = msg1.Replace("\\", ""); + // msg1 = msg1.Replace("\n", ""); + // msg1 = msg1.Substring(1, msg1.Length-2); + // try + // { + // List<Model.ClsCg_POInStockBillMain> lsmain = new List<Model.ClsCg_POInStockBillMain>(); + // ListModels oListModels = new ListModels(); + // lsmain = oListModels.getPOInStockBillMainByJson(msg1); + // lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + // lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); + // string sSourceBillType = "1103"; + + // WebAPI.WebS.ClsCg_POInStockBillMain websLsmain = new WebS.ClsCg_POInStockBillMain(); + + // websLsmain.HInterID = lsmain[0].HInterID; + // websLsmain.HBillNo = lsmain[0].HBillNo; + // //websLsmain.HBillType = "1103";//鍥哄畾鍊� + // websLsmain.HDate = lsmain[0].HDate; + // //websLsmain.HDeptID = lsmain[0].HDeptID; + // //websLsmain.HEmpID = 0; + // //websLsmain.HBillerID = lsmain[0].HBillerID; + // //websLsmain.HRemark = ""; + // //websLsmain.HMainSourceBillType = lsmain[0].HBillType; + + + // if (webserver.set_SavePOInStockBill_NEW_Json(websLsmain, ref DBUtility.ClsPub.sErrInfo)) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 1; + // objJsonResult.Message = "鎴愬姛锛佸崟鎹彿涓猴細"; + // objJsonResult.data = null; + // return objJsonResult; + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "涓婁紶澶辫触锛�" + DBUtility.ClsPub.sErrInfo; + // objJsonResult.data = null; + // return objJsonResult; + // } + // } + // catch (Exception e) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "涓婁紶澶辫触锛�" + e.ToString(); + // objJsonResult.data = null; + // return objJsonResult; + // } + //} + + + #region PDA鍏朵粬鍑哄簱 + //鍒拌揣纭鍒犻櫎 + [Route("Kf_ReciveBill_Fast_AR/Delete_Json_AN")] + [HttpGet] + public object Delete_Json_AN(string HBillNo, Int64 HMaterID) + + { + try + { + //鏍规嵁鏉$爜鍦ㄦ潯鐮佹。妗堜腑鎵惧埌瀵瑰簲鐨勬墭鏉$爜锛屽啀鍦ㄤ复鏃惰〃涓垹闄よ鎵樻潯鐮佺殑鍏ㄩ儴璁板綍 + string sql = string.Format(@"delete from KF_PonderationBillMain_Temp where HBillType=1103 and HMaterID=" + HMaterID + " and HBillNo = '" + HBillNo + "'"); + oCn.RunProc(sql); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + } + #endregion + + [Route("Kf_ReciveBill_Fast_AR/Display111")] + [HttpGet] + public object Display111(string HBillNo) + + { + try + { + //鏍规嵁鏉$爜鍦ㄦ潯鐮佹。妗堜腑鎵惧埌瀵瑰簲鐨勬墭鏉$爜锛屽啀鍦ㄤ复鏃惰〃涓垹闄よ鎵樻潯鐮佺殑鍏ㄩ儴璁板綍 + DataSet dataSet4 = this.oCn.RunProcReturn(" select sum(a.HQty) HQty ,a.HMaterID,b.HNumber,b.HName,b.HModel,a.HSourceBillNo,a.HInterID,a.HBillNo from KF_PonderationBillMain_Temp a inner join Gy_Material b on a.hmaterid = b.hitemid where a.HBillNo = '" + HBillNo.ToString() + "' group by a.HMaterID,b.HNumber,b.HName,b.HModel,a.HSourceBillNo,a.HInterID,a.HBillNo", "Gy_Material"); + bool flag5 = dataSet4 == null || dataSet4.Tables[0].Rows.Count == 0; + if (flag5) + { + 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 = dataSet4.Tables[0]; ; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + } + + + [Route("POStockInBillList/Get_ReciveBillByBarcode_AR")] + [HttpGet] + public object Get_ReciveBillByBarcode_AR(string HBarcode, long HOrgID, long HInterID, string HBillNo) + { + object result; + try + { + string singleSystemParameter = this.oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref ClsPub.sExeReturnInfo); + string empty = string.Empty; + bool flag = singleSystemParameter.Contains("瀹夌憺"); + if (flag) + { + string[] array = HBarcode.Split(new char[] + { + '@' + }); + string text = array[0]; + Double num = ClsPub.isDoule(array[4]); + string text2 = array[6]; + DateTime dateTime = ClsPub.isDate(array[3]); + DateTime dateTime2 = ClsPub.isDate(array[5]); + DataSet Dss7; + Dss7 = oCn.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + text + "'", "T_BD_MATERIAL"); + if (Dss7 == null || Dss7.Tables[0].Rows.Count == 0) + { + DataSet Dss8; + Dss8 = oCn.RunProcReturn(" select * from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + text + "'", "T_BD_MATERIAL"); + text = DBUtility.ClsPub.isStrNull(Dss8.Tables[0].Rows[0]["FNumber"]); + } + else + { + text = DBUtility.ClsPub.isStrNull(Dss7.Tables[0].Rows[0]["FNumber"]); + } + + DataSet dataSet = this.oCn.RunProcReturn(string.Concat(new string[] + { + " select max(HItemID) HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '", + text, + "' and huseorgid = ", + HOrgID.ToString(), + " group by HName,HModel,HUnitID" + }), "Gy_Material"); + bool flag2 = dataSet == null || dataSet.Tables[0].Rows.Count == 0; + if (flag2) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "娌℃湁鐗╂枡鏁版嵁锛�"; + this.objJsonResult.data = null; + return this.objJsonResult; + } + long num2 = ClsPub.isLong(dataSet.Tables[0].Rows[0]["HItemID"]); + string text3 = ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HName"]); + string text4 = ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HModel"]); + long num3 = (long)ClsPub.isInt(dataSet.Tables[0].Rows[0]["HUnitID"]); + string text5 = ClsPub.isStrNull(array[8]); + DataSet dataSet2 = this.oCn.RunProcReturn(string.Concat(new string[] + { + "select * from KF_PonderationBillMain_Temp Where HBillNo='", + text5, + "' and HMaterID = ", + num2.ToString(), + " and HInterID = ", + HInterID.ToString(), + " and HQty = ", + num.ToString() + }), "KF_PonderationBillMain_Temp"); + bool flag3 = dataSet2.Tables[0].Rows.Count > 0; + if (flag3) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "璇ユ敹鏂欓�氱煡鍗曞凡瀛樺湪鎵爜璁板綍!"; + this.objJsonResult.data = null; + return this.objJsonResult; + } + DataSet dataSet3 = this.oCn.RunProcReturn(" select a.HInterID,b.HEntryID,a.HBillNo from Cg_POOrderBillMain a inner join Cg_POOrderBillSub b on a.hinterid = b.hinterid where a.HBillNo = '" + text5.ToString() + "' and b.HMaterID = " + num2.ToString(), "Cg_POOrderBillMain"); + bool flag4 = dataSet3 == null || dataSet3.Tables[0].Rows.Count == 0; + if (flag4) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "娌℃湁閲囪喘璁㈠崟璁板綍锛�" + text5 + num2.ToString(); + this.objJsonResult.data = null; + return this.objJsonResult; + } + long num4 = ClsPub.isLong(dataSet3.Tables[0].Rows[0]["HInterID"]); + long num5 = ClsPub.isLong(dataSet3.Tables[0].Rows[0]["HEntryID"]); + string text6 = ClsPub.isStrNull(dataSet3.Tables[0].Rows[0]["HBillNo"]); + this.oCn.RunProc(string.Concat(new string[] + { + "insert into KF_PonderationBillMain_Temp (HInterID,HBillNo,HBeginDate,HEndDate,HBillType,HMaterID,HProcID" + + ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID" + + ",HQty,HQtyMust,HPieceQty,HAuxPropID,HBatchNo" + + ",HBarCode,HAddr,HMaker,HMakeDate ,HSourceInterID" + + ",HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo ,HSTOCKORGID" + + ",HOWNERID,HExpressNumber,HSubBillType,HRelationInterID,HRelationEntryID" + + ",HRelationBillNo,HRedBlueFlag,HCusID) values (", + HInterID.ToString(), + ",'", + HBillNo.ToString(), + "','", + dateTime.ToString(), + "','", + dateTime2.ToString(), + "','1103',", + num2.ToString(), + ",0,0,0,0,0,0,", + num.ToString(), + ",", + num.ToString(), + ",0,0,'", + text2.ToString(), + "','", + HBarcode.ToString(), + "','','System',getdate(), ", + num4.ToString(), + ",", + num5.ToString(), + ",'1102','", + text6.ToString(), + "','',0,0,'','',0,0,'',0,0)" + })); + } + DataSet dataSet4 = this.oCn.RunProcReturn(" select sum(a.HQty) HQty ,a.HMaterID,b.HNumber,b.HName,b.HModel,a.HSourceBillNo,a.HInterID,a.HBillNo from KF_PonderationBillMain_Temp a inner join Gy_Material b on a.hmaterid = b.hitemid where a.HBillNo = '" + HBillNo.ToString() + "' group by a.HMaterID,b.HNumber,b.HName,b.HModel,a.HSourceBillNo,a.HInterID,a.HBillNo", "Gy_Material"); + bool flag5 = dataSet4 == null || dataSet4.Tables[0].Rows.Count == 0; + if (flag5) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + this.objJsonResult.data = null; + result = this.objJsonResult; + } + else + { + this.objJsonResult.code = "1"; + this.objJsonResult.count = 1; + this.objJsonResult.Message = "Sucess锛�"; + this.objJsonResult.data = dataSet4.Tables[0]; + result = this.objJsonResult; + } + } + catch (Exception ex) + { + this.objJsonResult.code = "0"; + this.objJsonResult.count = 0; + this.objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + this.objJsonResult.data = null; + result = this.objJsonResult; + } + return result; + } + + + + + #region 鍒拌揣纭 + [Route("POStockInBillList/Get_ReciveBill")] + [HttpGet] + public object get_InfoByBillNo(string HBillno) + { + try + { + json result = Get_ReciveBillCheckDate(HBillno); + return result; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + public int GetHinterIDByBillNo(string HBillNo, string type) + { + SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM(); + int HInterID = 0; + string sql = "select HInterID from CG_POINSTOCKBILLMAIN where HBILLNO = '" + HBillNo + "'"; + if (type == "Print") + sql += " and HBillStatus = '2' ";//鎵撳嵃鍒ゆ柇鏄惁瀹℃牳 + DataTable dt = oCn.RunProcReturn(sql, "HInterID").Tables[0]; + if (dt.Rows.Count > 0) + HInterID = Convert.ToInt32(dt.Rows[0]["HInterID"]); + return HInterID; + } + + /// <summary> + /// 鍒拌揣纭鎵敹鏂欓�氱煡鍗曞彿 鑾峰彇琛ㄤ綋鍜岃〃澶存暟鎹� + /// </summary> + /// <param name="HBarCode"></param> + /// <returns></returns> + public json Get_ReciveBillCheckDate(string HBarCode) + { + json objjson = new json(); + try + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DataSet Ds; + string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);//瀹㈡埛鍚嶇О + if (FCusName.Contains("瀹夌憺")) + Ds = oCn.RunProcReturn("exec h_p_GetPOInStockByBarCode'" + HBarCode + "'", "h_p_GetPOInStockByBarCode"); + else + Ds = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_Temp_Add_POInStockCheck2 '" + HBarCode + "'", "h_p_KF_PonderationBillMain_Temp_Add_POInStockCheck2"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objjson.data = null; + return objjson; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 0) + { + objjson.code = "1"; + objjson.count = 1; + objjson.Message = "Sucess锛�"; + objjson.data = Ds.Tables[0]; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + objjson.data = null; + return objjson; + } + } + } + catch (Exception e) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objjson.data = null; + return objjson; + + } + } + + [Route("POStockInBillList/AuditPOInStockBillPost")] + [HttpPost] + public object AuditPOInStockBill([FromBody] JObject msg) + { + try + { + string _msg = msg["msg"].ToString(); + _msg = _msg.Replace("\\", ""); + _msg = _msg.Replace("\n", ""); + List<Models.ReciveBill_FastModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ReciveBill_FastModel>>(_msg); + DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill(); + var hinterID = list[0].HInterID; + var FID = list[0].FID; + string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);//瀹㈡埛鍚嶇О + string FisRealess = oSystemParameter.GetSingleSystemParameter("Cg_POInStockBill_ErpAduit", ref DBUtility.ClsPub.sExeReturnInfo);//閫佽揣鍗曞埌璐х‘璁ゅ悗鍚屾閲戣澏浜戞敹鏂欓�氱煡鍗� + string FishaveBarcode = oSystemParameter.GetSingleSystemParameter("Cg_POInStockBill_BarCodeCtl", ref DBUtility.ClsPub.sExeReturnInfo);//鍒拌揣纭蹇呴』鎵爜绠辨潯鐮� + var kdTbaleName = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DataBaseName"); + string sql = string.Empty; + #region 鏍¢獙鏄惁鎵弿鏉$爜 + if (FishaveBarcode == "Y") + { + var HInterID = list[0].HInterID; + string jysql = string.Format(@"select * from KF_PonderationBillMain_Temp where HSourceInterID = {0}", HInterID); + DataTable jyDt = oCn.RunProcReturn(jysql, "jysql").Tables[0]; + if (jyDt.Rows.Count == 0 || jyDt == null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇锋壂鎻忔潯鐮�"; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 閲戣澏瀹℃牳鍚庝細閲嶆柊鍚屾鍗曟嵁鍒癿es 鏁呬笉闇�瑕佹洿鏂癿es鐨勬敹鏂欓�氱煡鍗� + oCn.BeginTran(); + foreach (var item in list) + { + if (item.HSQty == 0) + continue; + sql = $"update Cg_POInStockBillSub set Hqty = {item.HSQty} where HInterID ={item.HInterID} and HEntryID = {item.HEntryID}"; + oCn.RunProc(sql); + } + //鏇存柊鎴愬姛鍚� 鍚屾鏇存柊閲戣澏 + oCn.Commit(); + #endregion + + if (FCusName.Contains("瀹夌憺")) + { + sql = string.Format(@" +SELECT T3.FNAME AS FTYPENAME,M.HBILLNO,B.HINTERID,B.HENTRYID,C.FID,C.FENTRYID, D.FBILLNO,B.HQTY,CD.FRECEIVEORGID,CDOO.FNUMBER AS FRECEIVENUMBER +,D.FSUPPLIERID,DS.FNUMBER AS FSUPPLIERNUMBER,D.FPURCHASEORGID,DOO.FNUMBER AS FPURCHASEORGNUMBER,CROO.FNUMBER AS FSETTLEORGNUMBER, +E.FPRICETIMEPOINT,E.FSETTLECURRID,EC.FNUMBER AS FSETTLECURRNUMBER,C.FMATERIALID,CM.FNUMBER AS FMATERIALNUMBER ,C.FUNITID +,CU.FNUMBER AS FUNITNUMBER,CR.FPRICE,CR.FTAXPRICE,CR.FTAXRATE,D.FPURCHASERID,isnull(T4.FNUMBER,'') AS FPURCHASERNUMBER +,C.FGIVEAWAY AS FGIVEAWAY +FROM CG_POINSTOCKBILLSUB B +JOIN CG_POINSTOCKBILLMAIN M ON B.HINTERID = M.HINTERID +JOIN {0}..T_PUR_POORDERENTRY C ON B.HSOURCEINTERID = C.FID AND B.HSOURCEENTRYID = C.FENTRYID +LEFT JOIN {0}..T_BD_MATERIAL CM ON C.FMATERIALID =CM.FMATERIALID +LEFT JOIN {0}..T_BD_UNIT CU ON C.FUNITID =CU.FUNITID +JOIN {0}..T_PUR_POORDERENTRY_D CD ON C.FENTRYID = CD.FENTRYID +LEFT JOIN {0}..T_ORG_ORGANIZATIONS CDOO ON CD.FRECEIVEORGID = CDOO.FORGID +JOIN {0}..T_PUR_POORDERENTRY_F CR ON C.FENTRYID = CR.FENTRYID +LEFT JOIN {0}..T_ORG_ORGANIZATIONS CROO ON CR.FSETTLEORGID = CROO.FORGID +LEFT JOIN {0}..T_PUR_POORDER D ON C.FID =D.FID +LEFT JOIN {0}..T_BAS_BILLTYPE T2 ON D.FBILLTYPEID = T2.FBILLTYPEID +LEFT JOIN {0}..T_BAS_BILLTYPE_L T3 ON T2.FBILLTYPEID = T3.FBILLTYPEID and FLOCALEID = 2052 +LEFT JOIN {0}..V_BD_BUYER T4 ON D.FPURCHASERID =T4.FID +LEFT JOIN {0}..T_BD_SUPPLIER DS ON D.FSUPPLIERID = DS.FSUPPLIERID +LEFT JOIN {0}..T_ORG_ORGANIZATIONS DOO ON D.FPURCHASEORGID = DOO.FORGID +JOIN {0}..T_PUR_POORDERFIN E ON C.FID =E.FID +LEFT JOIN {0}..T_BD_CURRENCY EC ON E. FSETTLECURRID =EC.FCURRENCYID + WHERE b.hinterid in ({1}) and M.HERPInterID = 0 +", kdTbaleName, hinterID); + DataTable dt = oCn.RunProcReturn(sql, "sltz").Tables[0]; + List<string> fidList = new List<string>(); + if (dt.Rows.Count > 0) + { + //foreach (DataRow dr in dt.Rows) + //{ + // //閲囪喘璁㈠崟涓嬫帹鐢熸垚閫佽揣鍗� 鏃跺�� 鍒ゆ柇鏄惁鏈夌敓鎴愰噰璐鍗曞彉鏇村崟 濡傛灉鏈変笖鍙樻洿鍗曠姸鎬佷笉涓哄凡瀹℃牳 闄愬埗涓嬫帹 + // objJsonResult = TestPOOrder(dr["FEntryID"].ToString()); + // if (objJsonResult.code == "0") + // return objJsonResult; + //} + foreach (DataRow dr in dt.Rows) + { + if (fidList.Contains(dr["HINTERID"].ToString())) + continue; + else + fidList.Add(dr["HINTERID"].ToString()); + DataRow[] drs = dt.Select("HINTERID = " + dr["HINTERID"].ToString()); + JObject model = new JObject(); + string fTypeName = "SLD01_SYS";//鏍囧噯閲囪喘璁㈠崟绫诲瀷 + string ywTypeName = "CG";//鏍囧噯涓氬姟绫诲瀷 + if (dr["FTYPENAME"].ToString().Contains("濮斿")) + { + fTypeName = "SLD03_SYS"; + ywTypeName = "WW"; + } + if (dr["FTYPENAME"].ToString().Contains("璧勪骇")) + { + fTypeName = "SLD04_SYS"; + ywTypeName = "ZCCG"; + } + model.Add("FBILLTYPEID", new JObject() { ["Fnumber"] = fTypeName }); //鍗曟嵁绫诲瀷 + model.Add("FBusinessType", ywTypeName); //涓氬姟绫诲瀷 + model.Add("FBILLNO", dr["HBillNo"].ToString()); //鍗曟嵁缂栧彿 + model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //閫氱煡鏃ユ湡 + model.Add("FStockOrgId", new JObject() { ["Fnumber"] = dr["FRECEIVENUMBER"].ToString() }); // 鏀舵枡缁勭粐 + model.Add("FPurOrgId", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() }); //閲囪喘缁勭粐 + model.Add("FSupplierId", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() }); //渚涘簲鍟� + model.Add("FPURCHASERID", new JObject() { ["Fnumber"] = dr["FPURCHASERNUMBER"].ToString() }); //閲囪喘鍛� + model.Add("FOwnerTypeIdHead", "BD_Supplier");// 璐т富绫诲瀷 + model.Add("FOwnerIdHead", new JObject() { ["Fnumber"] = dr["FSUPPLIERNUMBER"].ToString() });//璐т富 渚涘簲鍟� + JArray Fentity = new JArray(); + foreach (var item in drs) + { + JObject FentityModel = new JObject(); + FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = item["FMATERIALNUMBER"].ToString() }); // 鐗╂枡缂栫爜 + FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // 鍗曚綅 + FentityModel.Add("FPreDeliveryDate", DateTime.Now.ToString("yyyy-MM-dd")); //棰勮鍒拌揣鏃ユ湡 + FentityModel.Add("FPriceUnitId", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // 璁′环鍗曚綅 + FentityModel.Add("FStockUnitID", new JObject() { ["Fnumber"] = item["FUNITNUMBER"].ToString() }); // 搴撳瓨鍗曚綅 + FentityModel.Add("FStockID", new JObject() { ["Fnumber"] = "BJCK-SH.01.005" }); // 搴撳瓨鍗曚綅 + FentityModel.Add("FActReceiveQty", Convert.ToDecimal(item["HQTY"])); // 渚涘簲鍟嗛�佽揣鏁伴噺锛堟彁鏂欒鍒掓暟閲� - 宸茬敓鎴愰�佽揣鍗曟暟閲忥級 + FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//璐т富绫诲瀷 + FentityModel.Add("FOwnerID", new JObject() { ["Fnumber"] = dr["FPURCHASEORGNUMBER"].ToString() });//璐т富 + FentityModel.Add("FSrcId", item["FID"].ToString());//婧愬崟鍐呯爜 + FentityModel.Add("FSRCFORMID", "PUR_PurchaseOrder");//婧愬崟绫诲瀷 + FentityModel.Add("FSrcBillNo", item["FBILLNO"].ToString());//婧愬崟鍗曞彿 + FentityModel.Add("FSRCENTRYID", item["FENTRYID"].ToString());//婧愬崟鍒嗗綍鍐呯爜 + FentityModel.Add("FORDERBILLNO", item["FBILLNO"].ToString());//婧愬崟鍗曞彿 + FentityModel.Add("FPOORDERENTRYID", item["FENTRYID"].ToString());//婧愬崟鍒嗗綍鍐呯爜 + FentityModel.Add("FSRMENTRYID", item["HENTRYID"].ToString());//SRM hentryid + FentityModel.Add("FPrice", item["FPRICE"].ToString());//鍗曚环 + FentityModel.Add("FTaxPrice", item["FTAXPRICE"].ToString());//鍚◣鍗曚环 + FentityModel.Add("FEntryTaxRate", item["FTAXRATE"].ToString());//绋庣巼 + FentityModel.Add("FGiveAway", item["FGIVEAWAY"].ToString());//鏄惁璧犲搧 + + JArray Fentity2 = new JArray(); + JObject FentityModel2 = new JObject(); + FentityModel2.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill"); + FentityModel2.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry"); + FentityModel2.Add("FDetailEntity_Link_FSBillId", item["FID"].ToString()); + FentityModel2.Add("FDetailEntity_Link_FSId", item["FEntryID"].ToString()); + Fentity2.Add(FentityModel2); + FentityModel.Add("FDetailEntity_Link", Fentity2); + Fentity.Add(FentityModel); + } + model.Add("FDetailEntity", Fentity); //鏄庣粏淇℃伅 + + JObject _FentityModel = new JObject(); + _FentityModel.Add("FSettleOrgId", new JObject() { ["Fnumber"] = dr["FSETTLEORGNUMBER"].ToString() }); // 缁撶畻缁勭粐 + _FentityModel.Add("FSettleCurrId", new JObject() { ["Fnumber"] = dr["FSETTLECURRNUMBER"].ToString() }); // 缁撶畻甯佸埆 + _FentityModel.Add("FPricePoint", 0); // 瀹氫环鏃剁偣 + model.Add("FinanceEntity ", _FentityModel);//璐㈠姟淇℃伅 + JObject jsonRoot = new JObject() + { + ["Creator"] = "", + ["NeedUpDateFields"] = new JArray(), + ["NeedReturnFields"] = new JArray(), + ["IsDeleteEntry"] = "false", + ["SubSystemId"] = "", + ["IsVerifyBaseDataField"] = "false", + ["Model"] = model + }; + var loginRet = InvokeHelper.Login(); + var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + if (isSuccess == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = loginRet; + objJsonResult.data = null; + return objJsonResult; + } + //LogService.Write("jsonRoot:" + jsonRoot.ToString()); + var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString()); + //LogService.Write(result); + if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE") + { + //鏇存柊閫佽揣鍗� 涓昏〃 ERP鍗曟嵁鍙� 浠ュ強 ERP涓诲唴鐜� + string FBillNo = JObject.Parse(result)["Result"]["Number"].ToString(); + FID = JObject.Parse(result)["Result"]["Id"].ToString(); + string updateSql = string.Format(@" + update a set + a.HERPInterID = {0} , + a.HERPBillNO ='{1}' + from Cg_POInStockBillMain a + join Cg_POInStockBillSub b on a.hinterid = b.hinterid + where b.HInterID = ({2}) + and b. HSOURCEINTERID = {3} + and a.HERPInterID = 0 + ", FID, FBillNo, dr["HINTERID"].ToString(), dr["FID"].ToString()); + oCn.RunProc(updateSql); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = result; + objJsonResult.data = null; + return objJsonResult; + } + + } + } + else + { + LogService.Write("鏀舵枡閫氱煡鍗曞鏍告棤鏁版嵁锛�" + sql); + } + } + else //澶忓疂 锛屾洿鏂癳rp淇℃伅 + { + JObject jsonRoot = new JObject(); + jsonRoot.Add("Creator", ""); + jsonRoot.Add("NeedUpDateFields", new JArray()); + jsonRoot.Add("NeedReturnFields", new JArray()); + jsonRoot.Add("IsDeleteEntry", "false"); + jsonRoot.Add("SubSystemId", ""); + jsonRoot.Add("IsVerifyBaseDataField", ""); + + JObject jsonModel = new JObject(); + jsonModel.Add("FID", FID); + JArray Entry = new JArray(); + foreach (var item in list) + { + if (item.HSQty == 0) + continue; + JObject jsonFPOOrderEntry = new JObject(); + jsonFPOOrderEntry.Add("FEntryID", item.FEntryID); + jsonFPOOrderEntry.Add("FActReceiveQty ", item.HSQty); ; + Entry.Add(jsonFPOOrderEntry); + } + jsonModel.Add("FDetailEntity", Entry); + jsonRoot.Add("Model", jsonModel); + var loginRet = InvokeHelper.Login(); + var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + if (isSuccess <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = loginRet; + objJsonResult.data = null; + return objJsonResult; + } + var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString()); + //LogService.Write(result); + if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + LogService.Write("鏀舵枡閫氱煡鍗曚慨鏀瑰け璐sonRoot:" + jsonRoot.ToString()); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟洿鏂板け璐�" + result; + objJsonResult.data = null; + return objJsonResult; + } + } + var json = new + { + Ids = FID, + }; + //LogService.Write(json); + //鎻愪氦 + var _result = InvokeHelper.Submit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); + var _saveObj = JObject.Parse(_result); + if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + LogService.Write("鏀舵枡閫氱煡鍗曟彁浜ゅけ璐sonRoot:" + json.ToString()); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟彁浜ゅけ璐�" + _result; + objJsonResult.data = null; + return objJsonResult; + + } + //瀹℃牳 + _result = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); + _saveObj = JObject.Parse(_result); + if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + LogService.Write("鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot:" + json.ToString()); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot" + _result; + objJsonResult.data = null; + return objJsonResult; + + } + + + 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; + } + + } + + /// <summary> + /// 鍒拌揣纭 鎵潯鐮� 鏍¢獙 + /// </summary> + /// <param name="HBarcode"></param> + /// <param name="HInterID"></param> + /// <returns></returns> + [Route("POStockInBillList/Get_ReciveBillByBarcode")] + [HttpGet] + public object Get_ReciveBillByBarcode(string HBarcode, string HInterID) + { + try + { + //var code = HBarcode.Split('#')[0]; + //鏍¢獙鏉$爜鏄惁瀛樺湪 + string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);//瀹㈡埛鍚嶇О + string sql = string.Empty; + if (FCusName.Contains("瀹夌憺")) + sql = $"select top 1 HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from Gy_BarCodeBill where HSourceInterID =(select distinct HSourceInterID from Cg_POInStockBillSub where HInterID ={HInterID}) and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'"; + else + sql = $"select HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode.Split('#')[0]}' and HQty = {HBarcode.Split('#')[1]}"; + DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList"); + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉$爜涓嶅瓨鍦紒"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + //瀛樺叆鏉$爜涓存椂琛� + sql = $"delete from KF_PonderationBillMain_Temp Where HBillNo='{ds.Tables[0].Rows[0]["HSourceBillNo"]}' "; + oCn.RunProc(sql); + sql = string.Format(@"Insert into KF_PonderationBillMain_Temp + (HInterID,HBillNo,HBillType,HMaterID,HProcID,HWhID,HSCWHID + ,HStockPlaceID,HOutStockPlaceID,HGroupID,HQty,HQtyMust,HPieceQty + ,HAuxPropID,HBatchNo,HBarCode,HAddr,HMaker,HMakeDate + ,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo + ,HSTOCKORGID,HOWNERID,HExpressNumber,HSubBillType + ,HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag + ,HCusID) + select HInterID,HSourceBillNo,HBillType,HMaterID,0,0,0 + ,0,0,0,HQty,HQty,0 + ,HAuxPropID,HBatchNo,'','','System',getdate() + ,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HMTONo + ,HSTOCKORGID,HOWNERID,'',HBillType + ,0,0,'',0 + ,0 from Gy_BarCodeBill + where HItemID = {0}", ds.Tables[0].Rows[0]["HItemID"]); + oCn.RunProc(sql); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //string sql = $"select * from H_v_SRM_POInStockBillList where 鍗曟嵁鍙� ='{HBillno}'"; + //ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList"); + //if (ds == null || ds.Tables[0].Rows.Count == 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //else + //{ + + //} + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //鏀舵枡閫氱煡鍗曞鏍� 瀹℃牳鎻愪氦 + [Route("POStockInBillList/Exec_ReciveBillCheck")] + [HttpGet] + public json Exec_ReciveBillCheck(string HBarCode) + { + json objjson = new json(); + try + { + //淇敼閲戣澏鐢熶骇鍗曠殑鐘舵�� + //璁块棶閲戣澏 + var loginRet = InvokeHelper.Login(); + var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + + if (isSuccess == 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鎿嶄綔澶辫触,閲戣澏璐﹀彿鐧诲綍寮傚父銆�" + loginRet; + objjson.data = null; + return objjson; + } + var json = new + { + //CreateOrgId = 0, + Numbers = HBarCode, + //Ids = (EntyID).Split('-')[0], + //PkEntryIds = (EntyID).Split('-')[1] + }; + string result1 = string.Empty; + string result2 = string.Empty; + DataSet Ds = oCn.RunProcReturn("select FDOCUMENTSTATUS,FID from AIS20220914133941..T_PUR_RECEIVE where FBILLNO='" + HBarCode + "'", "AIS20220914133941..T_PUR_RECEIVE"); + //鍒ゆ柇褰撳墠鏀舵枡閫氱煡鍗曠姸鎬佲�斺�斿凡鍒涘缓鍒欏厛鎻愪氦鍐嶅鏍搞�佷互鎻愪氦鍒欏彧瀹℃牳 + if (Ds.Tables[0].Rows[0][0].ToString() == "A" || Ds.Tables[0].Rows[0][0].ToString() == "D") + { + result1 = InvokeHelper.Submit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); + result2 = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); + } + if (Ds.Tables[0].Rows[0][0].ToString() == "B") + { + result2 = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json)); + } + //鍒ゆ柇瀹℃牳鏄惁鎴愬姛 + if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "瀹℃牳鏀舵枡閫氱煡鍗曞け璐ワ紒鍗曟嵁鍙凤細" + HBarCode; + objjson.data = null; + return objjson; + } + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; + objJsonResult.data = 1; + return objjson; + } + catch (Exception e) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objjson.data = null; + return objjson; + } + + } + #endregion + + #region PDA閿�鍞嚭搴� + //PDA閿�鍞嚭搴撴暣鎵樺垹闄� + [Route("POStockInBillList/SellOutBillSDeleCode")] + [HttpGet] + public object SellOutBillSDeleCode(string HBarCode, string HInterID) + { + try + { + //鏍规嵁鏉$爜鍦ㄦ潯鐮佹。妗堜腑鎵惧埌瀵瑰簲鐨勬墭鏉$爜锛屽啀鍦ㄤ复鏃惰〃涓垹闄よ鎵樻潯鐮佺殑鍏ㄩ儴璁板綍 + string sql = string.Format(@"delete from KF_PonderationBillMain_Temp where HBillType=1205 and HInterID=" + HInterID + " and HBarCode" + + " in (select HBarCode from Gy_BarCodeBill where HBarCode_Pack = (select HBarCode_Pack from Gy_BarCodeBill where HBarCode = '" + HBarCode + "'))"); + oCn.RunProc(sql); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁存墭鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + 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