| | |
| | | //森楷专用 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','整托扫码'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle"); |
| | | if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, SourceFlag, HSourceBillType, HStockInOrgID, HStockOutOrgID, "整托扫码", oSystemParameter.omodel, ref sErrMsg)) |
| | | { |
| | | sErrMsg = "获取整托条码信息发生错误!"; |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2) |
| | | { |
| | | 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 + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | //扫描物料条码 存入条码出入库临时表 调拨 |
| | | [WebMethod] |
| | | public bool set_SavePonderationBillMain_Temp_BarCode_MoveStock_SenKai(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, string HScanStyle, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | string sBarCode_New = ""; |
| | | |
| | | //判断调入仓库、仓位是否有效 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | //根据单个条码获取对应整托条码信息 |
| | | DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle"); |
| | | if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取整托条码信息发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2) |
| | | { |
| | | sErrMsg = "此模块不允许反向拆码!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]); |
| | | //获取调出仓库仓位信息 |
| | | if (HSCWHID == 0) |
| | | { |
| | | HSCWHID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]); |
| | | HSCSPID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"]); |
| | | } |
| | | else |
| | | { |
| | | if (HSCWHID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HWHID"]) || HSCSPID != DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSPID"])) |
| | | { |
| | | sErrMsg = "条码对应物料在界面所选调出仓库、调出仓位上无库存!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //将整托条码对应的条码编号拼成一串字符串 |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | sBarCode_New = sBarCode_New + "," + DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCode"]); |
| | | } |
| | | sBarCode_New = sBarCode_New.Remove(0, 1); //去掉字符串第一个字符 |
| | | |
| | | //无源单状态,设置源单类型为-1 |
| | | if (SourceFlag == false) |
| | | { |
| | | HSourceBillType = "-1"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //判断调出仓库、仓位是否有效 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | if (HWhID == HSCWHID && HSPID == HSCSPID) |
| | | { |
| | | sErrMsg = "调入仓库、仓位不能与调出仓库、仓位相同!"; |
| | | return false; |
| | | } |
| | | |
| | | //唯一条码,是否启用一次扫码控制('Y'为启用) |
| | | if (omodel_View.HBarCodeType == "唯一条码" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan.ToUpper() == "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 = omodel_View.HQty; |
| | | 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) " + |
| | | " select " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "',HMaterID,HAuxPropID," + oMain.HProcID.ToString() + |
| | | "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" + |
| | | "," + oMain.HQtyMust.ToString() + ",HQty," + oMain.HPieceQty.ToString() + ",HBatchNo,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" + |
| | | "from Gy_BarCodeBill with(nolock) where charindex(',' + HBarCode + ',',',' + '" + sBarCode_New + "' + ',')>0" |
| | | ); |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | |
| | | |
| | | #region 扫描模具源单条码 |
| | | |
| | | [WebMethod] |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_Mould get_CheckTypeByMouldSource(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HHMaker, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |