From c226ae1fe00a18bf5a61211ddf984c81ec15c10f Mon Sep 17 00:00:00 2001 From: yxj <1qaz@123> Date: 星期五, 18 三月 2022 13:53:02 +0800 Subject: [PATCH] 新增其他出库校验扫码模块,缓存列表模块调用方法 --- CLOUDWEB/WebService1.asmx.cs | 737 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 737 insertions(+), 0 deletions(-) diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs index d8dfa9f..6188d75 100644 --- a/CLOUDWEB/WebService1.asmx.cs +++ b/CLOUDWEB/WebService1.asmx.cs @@ -19092,6 +19092,117 @@ #endregion + #region 鍏朵粬鍑哄簱 鏍¢獙妯″紡* + + //鏍¢獙鍏朵粬鍑哄簱鍗� + [WebMethod] + public bool set_SaveOtherOutBill_BillCheck(Model.ClsKf_OtherOutBillMain oMain, ref string sErrMsg) + { + if (set_SaveOtherOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true) + { + //涓婁紶鎴愬姛 + return true; + } + else + { + //涓婁紶澶辫触 + sErrMsg = "鍗曟嵁鍙凤細" + oMain.HBillNo + "锛屽崟鎹甀D锛�" + oMain.HInterID + "锛涗笂浼犲崟鎹け璐ワ紒" + sErrMsg; + return false; + } + } + + public bool set_SaveOtherOutBill_CLD_BillCheck(Model.ClsKf_OtherOutBillMain oMain, ref string sErrMsg) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //涓婁紶鍓嶅垽鏂� + DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_PreUploadJudgmentBillCheck_OtherOut " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_PreUploadJudgmentBillCheck_OtherOut"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sErrMsg = "鏍¢獙涓婁紶鍓嶅垽鏂紝鍙戠敓閿欒锛�"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1) + { + sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + + try + { + oCn.BeginTran(); + //鍐欏叆鏉$爜鍑哄叆搴撹〃 + oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'"); + + //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮� + if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo)) + { + sErrMsg = Pub_Class.ClsPub.sExeReturnInfo; + return false; + } + + //鑾峰彇CLOUD璐﹀彿瀵嗙爜 + string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName; + string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd; + DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID); + if (ds11 == null || ds11.Tables[0].Rows.Count == 0) + { + } + else + { + sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]); + sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]); + } + + //鐢熸垚 鍏朵粬鍑哄簱鍗� + string HReturn; + ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl); + string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117 + bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052); + if (bLogin) + { + //鎻愪氦鍗曟嵁 + string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; + var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", + new object[] { "STK_MisDelivery", sJson2 }); + //瀹℃牳鍗曟嵁 + string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; + var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", + new object[] { "STK_MisDelivery", sJson3 }); + + HReturn = result2.ToString() + "," + result3.ToString(); + + if (HReturn.Contains("\"IsSuccess\":false") == true) + { + sErrMsg = "瀹℃牳鍏朵粬鍑哄簱鍗曞け璐ワ紒" + HReturn; + oCn.RollBack(); + return false; + } + else + { + oCn.Commit(); + return true; + } + } + else + { + sErrMsg = "瀹℃牳鍏朵粬鍑哄簱鍗曞け璐ワ紒鐧诲綍澶辫触锛�"; + oCn.RollBack(); + return false; + } + } + catch (Exception e) + { + sErrMsg = "瀹℃牳鍏朵粬鍑哄簱鍗曞け璐ワ紒" + e.Message; + oCn.RollBack(); + return false; + } + } + + #endregion + #region 澶栬喘閫�鏂� 澶栬喘鍏ュ簱锛堢孩瀛楋級 *鏃� //鐢熸垚澶栬喘閫�鏂欏崟 @@ -35137,6 +35248,632 @@ #endregion + #region 鏍¢獙妯″紡 鎵爜妯″潡璋冪敤鏂规硶 + + #region 缂撳瓨鍒楄〃缂栬緫鎵撳紑鍗曟嵁鏃讹紝鑾峰彇鍗曟嵁淇℃伅 *鏍¢獙妯″紡 + + [WebMethod] + public Model.ClsKf_ICStockBill_WMS GetSourceBillList_BillCheck(string HBillNo, string HBillType, ref string sErrMsg) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); + //鏍规嵁鍗曟嵁鍙枫�佸崟鎹被鍨嬶紝鑾峰彇鍗曟嵁淇℃伅 + DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_GetSourceBillList_BillCheck '" + HBillNo + "','" + HBillType + "'", "h_p_WMS_GetSourceBillList_BillCheck"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + oBar.HSPFlag = true; + return oBar; + } + else + { + oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]); + oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]); + oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); + oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]); + oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]); + oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); + oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]); + return oBar; + } + } + + #endregion + + #region 鎵弿鍗曟嵁鏉$爜 鍏朵粬鍑哄簱 *鏍¢獙妯″紡 + + [WebMethod] + public Model.ClsKf_ICStockBill_WMS get_BillBarCode_OtherOutCheck(string HBillNo, string HBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); + //灏嗗崟鎹俊鎭瓨鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_OtherOutCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_OtherOutCheck"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛涘皢鍗曟嵁淇℃伅瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃澶辫触锛�"; + return null; + } + else + { + if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) + { + oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]); + oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]); + oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); + oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]); + oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]); + oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); + oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]); + return oBar; + } + else + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛�" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); + return null; + } + } + } + + #endregion + + #region 鎵弿鐗╂枡鏉$爜 *鏍¢獙妯″紡 + + //鎵弿鐗╂枡鏉$爜 瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃 + [WebMethod] + public bool set_SavePonderationBillMain_Temp_BarCode_BillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl(); + Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); + + double sRelQty = 0; + string sBillTypeOneScan = ""; //鏄惁鍚敤涓�娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級 + if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y") + { + //鍏朵粬鍑哄簱鍗� + sBillTypeOneScan = "Y"; + } + + //鍒ゆ柇鏄惁瀛樺湪鐩稿悓鏉$爜锛屽垽鏂槸鍚﹀惎鐢ㄤ竴娆℃壂鐮佹帶鍒讹紝鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓� + DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_BillCheck"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍒ゆ柇鎵�鎵潯鐮佹槸鍚﹀湪鍗曟嵁涓彂鐢熼敊璇紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) + { + omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]); + omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); + omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]); + omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]); + omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]); //婧愬崟鍙壂鏁伴噺 + } + else + { + sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + + //鑾峰彇鎵爜鏁伴噺 + if (omodel_View.HBarCodeType == "鍞竴鏉$爜") + { + //鍗氭棩 鏉$爜鏁伴噺澶т簬婧愬崟鍙壂鏁伴噺锛屽彇婧愬崟鍙壂鏁伴噺 + if (oSystemParameterMain.WMS_CampanyName == "鍗氭棩绉戞妧" && HBillType != "1202" && HBillType != "1205") + { + if (omodel_View.HSourceQty == 0) + { + sErrMsg = "宸叉壂鎻忔暟閲忕瓑浜庢垨澶т簬鍗曟嵁鏁伴噺锛屼笉鍏佽鎵爜锛�"; + return false; + } + else if (omodel_View.HQty > omodel_View.HSourceQty) + { + omodel_View.HQty = omodel_View.HSourceQty; + } + } + + if (HQty > 0 && omodel_View.HQty > HQty) + { + sRelQty = HQty; + } + else + { + sRelQty = omodel_View.HQty; + } + + if (omodel_View.HSourceQty == 0) + { + sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�"; + return false; + } + else if (sRelQty > omodel_View.HSourceQty) + { + sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲鍗曟嵁鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�"; + return false; + } + } + else + //鎵规鏉$爜銆佸搧绉嶆潯鐮� + { + if (HQty > 0) + { + sRelQty = HQty; + } + else if (omodel_View.HSourceQty > 0) + { + sRelQty = omodel_View.HSourceQty; + } + else + { + sRelQty = omodel_View.HQty; + } + + if (omodel_View.HSourceQty == 0) + { + sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�"; + return false; + } + else if (sRelQty > omodel_View.HSourceQty) + { + sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲鍗曟嵁鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�"; + return false; + } + } + + //鐢熶骇棰嗘枡锛�1204锛夈�侀攢鍞嚭搴擄紙1205锛夈�佸叾浠栧嚭搴撹摑瀛楋紙1206锛夈�佸澶栧嚭搴擄紙1211锛� + //澶栬喘閫�鏂欙紙1239锛夈�佷骇鍝侀��搴擄紙1245锛夈�佸叾浠栧叆搴撶孩瀛楋紙1248锛夈�佸澶栭��搴擄紙1246锛� + //鐢熶骇琛ユ枡锛�1254锛� + //鍑哄簱銆佺孩瀛楀叆搴擄紝鍒ゆ柇鏉$爜搴撳瓨銆丒RP搴撳瓨 + double sWMSQty = 0; //鏉$爜搴撳瓨鏁伴噺 + double sERPQty = 0; //ERP搴撳瓨鏁伴噺 + if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211" + || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246" + || HBillType == "1254") + { + //搴撳瓨鎺у埗-WMS璐熷簱瀛樻帶鍒� + if (oSystemParameterMain.WMS_WMSStockCtl == "Y") + { + //鍒ゆ柇ERP搴撳瓨 杩斿洖ERP搴撳瓨鏁伴噺 + DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP"); + if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍒ゆ柇WMS鏉$爜搴撳瓨锛屽彂鐢熼敊璇紒"; + return false; + } + else + { + sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); + //鍒ゆ柇鎵弿鏉$爜鏁伴噺涓庢潯鐮佸簱瀛樻暟閲� + if(sRelQty> sWMSQty) + { + sRelQty = sWMSQty; + } + } + } + + //鍒ゆ柇ERP搴撳瓨 杩斿洖ERP搴撳瓨鏁伴噺 + DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory"); + if (DsERP == null || DsERP.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍒ゆ柇ERP搴撳瓨锛屽彂鐢熼敊璇紒"; + return false; + } + else + { + if (DBUtility.ClsPub.isLong(DsERP.Tables[0].Rows[0][0]) == 0) + { + sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]); + sRelQty = sERPQty; + } + else + { + sErrMsg = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HRemark"]); + return false; + } + } + + if (sRelQty == 0) + { + sErrMsg = "鎵�鎵弿鏉$爜鏃犳潯鐮佸簱瀛橈紒"; + return false; + } + } + //閲囪喘鍏ュ簱锛�1201锛夈�佷骇鍝佸叆搴擄紙1202锛夈�佸叾浠栧叆搴撹摑瀛楋紙1203锛夈�佸澶栧叆搴擄紙1210锛� + //鐢熶骇閫�鏂欙紙1244锛夈�侀攢鍞��搴擄紙1247锛夈�佸叾浠栧嚭搴撶孩瀛楋紙1249锛夈�佸澶栭��鏂欙紙1238锛� + //鍏ュ簱銆佺孩瀛楀嚭搴擄紝鍒ゆ柇鏉$爜鍙壂鎻忔暟閲� 杩斿洖鍓╀綑鏈壂鎻忔暟閲� + else + { + //鍒ゆ柇鏉$爜鎵弿鏁伴噺 杩斿洖鍓╀綑鏈壂鎻忔暟閲� + if (!tem.IsBarCode_New(sBarCode, HBillType, false, ref sRelQty, ref sErrMsg)) + { + sErrMsg = sErrMsg; + return false; + } + } + + oMain.HInterID = HBillID; + oMain.HBillNo = HBillNo; + oMain.HBillType = HBillType; + oMain.HMaker = HMaker; + oMain.HMaterID = omodel_View.HMaterID; + oMain.HAuxPropID = omodel_View.HAuxPropID; + oMain.HQty = sRelQty; + oMain.HQtyMust = 0; + oMain.HBarCode = omodel_View.HBarCode; + oMain.HBatchNo = omodel_View.HBatchNo; + oMain.HMTONo = omodel_View.HMTONo; + oMain.HWhID = HWhID; + oMain.HStockPlaceID = HSPID; + oMain.HSourceInterID = omodel_View.HSourceInterID; + oMain.HSourceEntryID = omodel_View.HSourceEntryID; + oMain.HSourceBillNo = omodel_View.HSourceBillNo; + oMain.HSourceBillType = HBillType; + oMain.HRedBlueFlag = false; + oMain.HPieceQty = 1; + oMain.HSTOCKORGID = HOWNERID; + oMain.HOWNERID = HOWNERID; + + oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + + "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" + + ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" + + ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" + + ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + + ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" + + ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" + + ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + + " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() + + "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" + + "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" + + ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" + + "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" + + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','鏍¢獙妯″紡',1" + + ",0,0,'" + oMain.HCusBarCode + "',0)"); + return true; + } + + #endregion + + #region 涓�閿壂鐮� *鏍¢獙妯″紡 + + //涓�閿壂鐮佹ā寮忥紝鏍规嵁鏉$爜鍓嶇紑璧� 涓嶅悓鏂规硶锛堜粨搴撴潯鐮併�佷粨浣嶆潯鐮併�佸崟鎹彿鏉$爜銆佺墿鏂欐潯鐮侊級 + [WebMethod] + public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_BillCheck(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, ref string sErrMsg) + { + try + { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBill(ref sErrMsg) == false) + { + sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; + return null; + } + + if (sBarCode.Trim()=="") + { + sErrMsg = "鏉$爜涓嶈兘涓虹┖锛岃鎵弿鏉$爜锛�"; + return null; + } + else + { + //鍒ゆ柇鏉$爜鏄惁鍚壒娈婄鍙� # 锛屽鏋滃惈鏈夊垯 鎷嗗垎 + string[] NewBarCode; + if (sBarCode.CompareTo("#") > 0) + { + NewBarCode = sBarCode.Split(Convert.ToChar("#")); + sBarCode = NewBarCode[0]; + } + } + + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); + + //鏍规嵁绯荤粺鍙傛暟锛屽垽鏂槸鍚﹀惎鐢ㄤ竴閿壂鐮佹ā寮忥紝Y涓哄惎鐢� + //鏈惎鐢紝鍙壂鎻忕墿鏂欐潯鐮� + if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N") + { + DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); + if (dal.GetInfoByBarCode_View(sBarCode)) + { + if (dal.omodel_View.HStopflag) + { + sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�"; + return null; + } + else + { + //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮� + if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜") + { + //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + DataSet dsTBarCode; + string sBarCode_MX; + dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " + + " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum"); + if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) + { + sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒"; + return null; + } + else + { + for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) + { + sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]); + + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + } + return oBar; + } + } + else + //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜 + { + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + return oBar; + } + } + } + else + { + sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�"; + return null; + } + } + //鍚敤锛屾牴鎹潯鐮佸墠缂�璧颁笉鍚屾柟娉曪紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�佸崟鎹潯鐮併�佺墿鏂欐潯鐮侊級 + else + { + string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆 + + //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�佸崟鎹潯鐮併�佺墿鏂欐潯鐮侊級 + DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType"); + + //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮� + if (Dss == null || Dss.Tables[0].Rows.Count == 0) + { + DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); + if (dal.GetInfoByBarCode_View(sBarCode)) + { + if (dal.omodel_View.HStopflag) + { + sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�"; + return null; + } + else + { + //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮� + if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜") + { + //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + DataSet dsTBarCode; + string sBarCode_MX; + dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " + + " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum"); + if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) + { + sErrMsg = "娌℃湁鎵惧埌鎵樼洏鏉$爜瀵瑰簲瀛愭潯鐮佽褰曪紒"; + return null; + } + else + { + for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) + { + sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]); + + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + } + return oBar; + } + } + else + //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜 + { + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + return oBar; + } + } + } + else + { + sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�"; + return null; + } + } + //浠撳簱鏉$爜銆佷粨浣嶆潯鐮併�佸崟鎹潯鐮� + else + { + string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]); + string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]); + + //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜 + if (sBarBillType == "鍩虹璧勬枡鏉$爜") + { + //浠撳簱鏉$爜 + if (sBarBillName == "浠撳簱") + { + DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View(); + //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰,TryParse涓嶈兘杞崲鎴愭暣鏁版椂杩斿洖false锛屽苟杩斿洖ID=0 + int ID; + if (int.TryParse(sBarCode.Remove(0, 3), out ID)) + { + if (dal.GetInfoByID(ID, HOWNERID)) + { + oBar.HBarType = "浠撳簱鏉$爜"; + oBar.HWhID = dal.omodel.HItemID; + oBar.HWhNumber = dal.omodel.HNumber; + oBar.HWhName = dal.omodel.HName; + oBar.HSPFlag = dal.omodel.HIsStockMgr; + return oBar; + } + else + { + sErrMsg = "鏃犳晥浠撳簱鏉$爜锛�"; + return null; + } + } + else + { + sErrMsg = "閿欒鐨勪粨搴撴潯鐮侊紒"; + return null; + } + } + //浠撲綅鏉$爜 + else if (sBarBillName == "浠撲綅") + { + DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View(); + //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰 + int sHSPID; + int sHWHID; + string[] sArray = sBarCode.Remove(0, 3).Split(';'); + if (int.TryParse(sArray[1], out sHSPID) && int.TryParse(sArray[0], out sHWHID)) + { + if (dal.GetInfoByID(sHSPID, sHWHID, HOWNERID)) + { + oBar.HBarType = "浠撲綅鏉$爜"; + oBar.HSPID = dal.omodel.HItemID; + oBar.HSPNumber = dal.omodel.HNumber; + oBar.HSPName = dal.omodel.HName; + oBar.HWhID = dal.omodel.HWHID; + oBar.HWhNumber = dal.omodel.HWhNumber; + oBar.HWhName = dal.omodel.HWhName; + return oBar; + } + else + { + sErrMsg = "鏃犳晥浠撲綅鏉$爜锛�"; + return null; + } + } + else + { + sErrMsg = "閿欒鐨勪粨浣嶆潯鐮侊紒"; + return null; + } + } + else + { + sErrMsg = "鏃犳晥鍩虹璧勬枡鏉$爜锛�"; + return null; + } + } + //鍗曟嵁鏉$爜 + else if (sBarBillType == "婧愬崟鏉$爜") + { + DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType"); + + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + sErrMsg = "鎵�鎵崟鎹潯鐮佷笉灞炰簬褰撳墠妯″潡锛�"; + return null; + } + else + { + sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]); + //鍏朵粬鍑哄簱鍗� 婧愬崟锛氬叾浠栧嚭搴撳崟 + if (sBarBillName == "鍏朵粬鍑哄簱鍗�" && HBillType == "1206") + { + oBar = get_BillBarCode_OtherOutCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg); + if (oBar == null) + { + sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝" + sErrMsg; + return null; + } + else + { + oBar.HBarType = "鍗曟嵁鏉$爜"; + return oBar; + } + } + else + { + sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝鎵�鎵潯鐮佸墠缂�涓嶅睘浜庡綋鍓嶆ā鍧楀崟鎹彿鍓嶇紑锛�"; + return null; + } + } + } + else + { + sErrMsg = "鍚敤涓�閿壂鐮佹ā寮忥紝鎵�鎵潯鐮佸墠缂�璁剧疆閿欒锛�"; + return null; + } + } + } + } + catch (Exception e) + { + sErrMsg = e.Message + ";" + e.StackTrace; + return null; + } + } + + #endregion + + #region 杩斿洖鍗曟嵁鐗╂枡鍒楄〃淇℃伅 *鏍¢獙妯″紡 + + [WebMethod] + public DataSet GetKf_PonderationBillMain_Temp_BillCheck(long HInterID, string sBillType, string sWhere) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck"); + if (DS == null || DS.Tables[0].Rows.Count == 0) + { + return null; + } + else + { + return DS; + } + } + + #endregion + + + + #region 缂撳瓨妯″潡璋冪敤鏂规硶 *鏍¢獙妯″紡 + //缂撳瓨鍒楄〃鐣岄潰锛岃繑鍥炵紦瀛樺垪琛ㄤ俊鎭� + [WebMethod] + public DataSet GetKf_PonderationBillMain_TempList_BillCheck(string sHBillType, string sHMaker, Int64 sHOWNERID) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck"); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + return null; + } + else + { + return Ds; + } + } + + #endregion + + #endregion + + #region 妗岄潰鏉$爜鐢熸垚澶栫綉鐗� [WebMethod] -- Gitblit v1.9.1