| | |
| | | |
| | | #endregion |
| | | |
| | | #region 其他出库 校验模式* |
| | | |
| | | //校验其他出库单 |
| | | [WebMethod] |
| | | public bool set_SaveOtherOutBill_BillCheck(Model.ClsKf_OtherOutBillMain oMain, ref string sErrMsg) |
| | | { |
| | | if (set_SaveOtherOutBill_CLD_BillCheck(oMain, ref sErrMsg) == true) |
| | | { |
| | | //上传成功 |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //上传失败 |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";上传单据失败!" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public bool set_SaveOtherOutBill_CLD_BillCheck(Model.ClsKf_OtherOutBillMain oMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //上传前判断 |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_PreUploadJudgmentBillCheck_OtherOut " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'", "h_p_WMS_PreUploadJudgmentBillCheck_OtherOut"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "校验上传前判断,发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //写入条码出入库表 |
| | | oCn.RunProc("EXEC h_p_Kf_ICStockBillSub_WMS_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + oMain.HBillNo + "'"); |
| | | |
| | | //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码 |
| | | if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo)) |
| | | { |
| | | sErrMsg = Pub_Class.ClsPub.sExeReturnInfo; |
| | | return false; |
| | | } |
| | | |
| | | //获取CLOUD账号密码 |
| | | string sCLOUDUseName = Pub_Class.ClsPub.sCLOUDUseName; |
| | | string sCLOUDPsd = Pub_Class.ClsPub.sCLOUDPsd; |
| | | DataSet ds11 = get_SaveCLOUDUseNameandPsd(oMain.HInterID); |
| | | if (ds11 == null || ds11.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]); |
| | | sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]); |
| | | } |
| | | |
| | | //生成 其他出库单 |
| | | string HReturn; |
| | | ApiClient client = new ApiClient(Pub_Class.ClsPub.sCLOUDUrl); |
| | | string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117 |
| | | bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052); |
| | | if (bLogin) |
| | | { |
| | | //提交单据 |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MisDelivery", sJson2 }); |
| | | //审核单据 |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MisDelivery", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "审核其他出库单失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "审核其他出库单失败!登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核其他出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 外购退料 外购入库(红字) *旧 |
| | | |
| | | //生成外购退料单 |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region 校验模式 扫码模块调用方法 |
| | | |
| | | #region 缓存列表编辑打开单据时,获取单据信息 *校验模式 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS GetSourceBillList_BillCheck(string HBillNo, string HBillType, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | //根据单据号、单据类型,获取单据信息 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_GetSourceBillList_BillCheck '" + HBillNo + "','" + HBillType + "'", "h_p_WMS_GetSourceBillList_BillCheck"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | oBar.HSPFlag = true; |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]); |
| | | oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); |
| | | oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]); |
| | | oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]); |
| | | oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); |
| | | oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]); |
| | | return oBar; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 扫描单据条码 其他出库 *校验模式 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_BillBarCode_OtherOutCheck(string HBillNo, string HBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | //将单据信息存入条码出入库临时表 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBillBarCode_OtherOutCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_OtherOutCheck"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ";将单据信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | oBar.HInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HInterID"]); |
| | | oBar.HBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBillNo"]); |
| | | oBar.HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); |
| | | oBar.HWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HWhName"]); |
| | | oBar.HSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSPFlag"]); |
| | | oBar.HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); |
| | | oBar.HSPName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSPName"]); |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 扫描物料条码 *校验模式 |
| | | |
| | | //扫描物料条码 存入条码出入库临时表 |
| | | [WebMethod] |
| | | public bool set_SavePonderationBillMain_Temp_BarCode_BillCheck(Model.ClsGy_BarCodeBill_WMS_Model_View omodel_View, string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl(); |
| | | Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | |
| | | double sRelQty = 0; |
| | | string sBillTypeOneScan = ""; //是否启用一次扫码控制('Y'为启用) |
| | | if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y") |
| | | { |
| | | //其他出库单 |
| | | sBillTypeOneScan = "Y"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断是否启用一次扫码控制,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck '" + sBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_BillCheck"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断所扫条码是否在单据中发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]); |
| | | omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]); |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]); //源单可扫数量 |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //获取扫码数量 |
| | | if (omodel_View.HBarCodeType == "唯一条码") |
| | | { |
| | | //博日 条码数量大于源单可扫数量,取源单可扫数量 |
| | | if (oSystemParameterMain.WMS_CampanyName == "博日科技" && HBillType != "1202" && HBillType != "1205") |
| | | { |
| | | if (omodel_View.HSourceQty == 0) |
| | | { |
| | | sErrMsg = "已扫描数量等于或大于单据数量,不允许扫码!"; |
| | | return false; |
| | | } |
| | | else if (omodel_View.HQty > omodel_View.HSourceQty) |
| | | { |
| | | omodel_View.HQty = omodel_View.HSourceQty; |
| | | } |
| | | } |
| | | |
| | | if (HQty > 0 && omodel_View.HQty > HQty) |
| | | { |
| | | sRelQty = HQty; |
| | | } |
| | | else |
| | | { |
| | | sRelQty = omodel_View.HQty; |
| | | } |
| | | |
| | | if (omodel_View.HSourceQty == 0) |
| | | { |
| | | sErrMsg = "所扫物料在单据中剩余可扫数量为0,不允许扫码!"; |
| | | return false; |
| | | } |
| | | else if (sRelQty > omodel_View.HSourceQty) |
| | | { |
| | | sErrMsg = "所扫描条码数量为 " + sRelQty.ToString() + " 大于对应单据剩余可扫描数量" + omodel_View.HSourceQty.ToString() + ",不允许扫码!"; |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | //批次条码、品种条码 |
| | | { |
| | | if (HQty > 0) |
| | | { |
| | | sRelQty = HQty; |
| | | } |
| | | else if (omodel_View.HSourceQty > 0) |
| | | { |
| | | sRelQty = omodel_View.HSourceQty; |
| | | } |
| | | else |
| | | { |
| | | sRelQty = omodel_View.HQty; |
| | | } |
| | | |
| | | if (omodel_View.HSourceQty == 0) |
| | | { |
| | | sErrMsg = "所扫物料在单据中剩余可扫数量为0,不允许扫码!"; |
| | | return false; |
| | | } |
| | | else if (sRelQty > omodel_View.HSourceQty) |
| | | { |
| | | sErrMsg = "所扫描条码数量为 " + sRelQty.ToString() + " 大于对应单据剩余可扫描数量" + omodel_View.HSourceQty.ToString() + ",不允许扫码!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //生产领料(1204)、销售出库(1205)、其他出库蓝字(1206)、委外出库(1211) |
| | | //外购退料(1239)、产品退库(1245)、其他入库红字(1248)、委外退库(1246) |
| | | //生产补料(1254) |
| | | //出库、红字入库,判断条码库存、ERP库存 |
| | | double sWMSQty = 0; //条码库存数量 |
| | | double sERPQty = 0; //ERP库存数量 |
| | | if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211" |
| | | || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246" |
| | | || HBillType == "1254") |
| | | { |
| | | //库存控制-WMS负库存控制 |
| | | if (oSystemParameterMain.WMS_WMSStockCtl == "Y") |
| | | { |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP"); |
| | | if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断WMS条码库存,发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); |
| | | //判断扫描条码数量与条码库存数量 |
| | | if(sRelQty> sWMSQty) |
| | | { |
| | | sRelQty = sWMSQty; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory"); |
| | | if (DsERP == null || DsERP.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断ERP库存,发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(DsERP.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]); |
| | | sRelQty = sERPQty; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (sRelQty == 0) |
| | | { |
| | | sErrMsg = "所扫描条码无条码库存!"; |
| | | return false; |
| | | } |
| | | } |
| | | //采购入库(1201)、产品入库(1202)、其他入库蓝字(1203)、委外入库(1210) |
| | | //生产退料(1244)、销售退库(1247)、其他出库红字(1249)、委外退料(1238) |
| | | //入库、红字出库,判断条码可扫描数量 返回剩余未扫描数量 |
| | | else |
| | | { |
| | | //判断条码扫描数量 返回剩余未扫描数量 |
| | | if (!tem.IsBarCode_New(sBarCode, HBillType, false, ref sRelQty, ref sErrMsg)) |
| | | { |
| | | sErrMsg = sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | oMain.HInterID = HBillID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | | oMain.HMaker = HMaker; |
| | | oMain.HMaterID = omodel_View.HMaterID; |
| | | oMain.HAuxPropID = omodel_View.HAuxPropID; |
| | | oMain.HQty = sRelQty; |
| | | oMain.HQtyMust = 0; |
| | | oMain.HBarCode = omodel_View.HBarCode; |
| | | oMain.HBatchNo = omodel_View.HBatchNo; |
| | | oMain.HMTONo = omodel_View.HMTONo; |
| | | oMain.HWhID = HWhID; |
| | | oMain.HStockPlaceID = HSPID; |
| | | oMain.HSourceInterID = omodel_View.HSourceInterID; |
| | | oMain.HSourceEntryID = omodel_View.HSourceEntryID; |
| | | oMain.HSourceBillNo = omodel_View.HSourceBillNo; |
| | | oMain.HSourceBillType = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | oMain.HPieceQty = 1; |
| | | oMain.HSTOCKORGID = HOWNERID; |
| | | oMain.HOWNERID = HOWNERID; |
| | | |
| | | oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + |
| | | "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" + |
| | | ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" + |
| | | ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" + |
| | | ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + |
| | | ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" + |
| | | ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" + |
| | | ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + |
| | | " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() + |
| | | "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" + |
| | | "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" + |
| | | ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" + |
| | | "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" + |
| | | "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" + |
| | | ",0,0,'" + oMain.HCusBarCode + "',0)"); |
| | | return true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 一键扫码 *校验模式 |
| | | |
| | | //一键扫码模式,根据条码前缀走 不同方法(仓库条码、仓位条码、单据号条码、物料条码) |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_BillCheck(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | try |
| | | { |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | return null; |
| | | } |
| | | |
| | | if (sBarCode.Trim()=="") |
| | | { |
| | | sErrMsg = "条码不能为空,请扫描条码!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | } |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | |
| | | //根据系统参数,判断是否启用一键扫码模式,Y为启用 |
| | | //未启用,只扫描物料条码 |
| | | if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N") |
| | | { |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | | if (dal.GetInfoByBarCode_View(sBarCode)) |
| | | { |
| | | if (dal.omodel_View.HStopflag) |
| | | { |
| | | sErrMsg = "条码已被禁用,不允许扫描!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | //判断条码类型是否为托盘条码,如果是托盘条码则分解并模拟扫码 |
| | | if (dal.omodel_View.HBarCodeType == "托盘条码") |
| | | { |
| | | //分解托盘条码得到明细条码信息写入条码出入库临时表 |
| | | DataSet dsTBarCode; |
| | | string sBarCode_MX; |
| | | dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " + |
| | | " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum"); |
| | | if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "没有找到托盘条码对应子条码记录!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]); |
| | | |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | //条码类型不为托盘条码 |
| | | { |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!"; |
| | | return null; |
| | | } |
| | | } |
| | | //启用,根据条码前缀走不同方法(仓库条码、仓位条码、单据条码、物料条码) |
| | | else |
| | | { |
| | | string sBarCodePrefix = sBarCode.Substring(0, Math.Min(3, sBarCode.Length));//截取条码前三位字符串 |
| | | |
| | | //根据递入的条码前三位,判断条码类型(仓库条码、仓位条码、单据条码、物料条码) |
| | | DataSet Dss = oCn.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "'", "Xt_BarCodeType"); |
| | | |
| | | //无返回数据则为物料条码 |
| | | if (Dss == null || Dss.Tables[0].Rows.Count == 0) |
| | | { |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | | if (dal.GetInfoByBarCode_View(sBarCode)) |
| | | { |
| | | if (dal.omodel_View.HStopflag) |
| | | { |
| | | sErrMsg = "条码已被禁用,不允许扫描!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | //判断条码类型是否为托盘条码,如果是托盘条码则分解并模拟扫码 |
| | | if (dal.omodel_View.HBarCodeType == "托盘条码") |
| | | { |
| | | //分解托盘条码得到明细条码信息写入条码出入库临时表 |
| | | DataSet dsTBarCode; |
| | | string sBarCode_MX; |
| | | dsTBarCode = oCn.RunProcReturn("select HBarCode HBarCodeMX from Sc_PackUnionBillSub_Sum " + |
| | | " Where HBarCode_Pack = '" + sBarCode + "'", "Sc_PackUnionBillSub_Sum"); |
| | | if (dsTBarCode == null || dsTBarCode.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "没有找到托盘条码对应子条码记录!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < dsTBarCode.Tables[0].Rows.Count; i++) |
| | | { |
| | | sBarCode_MX = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[i]["HBarCodeMX"]); |
| | | |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode_MX, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | //条码类型不为托盘条码 |
| | | { |
| | | //将物料条码信息写入条码出入库临时表 |
| | | if (!set_SavePonderationBillMain_Temp_BarCode_BillCheck(dal.omodel_View, sBarCode, HBillID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HOWNERID, oSystemParameter.omodel, ref sErrMsg)) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描物料条码失败!" + sErrMsg; |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "条码档案中不存在该条码,请确认条码是否正确或是否已被删除!"; |
| | | return null; |
| | | } |
| | | } |
| | | //仓库条码、仓位条码、单据条码 |
| | | else |
| | | { |
| | | string sBarBillName = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HSourceName"]); |
| | | string sBarBillType = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["BarCodeType"]); |
| | | |
| | | //判断条码类型为 基础资料条码 或 源单条码 |
| | | if (sBarBillType == "基础资料条码") |
| | | { |
| | | //仓库条码 |
| | | if (sBarBillName == "仓库") |
| | | { |
| | | DAL.ClsIF_Warehouse_View dal = new DAL.ClsIF_Warehouse_View(); |
| | | //将递入的条码去掉前三位后转化成整形,TryParse不能转换成整数时返回false,并返回ID=0 |
| | | int ID; |
| | | if (int.TryParse(sBarCode.Remove(0, 3), out ID)) |
| | | { |
| | | if (dal.GetInfoByID(ID, HOWNERID)) |
| | | { |
| | | oBar.HBarType = "仓库条码"; |
| | | oBar.HWhID = dal.omodel.HItemID; |
| | | oBar.HWhNumber = dal.omodel.HNumber; |
| | | oBar.HWhName = dal.omodel.HName; |
| | | oBar.HSPFlag = dal.omodel.HIsStockMgr; |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效仓库条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "错误的仓库条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | //仓位条码 |
| | | else if (sBarBillName == "仓位") |
| | | { |
| | | DAL.ClsIF_StockPlace_View dal = new DAL.ClsIF_StockPlace_View(); |
| | | //将递入的条码去掉前三位后转化成整形 |
| | | int sHSPID; |
| | | int sHWHID; |
| | | string[] sArray = sBarCode.Remove(0, 3).Split(';'); |
| | | if (int.TryParse(sArray[1], out sHSPID) && int.TryParse(sArray[0], out sHWHID)) |
| | | { |
| | | if (dal.GetInfoByID(sHSPID, sHWHID, HOWNERID)) |
| | | { |
| | | oBar.HBarType = "仓位条码"; |
| | | oBar.HSPID = dal.omodel.HItemID; |
| | | oBar.HSPNumber = dal.omodel.HNumber; |
| | | oBar.HSPName = dal.omodel.HName; |
| | | oBar.HWhID = dal.omodel.HWHID; |
| | | oBar.HWhNumber = dal.omodel.HWhNumber; |
| | | oBar.HWhName = dal.omodel.HWhName; |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效仓位条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "错误的仓位条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效基础资料条码!"; |
| | | return null; |
| | | } |
| | | } |
| | | //单据条码 |
| | | else if (sBarBillType == "源单条码") |
| | | { |
| | | DataSet Ds = oCn.RunProcReturn(" select HSourceName from Xt_BarCodeType where HSourceNumber= '" + sBarCodePrefix + "' and HBillType= '" + HBillType + "'", "Xt_BarCodeType"); |
| | | |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "所扫单据条码不属于当前模块!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | sBarBillName = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]); |
| | | //其他出库单 源单:其他出库单 |
| | | if (sBarBillName == "其他出库单" && HBillType == "1206") |
| | | { |
| | | oBar = get_BillBarCode_OtherOutCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | sErrMsg = "启用一键扫码模式," + sErrMsg; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | oBar.HBarType = "单据条码"; |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "启用一键扫码模式,所扫条码前缀不属于当前模块单据号前缀!"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "启用一键扫码模式,所扫条码前缀设置错误!"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = e.Message + ";" + e.StackTrace; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 返回单据物料列表信息 *校验模式 |
| | | |
| | | [WebMethod] |
| | | public DataSet GetKf_PonderationBillMain_Temp_BillCheck(long HInterID, string sBillType, string sWhere) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet DS = oCn.RunProcReturn("exec h_p_KF_PonderationBillMain_TempList_BillCheck " + HInterID.ToString() + ",'" + sBillType + "','" + sWhere + "'", "h_p_KF_PonderationBillMain_TempList_BillCheck"); |
| | | if (DS == null || DS.Tables[0].Rows.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return DS; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 缓存模块调用方法 *校验模式 |
| | | //缓存列表界面,返回缓存列表信息 |
| | | [WebMethod] |
| | | public DataSet GetKf_PonderationBillMain_TempList_BillCheck(string sHBillType, string sHMaker, Int64 sHOWNERID) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetPonderationBillMain_TempList_BillCheck '" + sHBillType + "','" + sHMaker + "'," + sHOWNERID.ToString(), "h_p_KF_GetPonderationBillMain_TempList_BillCheck"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return Ds; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 桌面条码生成外网版 |
| | | |
| | | [WebMethod] |