| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 产品入库单 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | [WebMethod] |
| | | //根据物料条码 返回物料信息 规格型号 数量 |
| | | public bool GetInfoByBarCode(string sBarCode, ref string sMaterName, ref string sMaterNumber, ref long sMaterID, ref string sMaterModel, ref long sUnitID, ref string sUnitName, ref double sQty) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_GetInfoByBarCode_AGV '" + sBarCode + "'", "h_p_GetInfoByBarCode_AGV"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | sMaterName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterName"]); |
| | | sMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]); |
| | | sMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); |
| | | sMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterModel"]); |
| | | sUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]); |
| | | sUnitName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnitName"]); |
| | | sQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | [WebMethod] |
| | | public bool set_SaveKf_AGVRequestBill(Model.ClsKf_AGVRequestBillMain oMain, ref string sErrMsg) |
| | | { |
| | | if (SaveKf_AGVRequestBill(oMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// AGV配送单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveKf_AGVRequestBill(Model.ClsKf_AGVRequestBillMain oMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | try |
| | | { |
| | | //插入子表 |
| | | oCn.RunProc("Insert Into Kf_AGVRequestBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSPID,HWHID,HSCWHID,HSCSPID,HOWNERID" + |
| | | ") " + |
| | | " values('1299','1299'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),''" + |
| | | ",2012,1,'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSPID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HSCSPID.ToString() + "," + oMain.HOrgID.ToString() + |
| | | ") "); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_AGVRequestBillSub " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSPID,HWHID,HSCWHID,HSCSPID,HQty,HMaterID,HOWNERID" + |
| | | ") " + |
| | | " values('1299','1299'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),''" + |
| | | ",2012,1,'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSPID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HSCSPID.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HMaterID.ToString() + "," + oMain.HOrgID.ToString() + |
| | | ") "); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "AGV配送单失败!" + e.Message; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | #region 产品退库 产品入库(红字) *旧 |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | //AGV配送单列表界面,返回AGV配送单信息 |
| | | [WebMethod] |
| | | public DataSet GetAGVBillList_New(string sHMaker, Int64 sHOWNERID) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_AGVBillList_New '" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_AGVBillList_New"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return Ds; |
| | | } |
| | | } |
| | | |
| | | //AGV配送单列表界面查询按钮 根据单号过滤信息 |
| | | [WebMethod] |
| | | public DataSet GetAGVBillList_BillNoQuery(string sBillNo) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBillQueryList_AGV '" + sBillNo + "'", "h_p_Kf_ICStockBillQueryList_AGV"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return Ds; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //已上传列表界面,撤销功能,删除WMS表和本地出入库单记录,并更新TEMP表中的上传字段 HRelationInterID=0 |
| | |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "圣龙") |
| | | { |
| | | SqlConnection ocn = new SqlConnection(@"Data Source=192.168.1.34;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 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; |
| | |
| | | } |
| | | 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 + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | //生产入库 多源单模式 |
| | | else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y") |
| | | { |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region 物料条码调用方法 |
| | | |
| | | #region 一键扫码 |
| | | |
| | | //一键扫码模式,根据条码前缀走 不同方法(仓库、仓位、部门)(源单、物料条码) |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_New(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, string HExpressNumber, string HScanStyle, ref string sErrMsg) |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl(); |
| | | Model.ClsKF_PonderationBillMain_Temp model = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | string sHSourceBillType = ""; |
| | | string sHSourceBillNo = ""; |
| | | Int64 sHSupID = 0; |
| | | string sHSupName = ""; |
| | | Int64 sHDeptID = 0; |
| | | string sHDeptName = ""; |
| | | string sHBarType = ""; |
| | | sBarCode = sBarCode.Trim(); |
| | | string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//截取条码前三位字符串 |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | return null; |
| | | } |
| | | //销售出库、销售退库模块扫码流程 飞龙专用 |
| | | if ((HBillType == "1205" || HBillType == "1247") && oSystemParameter.omodel.WMS_CampanyName == "飞龙") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //将物料条码信息写入出入库条码临时表 |
| | | if (set_SavePonderationBillMain_Temp_FeiLong(sBarCode, 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 sHBarType, ref sErrMsg)) |
| | | { |
| | | oBar.HBarType = sHBarType; |
| | | oBar.HSourceBillType = sHSourceBillType; |
| | | oBar.HSourceBillNo = sHSourceBillNo; |
| | | oBar.HSupID = sHSupID; |
| | | oBar.HSupName = sHSupName; |
| | | oBar.HDeptID = sHDeptID; |
| | | oBar.HDeptName = sHDeptName; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "!" + sErrMsg; |
| | | return null; |
| | | } |
| | | 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 + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | //销售出库 森楷专用 |
| | | else if (HBillType == "1205" && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | string sBarCode_New; |
| | | DataSet dsTBarCode = oCn.RunProcReturn("exec h_p_WMS_BeforeCheckToBarCode_ScanStyle '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillType + "','" + HScanStyle + "'", "h_p_WMS_BeforeCheckToBarCode_ScanStyle"); |
| | | 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 if (DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0][0]) == 2) |
| | | { |
| | | oCn.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID=" + HBillID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | return oBar; |
| | | } |
| | | 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 + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | //生产入库 多源单模式 |
| | | else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y") |
| | | { |
| | | oBar = get_CheckTypeByBarCode_MulSourceBill(sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HOWNERID, HExpressNumber, oSystemParameter.omodel, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断是否启用一键扫码模式,Y为启用,未启用时只扫描物料条码 |
| | | if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N") |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "博日科技" || oSystemParameter.omodel.WMS_CampanyName == "杭州智见" || oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔" || oSystemParameter.omodel.WMS_CampanyName == "奥邦") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | | if (dal.GetInfoByNumber_View(sBarCode)) |
| | | { |
| | | //如果是托盘条码分解并模拟扫码 |
| | | 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(sBarCode_MX, 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 + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_MX + sErrMsg; |
| | | //sErrMsg = "扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //将物料条码信息写入出入库条码临时表 |
| | | if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "没有找到该条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (sBarCodePrefix == "PAK") |
| | | { |
| | | //将模治具信息写入模治具出入库临时表 |
| | | DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddMouldBarCode"); |
| | | 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 (set_SavePonderationBillMain_Temp_BarCode(sBarCode, 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | } |
| | | //一键扫码模式,根据条码前缀走 不同方法(仓库、仓位、部门)(源单、物料条码) |
| | | else |
| | | { |
| | | string sRedBlue = "蓝字"; |
| | | if (HRedBlueFlag) |
| | | { |
| | | sRedBlue = "红字"; |
| | | } |
| | | else |
| | | { |
| | | sRedBlue = "蓝字"; |
| | | } |
| | | DataSet Dss; |
| | | //根据递入的条码前三位,判断条码类型(仓库、仓位、部门、源单、物料条码) |
| | | Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType"); |
| | | |
| | | //无返回数据则为物料条码 |
| | | if (Dss == null || Dss.Tables[0].Rows.Count == 0) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "博日科技" || oSystemParameter.omodel.WMS_CampanyName == "杭州智见" || oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔" || oSystemParameter.omodel.WMS_CampanyName == "奥邦") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | | if (dal.GetInfoByNumber_View(sBarCode)) |
| | | { |
| | | //如果是托盘条码分解并模拟扫码 |
| | | 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(sBarCode_MX, 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 + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_MX + sErrMsg; |
| | | //sErrMsg = "扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //将物料条码信息写入出入库条码临时表 |
| | | if (set_SavePonderationBillMain_Temp_BarCode(sBarCode, 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "没有找到该条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (sBarCodePrefix == "PAK") |
| | | { |
| | | //将模治具信息写入模治具出入库临时表 |
| | | DataSet Mould = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddMouldBarCode"); |
| | | 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 (set_SavePonderationBillMain_Temp_BarCode(sBarCode, 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | } |
| | | 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 if (sBarBillName == "部门") |
| | | { |
| | | DAL.ClsIF_Department_View dal = new DAL.ClsIF_Department_View(); |
| | | //将递入的条码去掉前三位后转化成整形 |
| | | int ID; |
| | | if (int.TryParse(sBarCode.Remove(0, 3), out ID)) |
| | | { |
| | | if (dal.GetInfoByID(ID)) |
| | | { |
| | | oBar.HBarType = "部门条码"; |
| | | oBar.HDeptID = dal.omodel.HItemID; |
| | | oBar.HDeptNumber = dal.omodel.HNumber; |
| | | oBar.HDeptName = dal.omodel.HName; |
| | | 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 (SourceFlag) |
| | | { |
| | | sErrMsg = "明细信息列表已有扫码记录,不允许多次扫描源单条码!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | //产品入库单 源单:生产任务单 |
| | | if (sBarBillName == "生产任务单" && HBillType == "1202") |
| | | { |
| | | DAL.Cls_S_IF_ICMOBill_Lite dal = new DAL.Cls_S_IF_ICMOBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //产品入库单 源单:生产汇报单 |
| | | else if (sBarBillName == "生产汇报单" && HBillType == "1202") |
| | | { |
| | | DAL.Cls_S_IF_ICMOReportBill_Lite dal = new DAL.Cls_S_IF_ICMOReportBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //外购入库单 源单:采购订单 |
| | | else if (sBarBillName == "采购订单" && HBillType == "1201") |
| | | { |
| | | DAL.Cls_S_IF_POOrderBill_Lite dal = new DAL.Cls_S_IF_POOrderBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //外购入库单 源单:收料通知单 |
| | | else if (sBarBillName == "收料通知单" && HBillType == "1201") |
| | | { |
| | | DAL.Cls_S_IF_POInStockBill_Lite dal = new DAL.Cls_S_IF_POInStockBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "' and isnull(HBillSubType,0)=12510 "; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //委外入库单 源单:委外订单 |
| | | else if (sBarBillName == "委外订单" && HBillType == "1210") |
| | | { |
| | | DAL.Cls_S_IF_WWOrderBill_Lite dal = new DAL.Cls_S_IF_WWOrderBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //委外入库单 源单:收料通知单-委外 |
| | | else if (sBarBillName == "收料通知单-委外" && HBillType == "1210") |
| | | { |
| | | DAL.Cls_S_IF_POStockInBill_Lite dal = new DAL.Cls_S_IF_POStockInBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "' and isnull(HBillSubType,0)=12511 "; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //领料出库 源单:生产任务单-投料 |
| | | else if (sBarBillName == "生产任务单-投料" && HBillType == "1204") |
| | | { |
| | | DAL.Cls_S_IF_PPBomBillList_Lite dal = new DAL.Cls_S_IF_PPBomBillList_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | //销售出库 源单:销售订单 |
| | | else if (sBarBillName == "销售订单" && HBillType == "1205") |
| | | { |
| | | DAL.Cls_S_IF_SEOrderBill_Lite dal = new DAL.Cls_S_IF_SEOrderBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | oBar.HCustom = Convert.ToString(DS.Tables[0].Rows[0]["HCustom"]); |
| | | } |
| | | //销售出库 源单:发货通知单 |
| | | else if (sBarBillName == "发货通知单" && HBillType == "1205") |
| | | { |
| | | DAL.Cls_S_IF_SeOutStockBill_Lite dal = new DAL.Cls_S_IF_SeOutStockBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | oBar.HCustom = Convert.ToString(DS.Tables[0].Rows[0]["HCustom"]); |
| | | } |
| | | //委外出库单 源单:委外订单-投料 |
| | | else if (sBarBillName == "委外订单-投料" && HBillType == "1211") |
| | | { |
| | | DAL.Cls_S_IF_WWPPBomBill_Lite dal = new DAL.Cls_S_IF_WWPPBomBill_Lite(); |
| | | DataSet DS; |
| | | //根据单据号获取过滤条件 |
| | | string sWhere = " Where 单据号 like '" + sBarCode + "'"; |
| | | DS = dal.DisSourceBillList(sWhere); |
| | | if (DS == null || DS.Tables[0].Rows.Count <= 0) |
| | | { |
| | | sErrMsg = "没有返回任何记录!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HSourceBillNo = Convert.ToString(DS.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HSourceBillType = Convert.ToString(DS.Tables[0].Rows[0]["HBillType"]); |
| | | oBar.HSupID = Convert.ToInt64(DS.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = Convert.ToString(DS.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = Convert.ToInt64(DS.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = Convert.ToString(DS.Tables[0].Rows[0]["HDeptName"]); |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "源单类型名称设置不正确!"; |
| | | return null; |
| | | } |
| | | // 将源单信息写入 临时缓存表 |
| | | if (tem.AddNew_Source(HBillID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, sRedBlue, ref sErrMsg)) |
| | | { |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "保存源单信息失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效条码类型!"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = e.Message + ";" + e.StackTrace; |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #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 + ",单据ID:" + 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 + ",单据ID:" + 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 + ",单据ID:" + 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 + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!"; |
| | | 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 = "所扫描条码无条码库存或对应物料无ERP库存!"; |
| | | 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 扫描物料条码 |
| | |
| | | { |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]); |
| | | dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]); |
| | | dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]); |
| | | dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]); |
| | | dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]); |
| | | dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]); |
| | | dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]); |
| | | dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]); |
| | | 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"]); |
| | | |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_MoveStockBillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HSCWHID, HSCSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | |
| | | { |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]); |
| | | dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]); |
| | | dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]); |
| | | dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]); |
| | | dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]); |
| | | dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]); |
| | | dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]); |
| | | dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]); |
| | | 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"]); |
| | | |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | |
| | | { |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | dal.omodel_View.HBarCode = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCode"]); |
| | | dal.omodel_View.HBarCodeType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBarCodeType"]); |
| | | dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HMaterID"]); |
| | | dal.omodel_View.HAuxPropID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HAuxPropID"]); |
| | | dal.omodel_View.HBatchNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HBatchNo"]); |
| | | dal.omodel_View.HQty = DBUtility.ClsPub.isDoule(dsTBarCode.Tables[0].Rows[0]["HQty"]); |
| | | dal.omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceInterID"]); |
| | | dal.omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(dsTBarCode.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | dal.omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | dal.omodel_View.HMTONo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HMTONo"]); |
| | | 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"]); |
| | | |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |