From 5d6f29b0a3561ec25424662d76a80dc024770d1f Mon Sep 17 00:00:00 2001 From: yxj <1qaz@123> Date: 星期六, 18 六月 2022 11:28:58 +0800 Subject: [PATCH] 增加森楷其他入库、直接调拨扫码处理方法;增加森楷桌面自动更新调用 --- DLL/Model.dll | 0 DLL/DAL.dll | 0 CLOUDWEB/WebService1.asmx.cs | 546 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 546 insertions(+), 0 deletions(-) diff --git a/CLOUDWEB/WebService1.asmx.cs b/CLOUDWEB/WebService1.asmx.cs index d3a75ff..5a94fc6 100644 --- a/CLOUDWEB/WebService1.asmx.cs +++ b/CLOUDWEB/WebService1.asmx.cs @@ -30548,6 +30548,26 @@ return false; } } + else if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") + { + SqlConnection ocn = new SqlConnection(@"Data Source=192.168.10.66;DataBase=master;User ID=HX_USER;PWD=lc@841022;max pool size=32767");//妫シ + ocn.Open(); + SqlCommand cm = new SqlCommand(sSQL, ocn); + cm.CommandTimeout = 600; + SqlDataReader dr = cm.ExecuteReader(); + //byte[] oFile = null; + if (dr.Read()) + { + FileItem = (byte[])dr["FFile"]; + return true; + } + else + { + FileItem = null; + sSQL = ""; + return false; + } + } else { FileItem = null; @@ -34199,6 +34219,49 @@ } return oBar; } + //鍏朵粬鍏ュ簱 妫シ涓撶敤 + else if (HBillType == "1203" && oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + string sBarCode_New; + DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToBarCode"); + if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) + { + sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�"; + return null; + } + else + { + if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1) + { + sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]); + return null; + } + else + { + for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) + { + sBarCode_New = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); + if (set_SavePonderationBillMain_Temp_BarCode(sBarCode_New, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, ref sHSourceBillNo, ref sHSourceBillType, ref sHSupID, ref sHSupName, ref sHDeptID, ref sHDeptName, ref sErrMsg)) + { + oBar.HSourceBillType = sHSourceBillType; + oBar.HSourceBillNo = sHSourceBillNo; + oBar.HSupID = sHSupID; + oBar.HSupName = sHSupName; + oBar.HDeptID = sHDeptID; + oBar.HDeptName = sHDeptName; + SourceFlag = true; + } + else + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忓け璐ワ紒" + sBarCode_New + sErrMsg; + return null; + } + } + } + return oBar; + } + } //鐢熶骇鍏ュ簱 澶氭簮鍗曟ā寮� else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y") { @@ -35779,6 +35842,489 @@ #endregion + #region 鐗╂枡鏉$爜璋冪敤鏂规硶 + + #region 鎵弿鐗╂枡鏉$爜 璋冩嫧 + + [WebMethod] + public Model.ClsKf_ICStockBill_WMS get_BarCode_MoveStock(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, string HScanStyle, ref string sErrMsg) + { + try + { + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + if (oSystemParameter.ShowBill(ref sErrMsg) == false) + { + sErrMsg = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg; + return null; + } + + sBarCode = sBarCode.Trim(); + if (sBarCode == "") + { + 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(); + DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); + string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//鎴彇鏉$爜鍓嶄笁浣嶅瓧绗︿覆 + + if (sBarCodePrefix == "PAK") + { + bool HRedBlueFlag = false; + //灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛� + DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOutOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New"); + if (Mould == null || Mould.Tables[0].Rows.Count == 0) + { + sErrMsg = "灏嗘ā娌诲叿淇℃伅鍐欏叆妯℃不鍏峰嚭鍏ュ簱涓存椂琛ㄥけ璐ワ紒"; + return null; + } + else + { + if (DBUtility.ClsPub.isLong(Mould.Tables[0].Rows[0][0]) == 0) + { + oBar.HBarType = "妯℃不鍏锋潯鐮�"; + return oBar; + } + else + { + sErrMsg = DBUtility.ClsPub.isStrNull(Mould.Tables[0].Rows[0]["HRemark"]); + return null; + } + } + } + else + { + if (dal.GetInfoByBarCode_View(sBarCode)) + { + if (dal.omodel_View.HStopflag) + { + sErrMsg = "鏉$爜宸茶绂佺敤锛屼笉鍏佽鎵弿锛�"; + return null; + } + else + { + //妫シ涓撶敤 + if (oSystemParameter.omodel.WMS_CampanyName == "妫シ") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + //鏍规嵁鍗曚釜鏉$爜鑾峰彇瀵瑰簲鏁存墭鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + if(dal.omodel_View.HBarCodeType == "") + { + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + return oBar; + } + else + { + DataSet dsTBarCode = oCn.RunProcReturn("select HBarCode,HBarCodeType,HMaterID,HAuxPropID,HBatchNo,HQty,HMTONo from Gy_BarCodeBill with(nolock) where HStopflag=0 and HOutStockCounts=0 and HBarCode_Pack= '" + dal.omodel_View.HBarCode_Pack + "'", "Gy_BarCodeBill"); + if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) + { + sErrMsg = "鑾峰彇鏁存墭鏉$爜淇℃伅鍙戠敓閿欒锛�"; + return null; + } + else + { + for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) + { + dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); + dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]); + dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]); + dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]); + dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]); + dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]); + dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]); + //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1 + if (SourceFlag == false) + { + HSourceBillType = "-1"; + } + if (i!=0) + { + SourceFlag = true; + } + + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + } + return oBar; + } + } + } + else + { + //鍒ゆ柇鏉$爜绫诲瀷鏄惁涓烘墭鐩樻潯鐮侊紝濡傛灉鏄墭鐩樻潯鐮佸垯鍒嗚В骞舵ā鎷熸壂鐮� + if (dal.omodel_View.HBarCodeType == "鎵樼洏鏉$爜") + { + //鍒嗚В鎵樼洏鏉$爜寰楀埌鏄庣粏鏉$爜淇℃伅鍐欏叆鏉$爜鍑哄叆搴撲复鏃惰〃 + DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToTPBarCode '" + sBarCode + "'", "h_p_WMS_BeforeCheckToTPBarCode"); + if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍒嗚В鎵樼洏鏉$爜鍙戠敓閿欒锛�"; + return null; + } + else + { + if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1) + { + sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]); + return null; + } + else + { + for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) + { + dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); + dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeType"]); + dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HMaterID"]); + dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HAuxPropID"]); + dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBatchNo"]); + dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[i]["HQty"]); + dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceInterID"]); + dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[i]["HSourceEntryID"]); + dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HSourceBillNo"]); + dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HMTONo"]); + //鏃犳簮鍗曠姸鎬侊紝璁剧疆婧愬崟绫诲瀷涓�-1 + if (SourceFlag == false) + { + HSourceBillType = "-1"; + } + if (i != 0) + { + SourceFlag = true; + } + + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + } + } + return oBar; + } + } + else + //鏉$爜绫诲瀷涓嶄负鎵樼洏鏉$爜 + { + //灏嗙墿鏂欐潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛� + if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, oSystemParameter.omodel, ref sErrMsg)) + { + sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HBillID + "锛涙壂鎻忕墿鏂欐潯鐮佸け璐ワ紒" + sErrMsg; + return null; + } + return oBar; + } + } + } + } + else + { + sErrMsg = "鏉$爜妗f涓笉瀛樺湪璇ユ潯鐮侊紝璇风‘璁ゆ潯鐮佹槸鍚︽纭垨鏄惁宸茶鍒犻櫎锛�"; + return null; + } + } + } + catch (Exception e) + { + sErrMsg = e.Message + ";" + e.StackTrace; + return null; + } + } + + //鎵弿鐗╂枡鏉$爜 瀛樺叆鏉$爜鍑哄叆搴撲复鏃惰〃 璋冩嫧 + [WebMethod] + public bool set_SavePonderationBillMain_Temp_BarCode_MoveStock(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWHID, Int64 HSCSPID, Double HQty, bool SourceFlag, string HSourceBillType, Int64 HStockInOrgID, Int64 HStockOutOrgID, 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(); + + //鍒ゆ柇璋冨叆浠撳簱銆佷粨浣嶆槸鍚︽湁鏁� + if (HWhID == 0) + { + sErrMsg = "璋冨叆浠撳簱娌℃湁閫夋嫨锛�"; + return false; + } + else + { + //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣� + DataSet dsWh = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HWhID.ToString() + " and HUSEORGID= " + HStockInOrgID.ToString(), "Gy_Warehouse"); + if (dsWh == null || dsWh.Tables[0].Rows.Count == 0) + { + sErrMsg = "鎵�閫夎皟鍏ヤ粨搴撲笉灞炰簬璇ヨ皟鍏ョ粍缁囷紒"; + return false; + } + else if (HSPID == 0 && DBUtility.ClsPub.isBool(dsWh.Tables[0].Rows[0]["HSPFlag"]) == true) + { + sErrMsg = "璋冨叆浠撲綅娌℃湁閫夋嫨锛�"; + return false; + } + } + + //1銆侀娆℃壂鐮侀槻涓插崟鍒ゆ柇锛� 2銆佹簮鍗曠被鍨嬫槸鍚﹀湪婧愬崟鍒楄〃閲屽垽鏂紱3銆佸敮涓�鏉$爜鏄惁瀛樺湪鐩稿悓鏉$爜鍒ゆ柇锛� 4銆佹湁婧愬崟锛岀墿鏂欐槸鍚﹀湪婧愬崟涓垽鏂� + DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStock '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag), "h_p_WMS_AddBarCode_MoveStock"); + 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; + } + } + + double sRelQty = 0; + //鑾峰彇鎵爜鏁伴噺 + if (omodel_View.HBarCodeType == "鍞竴鏉$爜") + { + if (HQty > 0 && omodel_View.HQty > HQty) + { + sRelQty = HQty; + } + else + { + sRelQty = omodel_View.HQty; + } + + //鐩存帴璋冩嫧 鏈夋簮鍗曟壂鐮侊紝鏍规嵁绯荤粺鍙傛暟锛氱洿鎺ヨ皟鎷�-搴旀敹鏁伴噺 鎺у埗鎵爜鏁伴噺鑳藉惁鍙秴鍗曟嵁鏁伴噺锛堝皬浜庣瓑浜庡簲鏀躲�佸畬鍏ㄧ瓑浜庡簲鏀躲�佷笉鎺у埗锛� + if (HBillType == "1207" && omodel_View.HSourceInterID != 0 + && (oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "瀹屽叏绛変簬搴旀敹")) + { + 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 (HBillType == "1207" && omodel_View.HSourceInterID != 0 + && (oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "灏忎簬绛変簬搴旀敹" || oSystemParameterMain.Kf_MoveStockBill_MustQtyCtl == "瀹屽叏绛変簬搴旀敹")) + { + if (omodel_View.HSourceQty == 0) + { + sErrMsg = "鎵�鎵墿鏂欏湪鍗曟嵁涓墿浣欏彲鎵暟閲忎负0锛屼笉鍏佽鎵爜锛�"; + return false; + } + else if (sRelQty > omodel_View.HSourceQty) + { + sErrMsg = "鎵�鎵弿鏉$爜鏁伴噺涓� " + sRelQty.ToString() + " 澶т簬瀵瑰簲婧愬崟鍓╀綑鍙壂鎻忔暟閲�" + omodel_View.HSourceQty.ToString() + "锛屼笉鍏佽鎵爜锛�"; + return false; + } + } + } + + double sWMSQty = 0; //鏉$爜搴撳瓨鏁伴噺 + double sERPQty = 0; //ERP搴撳瓨鏁伴噺 + if (omodel_View.HBarCodeType == "鍞竴鏉$爜") + { + //鍒ゆ柇鏉$爜搴撳瓨 搴撳瓨鎺у埗-WMS璐熷簱瀛樻帶鍒� + if (oSystemParameterMain.WMS_WMSStockCtl == "Y") + { + //鍒ゆ柇ERP搴撳瓨 杩斿洖ERP搴撳瓨鏁伴噺 + DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP"); + if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) + { + sErrMsg = "鍒ゆ柇WMS鏉$爜搴撳瓨锛屽彂鐢熼敊璇紒"; + return false; + } + else + { + HSCWHID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); + HSCSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); + sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); + //鍒ゆ柇鎵弿鏉$爜鏁伴噺涓庢潯鐮佸簱瀛樻暟閲� + if (sRelQty > sWMSQty) + { + sRelQty = sWMSQty; + } + } + } + } + + //鍒ゆ柇璋冨嚭浠撳簱銆佷粨浣嶆槸鍚︽湁鏁� + if (HSCWHID == 0) + { + sErrMsg = "璋冨嚭浠撳簱娌℃湁閫夋嫨锛�"; + return false; + } + else + { + //鏍规嵁浠撳簱ID锛屽垽鏂槸鍚﹀惎鐢ㄤ粨浣� + DataSet dsSCWH = oCn.RunProcReturn(" select HSPFlag from Gy_Warehouse with(nolock) where HItemID= " + HSCWHID.ToString() + " and HUSEORGID= " + HStockOutOrgID.ToString(), "Gy_Warehouse"); + if (dsSCWH == null || dsSCWH.Tables[0].Rows.Count == 0) + { + sErrMsg = "鎵�閫夎皟鍑轰粨搴撲笉灞炰簬璇ヨ皟鍑虹粍缁囷紒"; + return false; + } + else if (HSCSPID == 0 && DBUtility.ClsPub.isBool(dsSCWH.Tables[0].Rows[0]["HSPFlag"]) == true) + { + sErrMsg = "璋冨嚭浠撲綅娌℃湁閫夋嫨锛�"; + return false; + } + } + + //鍒ゆ柇ERP搴撳瓨 搴撳瓨鎺у埗-ERP璐熷簱瀛樻帶鍒� + if (oSystemParameterMain.WMS_ERPStockCtl == "Y") + { + //鍒ゆ柇ERP搴撳瓨 杩斿洖ERP搴撳瓨鏁伴噺 + DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HStockOutOrgID.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 = "鎵�鎵弿鏉$爜鏃犳潯鐮佸簱瀛樻垨瀵瑰簲鐗╂枡鏃燛RP搴撳瓨锛�"; + return false; + } + + if(HWhID ==HSCWHID && HSPID == HSCSPID) + { + sErrMsg = "璋冨叆浠撳簱銆佷粨浣嶄笉鑳戒笌璋冨嚭浠撳簱銆佷粨浣嶇浉鍚岋紒"; + return false; + } + + string sBillTypeOneScan = ""; //鏄惁鍚敤涓�娆℃壂鐮佹帶鍒讹紙'Y'涓哄惎鐢級 + if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y") + { + //鐩存帴璋冩嫧鍗� + sBillTypeOneScan = "Y"; + } + if (sBillTypeOneScan == "Y") + { + //涓�娆℃壂鐮佹帶鍒讹紝鍚屼竴鏉$爜銆佸悓涓�鍗曟嵁绫诲瀷锛屽湪WMS琛ㄥ拰TEMP琛ㄩ噷锛屽彧鍏佽杩涜涓�娆℃壂鐮� + DataSet ds = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan " + HBillID.ToString() + ",'" + omodel_View.HBarCode + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWHID.ToString() + "," + HSCSPID.ToString() + ",'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + } + else + { + if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1) + { + 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.HSCWHID = HSCWHID; + oMain.HOutStockPlaceID = HSCSPID; + oMain.HSourceInterID = omodel_View.HSourceInterID; + oMain.HSourceEntryID = omodel_View.HSourceEntryID; + oMain.HSourceBillNo = omodel_View.HSourceBillNo; + oMain.HSourceBillType = HSourceBillType; + oMain.HRedBlueFlag = false; + oMain.HPieceQty = 1; + oMain.HSTOCKORGID = HStockOutOrgID; + oMain.HOWNERID = HStockInOrgID; + + 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.HOWNERID.ToString() + "," + oMain.HSTOCKORGID.ToString() + ",'','',0" + + ",0,0,'" + oMain.HCusBarCode + "',0)"); + return true; + } + + #endregion + + #endregion + + // #region 鎵弿鐗╂枡鏉$爜璋冪敤鏂规硶 // #region 鎵弿鐗╂枡鏉$爜 diff --git a/DLL/DAL.dll b/DLL/DAL.dll index 96d24ba..7e3a437 100644 --- a/DLL/DAL.dll +++ b/DLL/DAL.dll Binary files differ diff --git a/DLL/Model.dll b/DLL/Model.dll index 23b1020..3a208f5 100644 --- a/DLL/Model.dll +++ b/DLL/Model.dll Binary files differ -- Gitblit v1.9.1