|  |  |  | 
|---|
|  |  |  | WebS.ClsXt_SystemParameterMain oSystemParameterMain = new WebS.ClsXt_SystemParameterMain(); | 
|---|
|  |  |  | string text = ""; | 
|---|
|  |  |  | string text1 = ""; | 
|---|
|  |  |  | bool flag = HBillType == "1201"; | 
|---|
|  |  |  | //gy_billnumber 单据类型表 | 
|---|
|  |  |  | bool flag = HBillType == "1201"; //WMS 采购入库 | 
|---|
|  |  |  | if (flag) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string[] array = sBarCodeNew.Split(new char[] | 
|---|
|  |  |  | { | 
|---|
|  |  |  | '@' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | string str = array[0]; | 
|---|
|  |  |  | string str = array[0]; //物料代码 | 
|---|
|  |  |  | long num = (long)ClsPub.isInt(array[4]); | 
|---|
|  |  |  | string text2 = array[6]; | 
|---|
|  |  |  | DateTime dateTime = ClsPub.isDate(array[3]); | 
|---|
|  |  |  | 
|---|
|  |  |  | string str3 = ClsPub.isStrNull(dataSet.Tables[0].Rows[0]["HNumber"]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //用拆分出来的物料代码查询物料表里的新物料编码 | 
|---|
|  |  |  | 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"]); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"]); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet dataSet5 = clsCN.RunProcReturn(string.Concat(new string[] | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //扫码临时记录表 | 
|---|
|  |  |  | " select * from KF_PonderationBillMain_Temp where  HInterID = ", | 
|---|
|  |  |  | hinterid.ToString(), | 
|---|
|  |  |  | " and HBillType = '", | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | //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,1, oSystemParameterMain, ref DBUtility.ClsPub.sErrInfo); | 
|---|
|  |  |  | WEBSController webscontroller4 = new WEBSController(); | 
|---|
|  |  |  | object obj4 = webscontroller4.get_SourceBarCode_POStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | //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"; | 
|---|
|  |  |  | bool flag5 = HBillType == "1202"; //WMS 生产入库 | 
|---|
|  |  |  | if (flag5) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string text6 = sBarCodeNew.Remove(0, sBarCodeNew.Length - 4); | 
|---|
|  |  |  | 
|---|
|  |  |  | bool flag6 = text7.Contains("W") || text7.Contains("N"); | 
|---|
|  |  |  | if (flag6) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string text8 = sBarCodeNew.Substring(0, 10); | 
|---|
|  |  |  | string str4 = sBarCodeNew.Substring(10, 10); | 
|---|
|  |  |  | string text8 = sBarCodeNew.Substring(0, 10);//商品码    商品码+物料代码+生产日期+批次+失效日期+一位字母+三位数字 | 
|---|
|  |  |  | string str4 = sBarCodeNew.Substring(10, 10);//物料代码 | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | 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)); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string str6 = sBarCodeNew.Substring(0, 10); | 
|---|
|  |  |  | /*前十位物料代码,后六位生效日期,倒数前三位是数字前六位是失效日期 */ | 
|---|
|  |  |  | string str6 = sBarCodeNew.Substring(0, 10);//物料代码 | 
|---|
|  |  |  | 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)); | 
|---|
|  |  |  | 
|---|
|  |  |  | "-", | 
|---|
|  |  |  | num27.ToString() | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | string text20 = sBarCodeNew.Remove(0, 16); | 
|---|
|  |  |  | string text21 = text20.Remove(text20.Length - 9, 9); | 
|---|
|  |  |  | ClsCN clsCN3 = new ClsCN(); | 
|---|
|  |  |  | 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"]); | 
|---|
|  |  |  | 
|---|
|  |  |  | "-", | 
|---|
|  |  |  | num23.ToString() | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | DataSet dataSet16 = clsCN3.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); | 
|---|
|  |  |  | DataSet dataSet16 = clsCN3.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + text1 + "'", "Gy_BarCodeBill"); | 
|---|
|  |  |  | bool flag10 = dataSet16.Tables[0].Rows.Count > 0; | 
|---|
|  |  |  | if (flag10) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //可能和他们的登录组织有关系 | 
|---|
|  |  |  | string billCode3 = "85"; | 
|---|
|  |  |  | long num32 = ClsPub.CreateBillID_Prod(billCode3, ref ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | long num33 = 0L; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag13 = HBillType == "1244"; | 
|---|
|  |  |  | bool flag13 = HBillType == "1244"; //WMS 生产退料单 | 
|---|
|  |  |  | if (flag13) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag14 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag19 = HBillType == "1207"; | 
|---|
|  |  |  | bool flag19 = HBillType == "1207"; //WMS 直接调拨 | 
|---|
|  |  |  | if (flag19) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag20 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag25 = HBillType == "1206"; | 
|---|
|  |  |  | bool flag25 = HBillType == "1206"; //WMS 销售出库 | 
|---|
|  |  |  | if (flag25) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag26 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag31 = HBillType == "1204"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag31 = HBillType == "1204"; //WMS 生产领料 | 
|---|
|  |  |  | if (flag31) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag32 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag37 = HBillType == "1254" || HBillType == "1211" || HBillType == "1255"; | 
|---|
|  |  |  | bool flag37 = HBillType == "1254" /*生产补料*/ || HBillType == "1211" || HBillType == "1255"; | 
|---|
|  |  |  | if (flag37) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag38 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | bool flag43 = HBillType == "1205"; | 
|---|
|  |  |  | bool flag43 = HBillType == "1205"; | 
|---|
|  |  |  | if (flag43) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool flag44 = sBarCodeNew.Contains("@"); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "成功!单据号为:"; | 
|---|
|  |  |  | objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //成功! | 
|---|
|  |  |  | //objJsonResult.Message = "成功!单据号为:"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "上传失败!" + DBUtility.ClsPub.sErrInfo; | 
|---|
|  |  |  | objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //失败! | 
|---|
|  |  |  | //objJsonResult.Message = "上传失败!" + DBUtility.ClsPub.sErrInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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; | 
|---|