| | |
| | | |
| | | #region 其他入库--来源单据 * |
| | | |
| | | //返回入库申请列表 |
| | | /// <summary> |
| | | /// 返回入库申请列表 |
| | | /// </summary> |
| | | /// <param name="sWhere">过滤条件</param> |
| | | /// <returns></returns> |
| | | [WebMethod] |
| | | public DataSet GetKf_StockInRequestBillList(string sWhere) |
| | | { |
| | | DAL.Cls_S_IF_StockInRequestBill_Lite dal = new DAL.Cls_S_IF_StockInRequestBill_Lite(); |
| | | return dal.DisSourceBillList(sWhere); |
| | | } |
| | | |
| | | //返回k3未审核其他入库 |
| | | /// <summary> |
| | | /// 返回k3未审核其他入库 |
| | |
| | | [WebMethod] |
| | | public bool set_SaveMoveBill_CLD(Model.ClsKf_MoveStockBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //领料调拨(源单:生产任务单-投料) |
| | | if (sHSourceType == "3720") |
| | | if (sHSourceType == "3720")//生产用料清单 |
| | | { |
| | | if (SaveMoveMaterOut_CLD(oMain, oSystemParameterMain, ref sErrMsg)) |
| | | if (SaveMoveStockBill_PPBom_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | //sErrMsg = sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | ////领料调拨(源单:生产任务单-投料) |
| | | //if (sHSourceType == "3720") |
| | | //{ |
| | | // if (SaveMoveMaterOut_CLD(oMain, oSystemParameterMain, ref sErrMsg)) |
| | | // { |
| | | // //"保存成功!"; |
| | | // sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | // return true; |
| | | // } |
| | | // else |
| | | // { |
| | | // //"保存失败!"; |
| | | // sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | // //sErrMsg = sErrMsg; |
| | | // return false; |
| | | // } |
| | | //} |
| | | //发货调拨(源单:发货通知单) |
| | | else if (sHSourceType == "1402") |
| | | { |
| | |
| | | //直接调拨 |
| | | private bool SaveMoveOut_CLD(Model.ClsKf_MoveStockBillMain oMain, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | DataSet Ds; |
| | |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //系统参数 启用器具管理 |
| | | { |
| | | string HMouldBillType = "3814"; |
| | |
| | | else |
| | | { |
| | | string sJson_StockStyle = ""; |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | if (oSystemParameterMain.WMS_CampanyName == "韩电") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | sJson_StockStyle = "\"F_CHLX\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["F_CHLX"]) + "\","; //出货类型 |
| | |
| | | "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | "\"FBaseCurrId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\" }," + |
| | | sJson_StockStyle + |
| | | sJson_MainCustom + |
| | | "\"FBillEntry\": [ "; |
| | | string sJson_Entry = ""; |
| | | string sJson_SrcStockPlace = ""; |
| | | string sJson_DestStockPlace = ""; |
| | | string sJson_FAUXPROPID = ""; |
| | | |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_SubCustom = ""; //子表自定义字段 |
| | | |
| | | //子表自定义字段 |
| | | sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]); |
| | | |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") //是否启用批次管理 |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100001\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | |
| | | "\"FPriceBaseQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPriceQty"]) + "\"," + |
| | | "\"FTransReserveLink\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "," + |
| | | "\"FCheckDelivery\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckDelivery"]) + "," + |
| | | sJson_SubCustom + |
| | | //"\"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," + |
| | | //"\"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + |
| | | //"\"FORDERTYPE\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FORDERTYPE"]) + "\" }," + |
| | |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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"]); |
| | | } |
| | | |
| | | //生成 直接调拨 1个物料1单 |
| | | 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMove '" + oMain.HBillNo + "','-1'"); |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_TransferDirect", sJson2 }); |
| | | HReturn = result.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TransferDirect", sJson3 }); |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成直接调拨单失败!" + HReturn + sJson; |
| | |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成直接调拨单失败!登录失败!"; |
| | | sErrMsg = "生成直接调拨单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | sErrMsg = "生成直接调拨单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_TransferDirect", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TransferDirect", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成直接调拨单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核直接调拨单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | if (SaveMoveOut_CLD(oMain, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //系统参数 启用器具管理 |
| | | { |
| | | string HMouldBillType = "3814"; |
| | | oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3"); |
| | | } |
| | | |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | |
| | | |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," + |
| | | "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\"," + |
| | | "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\" " + |
| | | "}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | |
| | | return false; |
| | | } |
| | | } |
| | | if (sHSourceType == "1243") //调拨申请单 |
| | | { |
| | | if (SaveMoveStockStepOutBill_MoveStockRequest_CLD_New(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else if (sHSourceType == "-1") //无源单 |
| | | { |
| | | if (SaveMoveStockStepOutBill_CLD_New(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分步式调出单 源单:调拨申请单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveMoveStockStepOutBill_MoveStockRequest_CLD_New(Model.ClsKf_MoveStockStepOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //生成出入库单据 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_MoveStockStepOutBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_ICStockBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HSTOCKINORGID,HSTOCKOUTORGID,HStockStyle" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1250','1250'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ", " + oMain.HStockInOrgID.ToString() + "," + oMain.HStockOutOrgID.ToString() + ",'" + oMain.HStockStyle + "'" + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.WMS_MouldManagerCtl == "Y") //系统参数 启用器具管理 |
| | | { |
| | | string HMouldBillType = "3840"; |
| | | oCn.RunProc("EXEC h_p_Sc_MouldStockBill_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillType + "','" + HMouldBillType + "'," + oMain.HSupID.ToString() + "," + oMain.HKeeperID.ToString() + "," + oMain.HSecManagerID.ToString() + "," + oMain.HDeptID.ToString() + ",3"); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockStepOutBill_MoveStockRequest_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetMoveStockStepOutBill_MoveStockRequest_CLD_New"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | | //\"FID\":\"0\", |
| | | "\"FOwnerTypeIdHead \":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," + |
| | | "\"FBillTypeID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\" }," + |
| | | "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," + |
| | | "\"FOwnerIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\" }," + |
| | | "\"FOwnerTypeInIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeInIdHead"]) + "\"," + |
| | | "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," + |
| | | "\"FOwnerInIdHead\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerInIdHead"]) + "\" }," + |
| | | "\"FStockOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\" }," + |
| | | "\"FStockInOrgId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockInOrgId"]) + "\" }," + |
| | | "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | "\"FBaseCurrId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\" }," + |
| | | "\"FVESTONWAY\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FVESTONWAY"]) + "\"," + |
| | | //\"FSTOCKERID\":{\"FNumber\":\"\"}, |
| | | //\"FSTOCKERGROUPID\":{\"FNumber\":\"\"}, |
| | | //\"FNOTE\":\"\", |
| | | "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," + |
| | | //\"FScanBox\":\"\", |
| | | //\"FCustID\":{\"FNUMBER\":\"\"}, |
| | | "\"FSUPPLIERID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\" }," + |
| | | sJson_MainCustom + |
| | | "\"FSTKTRSOUTENTRY\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_DestBatchNo = ""; //调入批号 |
| | | string sJson_SrcStockPlace = ""; |
| | | string sJson_DestStockPlace = ""; |
| | | string sJson_FProduceDate = ""; //生产日期 |
| | | string sJson_FExpiryDate = ""; //有效期至 |
| | | string sJson_FDestProduceDate = ""; //调入生产日期 |
| | | string sJson_FDestExpiryDate = ""; //调入有效期至 |
| | | string sJson_FAUXPROPID = ""; |
| | | string sJson_SubCustom = ""; //子表自定义字段 |
| | | |
| | | //子表自定义字段 |
| | | sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]); |
| | | |
| | | //是否启用批次管理 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | | sJson_DestBatchNo = " \"FDESTLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTLOT"]) + "\"}, \"FDESTLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTLOT"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | sJson_DestBatchNo = ""; |
| | | } |
| | | |
| | | //辅助属性 |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | |
| | | //调出仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) == "") |
| | | { |
| | | sJson_SrcStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_SrcStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}},"; |
| | | } |
| | | //调入仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) == "") |
| | | { |
| | | sJson_DestStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_DestStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}},"; |
| | | } |
| | | |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1") //是否启用保质期控制 |
| | | { |
| | | sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\","; |
| | | sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\","; |
| | | sJson_FDestProduceDate = " \"FDestProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestProduceDate"]) + "\","; |
| | | sJson_FDestExpiryDate = " \"FDESTEXPIRYDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDESTEXPIRYDATE"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | sJson_FDestProduceDate = ""; |
| | | sJson_FDestExpiryDate = ""; |
| | | } |
| | | // |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | //\"FEntryID\":\"0\", |
| | | "\"FMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\" }," + |
| | | "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," + |
| | | sJson_FAUXPROPID + |
| | | "\"FUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\" }," + |
| | | sJson_BatchNo + |
| | | "\"FSrcStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\" }," + |
| | | sJson_SrcStockPlace + |
| | | "\"FDestStockId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\" }," + |
| | | sJson_DestStockPlace + |
| | | "\"FBOMId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMId"]) + "\"}," + |
| | | "\"FSrcStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\" }," + |
| | | //"\"FDELICHKQUALIFYTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDELICHKQUALIFYTYPE"]) + "\"," + |
| | | "\"FDestStockStatusId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\" }," + |
| | | sJson_FProduceDate + |
| | | "\"FBusinessDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBusinessDate"]) + "\"," + |
| | | "\"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | "\"FOwnerId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\" }," + |
| | | "\"FOwnerTypeInId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERTYPEINID"]) + "\"," + |
| | | "\"FOwnerInId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerInId"]) + "\" }," + |
| | | //"\"FEntryNote\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntryNote"]) + "\"," + |
| | | "\"FKeeperTypeInId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKEEPERTYPEINID"]) + "\"," + |
| | | "\"FKeeperInId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperInId"]) + "\" }," + |
| | | "\"FDestMaterialId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\" }," + |
| | | "\"FBaseUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\" }," + |
| | | "\"FExtAuxUnitId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\" }," + |
| | | //\"FExtAuxUnitQty\":\"0\", |
| | | "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | "\"FKeeperId\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\" }," + |
| | | //\"FQmEntryId\":\"0\", |
| | | //\"FConvertEntryId\":\"0\", |
| | | "\"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | "\"FDestMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMTONO"]) + "\"," + |
| | | "\"FDestBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestBomId"]) + "\"}," + |
| | | "\"FSNUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\" }," + |
| | | "\"FSecUnitID\":{ \"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitID"]) + "\" }," + |
| | | "\"FCheckDelivery\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCheckDelivery"]) + "\"," + |
| | | "\"FSrcBillDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillDate"]) + "\"," + |
| | | "\"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + |
| | | "\"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," + |
| | | sJson_FExpiryDate + |
| | | sJson_FDestProduceDate + |
| | | sJson_FDestExpiryDate + |
| | | sJson_DestBatchNo + |
| | | sJson_SubCustom + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link\": [ { " + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," + |
| | | "\"FSTKTSTKRANSFEROUTENTRY_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" + |
| | | " } ]," + |
| | | " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_TRANSFEROUT", sJson }); //调用保存方式 |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMoveStockStepOut '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "生成分步式调出单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockStepOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_TRANSFEROUT", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TRANSFEROUT", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成分步式调出单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核分步式调出单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核分步式调出单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成分步式调出单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | if (SaveSellOutBill_SeOutStock_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | |
| | | /// <returns></returns> |
| | | private bool SaveSellOutBill_SeOutStock_CLD(Model.ClsKf_SellOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToSellOut_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.Kf_SellOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100001\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | |
| | | " \"FDISCOUNTRATE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDISCOUNTRATE"]) + "," + |
| | | //\"FPriceDiscount\":\"0\", |
| | | //\"FActQty\":\"0\", |
| | | " \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + |
| | | " \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + |
| | | //" \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + //移到下方 |
| | | //" \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + //移到下方 |
| | | " \"FSALBASEQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALBASEQTY"]) + "," + |
| | | " \"FPRICEBASEQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPRICEBASEQTY"]) + "," + |
| | | //\"FProjectNo\":\"\", |
| | |
| | | " \"FBASEUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEUNITQTY"]) + "," + |
| | | " \"FSALBASENUM\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALBASENUM"]) + "," + |
| | | " \"FSTOCKBASEDEN\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKBASEDEN"]) + "," + |
| | | " \"FSALUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITID"]) + "\"}," + |
| | | " \"FSALUNITQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSALUNITQTY"]) + "," + |
| | | sJson_SubCustom + |
| | | |
| | | " \"FTaxDetailSubEntity\": [ { " + |
| | |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildSellOut '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | if (oSystemParameterMain.Kf_SellOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "SAL_OUTSTOCK", sJson2 }); |
| | | HReturn = result.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "SAL_OUTSTOCK", sJson3 }); |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成销售出库单失败!" + HReturn + sJson; |
| | |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("生成销售出库单成功!" + sJson); |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成销售出库单失败!登录失败!"; |
| | | sErrMsg = "生成销售出库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | sErrMsg = "生成销售出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_SellOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "SAL_OUTSTOCK", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "SAL_OUTSTOCK", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成销售出库单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核销售出库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核销售出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成销售出库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | sJson_Entry = sJson_Entry + "{" + |
| | | "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," + |
| | | "\"FActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FActualQty"]) + "\"," + |
| | | "\"FActualQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FActualQty"]) + "\" " + |
| | | "}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | |
| | | if (SaveOtherOutBill_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | |
| | | /// <returns></returns> |
| | | public bool SaveOtherOutBill_CLD(Model.ClsKf_OtherOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | |
| | | ") "); |
| | | //更新关联数量 |
| | | |
| | | if (oSystemParameterMain.Kf_OtherOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100001\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | |
| | | "\"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | //"\"FDistribution\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDistribution"]) + "," + |
| | | "\"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," + |
| | | "\"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," + |
| | | "\"FExtAuxUnitQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitQty"]) + "} "; |
| | | "\"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}} "; |
| | | //"\"FExtAuxUnitQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitQty"]) + "} "; |
| | | } |
| | | //"\"FInStockEntry_Link_FSId\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInStockEntry_Link_FSId"]) + |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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"]); |
| | | } |
| | | |
| | | //生成 其他出库单 1个物料1单 |
| | | 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_MisDelivery", sJson }); |
| | | |
| | | if (oSystemParameterMain.Kf_OtherOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MisDelivery", sJson2 }); |
| | | HReturn = result.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MisDelivery", sJson3 }); |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "其他出库单失败!" + HReturn + sJson; |
| | | sErrMsg = "生成其他出库单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "其他出库单失败!登录失败!"; |
| | | sErrMsg = "生成其他出库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "其他出库单失败!" + e.Message; |
| | | sErrMsg = "生成其他出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_OtherOutBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | 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 true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核其他出库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核其他出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成其他出库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HArrivalDate" + |
| | | ") " + |
| | | " values('1201','1201'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ",'" + oMain.HArrivalDate.ToShortDateString() + "'" + |
| | | ") "); |
| | | |
| | | //新增K3子表、主表 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <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 产品退库 产品入库(红字) *旧 |
| | | |
| | |
| | | if (SaveProductInBill_ICMO_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | |
| | | if (SaveProductInBill_ICMOReport_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | else |
| | |
| | | /// <returns></returns> |
| | | public bool SaveProductInBill_ICMO_CLD(Model.ClsKf_ProductInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务; |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetProductInBill_ICMO_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ICMO_CLD_New"); |
| | |
| | | } |
| | | else |
| | | { |
| | | string sCheckFlag = ""; //是否审核标志 |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | //根据组织获取是否审核标志,返回 不为空,获取对应组织 是否审核标志 |
| | | sCheckFlag = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckFlag"]); |
| | | if (sCheckFlag != "") |
| | | { |
| | | oSystemParameterMain.Kf_ProductInBill_AutoCheck = sCheckFlag; |
| | | } |
| | | |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | |
| | | //\"FCurrId\":{\"FNumber\":\"\"}, |
| | | //\"FEntrustInStockId\":\"0\", |
| | | //\"FScanBox\":\"\", |
| | | sJson_MainCustom + |
| | | "\"FEntity\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_StockPlace = ""; |
| | | string sJson_FAUXPROPID = ""; |
| | | string sJson_SubCustom = ""; //子表自定义字段 |
| | | |
| | | sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]); |
| | |
| | | { |
| | | sJson_BatchNo = ""; |
| | | } |
| | | |
| | | //辅助属性 |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | |
| | | //仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) == "") |
| | | { |
| | |
| | | sJson_BatchNo + |
| | | " \"FISBACKFLUSH\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISBACKFLUSH"]) + "," + |
| | | //" \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," + |
| | | sJson_FAUXPROPID + |
| | | " \"FMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMTONO"]) + "\"," + |
| | | " \"FPROJECTNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPROJECTNO"]) + "\"," + |
| | | " \"FWORKSHOPID1\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWORKSHOPID1"]) + "\"}," + |
| | |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_INSTOCK", sJson2 }); //提交单据 |
| | | HReturn = result.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_INSTOCK", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成生产入库单失败!" + HReturn + sJson; |
| | |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成生产入库单失败!登录失败!"; |
| | | sErrMsg = "生成生产入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_INSTOCK", sJson2 }); //提交单据 |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_INSTOCK", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成生产入库单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核生产入库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核生产入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成生产入库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public bool SaveProductInBill_ICMOReport_CLD(Model.ClsKf_ProductInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务; |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOReportToProductIn_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetProductInBill_ICMOReport_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ICMOReport_CLD_New"); |
| | |
| | | } |
| | | else |
| | | { |
| | | string sCheckFlag = ""; //是否审核标志 |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | //根据组织获取是否审核标志,返回 不为空,获取对应组织 是否审核标志 |
| | | sCheckFlag = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckFlag"]); |
| | | if(sCheckFlag!="") |
| | | { |
| | | oSystemParameterMain.Kf_ProductInBill_AutoCheck = sCheckFlag; |
| | | } |
| | | |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | |
| | | //\"FCurrId\":{\"FNumber\":\"\"}, |
| | | //\"FEntrustInStockId\":\"0\", |
| | | //\"FScanBox\":\"\", |
| | | sJson_MainCustom + |
| | | "\"FEntity\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_INSTOCK", sJson2 }); //提交单据 |
| | | HReturn = result.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_INSTOCK", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成生产入库单失败!" + HReturn + sJson; |
| | |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成生产入库单失败!登录失败!"; |
| | | sErrMsg = "生成生产入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | sErrMsg = "生成生产入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_INSTOCK", sJson2 }); //提交单据 |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_INSTOCK", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成生产入库单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核生产入库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核生产入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成生产入库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 其它入库CLOUD *New |
| | | #region 其他入库CLOUD *New |
| | | |
| | | //生成入库单 |
| | | [WebMethod] |
| | | public bool set_SaveOtherInBill_CLD_New(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | if (SaveOtherInBill_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | if (sHSourceType == "-1") //无源单 |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!" + oMain.HBillNo; |
| | | return true; |
| | | if (SaveOtherInBill_CLD(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷" || sHSourceType == "1241") //入库申请单 |
| | | { |
| | | if (SaveOtherInBill_StockInRequest_CLD_SenKai(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + sErrMsg; |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | return false; |
| | | } |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public bool SaveOtherInBill_CLD(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | |
| | | ") "); |
| | | //更新关联数量 |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100001\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | } |
| | | else |
| | | { |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 CLOUD网址、账套信息、登录用户、登录密码 |
| | | if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo)) |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | sErrMsg = Pub_Class.ClsPub.sExeReturnInfo; |
| | | return false; |
| | | } |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_MISCELLANEOUS", sJson }); |
| | | |
| | | //获取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) |
| | | { |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成其他入库单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sCLOUDUseName = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserName"]); |
| | | sCLOUDPsd = DBUtility.ClsPub.isStrNull(ds11.Tables[0].Rows[0]["HCloudUserPsd"]); |
| | | sErrMsg = "生成其他入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "生成其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | //生成 其他入库单 1个物料1单 |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成其他入库单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 其他入库单 源单:入库申请单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveOtherInBill_StockInRequest_CLD_SenKai(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | //从配置文件获取 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); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //生成出入库单据 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_OtherInBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'"); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_ICStockBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HStockStyle" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1203','1203'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ",'" + oMain.HStockStyle + "'" + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_StockInRequestToOtherIn_Add " + oMain.HInterID.ToString()); |
| | | |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetOtherInBill_StockInRequest_CLD_SenKai " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetOtherInBill_StockInRequest_CLD_SenKai"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_MainCustom = ""; //主表自定义字段 |
| | | sJson_MainCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["MainCustom"]); |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\",\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\":{ " + |
| | | //"FID": 0, |
| | | "\"FBillNo\":\"" + oMain.HBillNo + "\"," + |
| | | "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," + |
| | | "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," + |
| | | "\"FStockDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockDirect"]) + "\"," + |
| | | "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," + |
| | | "\"FDeptId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDeptId"]) + "\"}," + |
| | | "\"FACCEPTANCE\":{\"FStaffNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FACCEPTANCE"]) + "\"}," + |
| | | "\"FStockerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockerId"]) + "\"}," + |
| | | "\"FSTOCKERGROUPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKERGROUPID"]) + "\"}," + |
| | | "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," + |
| | | "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," + |
| | | "\"FNOTE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FNOTE"]) + "\"," + |
| | | "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," + |
| | | //"FScanBox": "", |
| | | //"F_paez_Text": "", |
| | | sJson_MainCustom + |
| | | "\"FEntity\":["; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; //批号 |
| | | string sJson_StockPlace = ""; //仓位 |
| | | string sJson_FAUXPROPID = ""; //辅助属性 |
| | | string sJson_FProduceDate = ""; //生产日期 |
| | | string sJson_FExpiryDate = ""; //有效期至 |
| | | string sJson_SubCustom = ""; //子表自定义字段 |
| | | |
| | | //子表自定义字段 |
| | | sJson_SubCustom = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["SubCustom"]); |
| | | //是否启用批次管理 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | } |
| | | //仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) == "") |
| | | { |
| | | sJson_StockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockLocId"]) + "\"}},"; |
| | | } |
| | | //辅助属性 |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100003\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | //是否启用保质期控制 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1") |
| | | { |
| | | sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\","; |
| | | sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | } |
| | | |
| | | sJson_Entry = sJson_Entry + "{" + |
| | | //"FEntryID": 0, |
| | | " \"FInStockType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FInStockType"]) + "\"," + |
| | | " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," + |
| | | " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," + |
| | | " \"FStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockId"]) + "\"}," + |
| | | sJson_StockPlace + |
| | | " \"FStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FStockStatusId"]) + "\"}," + |
| | | sJson_BatchNo + |
| | | sJson_FAUXPROPID + |
| | | //"F_TFKO_Assistant2": { |
| | | // "FNumber": "" |
| | | //}, |
| | | //"F_TFKO_Assistant": { |
| | | // "FNumber": "" |
| | | //}, |
| | | //"F_TFKO_Assistant1": { |
| | | // "FNumber": "" |
| | | //}, |
| | | //"F_TFKO_Assistant3": { |
| | | // "FNumber": "" |
| | | //}, |
| | | //"F_TFKO_Text": "", |
| | | //"F_TFKO_Text1": "", |
| | | //"F_TFKO_Text2": "", |
| | | //"F_TFKO_Text3": "", |
| | | //"FExtAuxUnitQty": 0, |
| | | " \"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "\"," + |
| | | //"FEntryNote": "", |
| | | " \"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," + |
| | | sJson_FProduceDate + |
| | | sJson_FExpiryDate + |
| | | " \"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," + |
| | | " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | " \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," + |
| | | " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," + |
| | | " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," + |
| | | " \"FSRCBILLTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPEID"]) + "\"," + |
| | | " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + |
| | | " \"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," + |
| | | " \"FSECUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSECUNITID"]) + "\"}," + |
| | | " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," + |
| | | sJson_SubCustom + |
| | | |
| | | //"FSerialSubEntity": [ |
| | | // { |
| | | // "FDetailID": 0, |
| | | // "FSerialNo": "", |
| | | // "FSerialNote": "" |
| | | // } |
| | | //] |
| | | |
| | | " \"FEntity_Link\": [{" + |
| | | " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | " \"FEntity_Link_FBASEQTYOLD\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBASEQTYOLD"]) + "\"," + |
| | | " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" + |
| | | " } ] } "; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //生成金蝶云单据 |
| | | if (bLogin) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_MISCELLANEOUS", sJson }); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成其他入库单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oCn.Commit(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成其他入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "生成其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | |
| | | //提交、审核金蝶云单据 |
| | | HReturn = ""; |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson3 }); |
| | | |
| | | HReturn = result2.ToString() + "," + result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "生成其他入库单成功,审核单据失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成并审核其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "审核其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "生成其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 其他入库 校验模式* |
| | | |
| | | //校验其它入库 |
| | | [WebMethod] |
| | | public bool set_SaveOtherInBill_BillCheck(Model.ClsKf_OtherInBillMain oMain, ref string sErrMsg) |
| | | { |
| | | if (set_SaveOtherInBill_CLD_BillCheck(oMain, ref sErrMsg) == true) |
| | | { |
| | | //上传成功 |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //上传失败 |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";上传单据失败!" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public bool set_SaveOtherInBill_CLD_BillCheck(Model.ClsKf_OtherInBillMain oMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | return false; |
| | | } |
| | | //上传前判断 |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_BeforeUpload_OtherInBillCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "','" + oSystemParameter.omodel.Kf_OtherInBillCheck_MustQtyCtl + "'", "h_p_WMS_BeforeUpload_OtherInBillCheck"); |
| | | 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"]); |
| | | } |
| | | |
| | | if (oSystemParameter.omodel.Kf_OtherInBillCheck_MustQtyCtl == "完全等于应收") |
| | | { |
| | | 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_MISCELLANEOUS", sJson }); |
| | | //提交单据 |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson2 }); |
| | | //审核单据 |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson3 }); |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson2 }); |
| | | HReturn = result3.ToString(); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson3 }); |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "其他入库单失败!" + HReturn + sJson; |
| | | sErrMsg = "审核其他入库单失败!" + HReturn; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "其他入库单失败!登录失败!"; |
| | | sErrMsg = "校验审核其他入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //根据TMP表 返回 修改信息 |
| | | DataSet Ds2; |
| | | Ds2 = oCn.RunProcReturn("exec h_p_Kf_GetOtherInBillCheck " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetOtherInBillCheck"); |
| | | if (Ds2 == null || Ds2.Tables[0].Rows.Count == 0 || Ds2.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[\"FEntity\",\"FQty\"]," + |
| | | "\"NeedReturnFields\":[],\"IsDeleteEntry\":\"false\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\":{ \"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[0].Rows[0]["FID"]) + "\"," + |
| | | "\"FEntity\":["; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds2.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | |
| | | sJson_Entry = sJson_Entry + "{" + |
| | | "\"FEntryID\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FEntryID"]) + "\"," + |
| | | "\"FQty\":\"" + Pub_Class.ClsPub.isStrNull(Ds2.Tables[1].Rows[i]["FQty"]) + "\" " + |
| | | "}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //验证用户信息 |
| | | 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) |
| | | { |
| | | //修改单据 |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_MISCELLANEOUS", sJson }); |
| | | |
| | | HReturn = result.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "修改其他入库单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | HReturn = ""; |
| | | //提交单据 |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson2 }); |
| | | //审核单据 |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_MISCELLANEOUS", sJson3 }); |
| | | |
| | | HReturn = result3.ToString(); |
| | | |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "校验审核其他入库单失败!" + HReturn + sJson; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | //重新同步其他入库单 |
| | | oCn.RunProc("exec h_p_IFCLD_ERPSourceBillToLocal_OtherIn '" + oMain.HBillNo + "'"); |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "校验审核其他入库单失败!金蝶云登录失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "其他入库单失败!" + e.Message; |
| | | sErrMsg = "校验审核其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 工序汇报转移单 * |
| | | #region 工序汇报转移单 *生成生产入库单、领料出库单 |
| | | |
| | | //生成工序汇报转移单 |
| | | [WebMethod] |
| | |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "工序汇报转移中生成生产领料单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工序汇报转移单 *生成生产入库单、直接调拨单 |
| | | |
| | | //生成工序汇报转移单 生产入库单、直接调拨单 |
| | | [WebMethod] |
| | | public bool set_SaveProcReportMoveBill_MoveStock(Model.ClsKf_ProductInBillMain oMain, Int64 HOutBillID, string HOutBillNo, string HPPBomBillNo, Int64 HSCWHID, Int64 HSCSPID, ref string sErrMsg) |
| | | { |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | return false; |
| | | } |
| | | |
| | | //上传前判断 |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_PreUploadJudgment_ProcReportMoveStock " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'," + HOutBillID.ToString() + ",'" + HOutBillNo + "','" + HPPBomBillNo + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + oMain.HOWNERID.ToString(), "h_p_WMS_PreUploadJudgment_ProcReportMoveStock"); |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | if (set_SaveProcReportMoveBill_MoveStock_CLD_New(oMain, HOutBillID, HOutBillNo, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | return false; |
| | | } |
| | | |
| | | sErrMsg = "保存工序汇报转移单失败!" + sErrMsg; |
| | | return false; |
| | | } |
| | | |
| | | //生成工序汇报转移单 |
| | | [WebMethod] |
| | | public bool set_SaveProcReportMoveBill_MoveStock_CLD_New(Model.ClsKf_ProductInBillMain oMain, Int64 HOutBillID, string HOutBillNo, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | if (SaveProcReportMoveBill_MoveStock_CLD(oMain, HOutBillID, HOutBillNo, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | sErrMsg = "保存成功!生产入库单号:" + oMain.HBillNo + ",直接调拨单号:" + HOutBillNo; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | sErrMsg = "生产入库单号:" + oMain.HBillNo + ",生产入库单ID:" + oMain.HInterID + ",直接调拨单号:" + HOutBillNo + ",直接调拨单ID:" + HOutBillID + ";" + sErrMsg; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 工序汇报转移单 生产入库单 源单:生产汇报单 直接调拨单 源单:生产用料清单 |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveProcReportMoveBill_MoveStock_CLD(Model.ClsKf_ProductInBillMain oMain, Int64 HOutBillID, string HOutBillNo, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //建立一个 事务; |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //生成出入库单据 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','3711'"); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_ICStockBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1202','1202'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120),'" + oMain.HMainSourceBillType + "'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOReportToProductIn_Add " + oMain.HInterID.ToString()); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | oCn.Commit(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "生成工序汇报转移中生产入库单失败ERP!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | try |
| | | { |
| | | //根据TMP表 返回 子表信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetProductInBill_ICMOReport_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'", "h_p_Kf_GetProductInBill_ICMOReport_CLD_New"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取工序汇报转移中生产入库单子表信息失败!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\": { \"FBILLNO\":\"" + oMain.HBillNo + "\"," + |
| | | //\"FID\":\"0\", |
| | | "\"FBillType\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) + "\"}," + |
| | | "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + |
| | | "\"FSTOCKORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSTOCKORGID"]) + "\"}," + |
| | | //\"FStockId0\":{\"FNumber\":\"\"}, |
| | | "\"FPRDORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPRDORGID"]) + "\"}," + |
| | | //\"FWorkShopId\":{\"FNumber\":\"\"}, |
| | | "\"FOWNERTYPEID0\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOWNERTYPEID0"]) + "\"," + |
| | | "\"FOWNERID0\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOWNERID0"]) + "\"}," + |
| | | //\"FSTOCKERID\":{\"FNAME\":\"\"}, |
| | | //\"FDescription\":\"\", |
| | | "\"FISENTRUST\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FISENTRUST"]) + "," + |
| | | //\"FCurrId\":{\"FNumber\":\"\"}, |
| | | //\"FEntrustInStockId\":\"0\", |
| | | //\"FScanBox\":\"\", |
| | | "\"FEntity\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_StockPlace = ""; |
| | | string sJson_FProduceDate = ""; //生产日期 |
| | | string sJson_FExpiryDate = ""; //有效期至 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") //是否启用批次管理 |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | } |
| | | |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISKFPERIOD"]) == "1") //是否启用保质期控制 |
| | | { |
| | | sJson_FProduceDate = " \"FProduceDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProduceDate"]) + "\","; |
| | | sJson_FExpiryDate = " \"FExpiryDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExpiryDate"]) + "\","; |
| | | } |
| | | else |
| | | { |
| | | sJson_FProduceDate = ""; |
| | | sJson_FExpiryDate = ""; |
| | | } |
| | | |
| | | //仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) == "") |
| | | { |
| | | sJson_StockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) + "\"}},"; |
| | | } |
| | | // |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | //\"FEntryID\":\"0\", |
| | | " \"FSRCENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYID"]) + "," + |
| | | " \"FIsNew\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsNew"]) + "," + |
| | | " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMATERIALID"]) + "\"}," + |
| | | " \"FCHECKPRODUCT\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCHECKPRODUCT"]) + "," + |
| | | " \"FINSTOCKTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FINSTOCKTYPE"]) + "\"," + |
| | | " \"FPRODUCTTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPRODUCTTYPE"]) + "\"," + |
| | | " \"FUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUNITID"]) + "\"}," + |
| | | " \"FMUSTQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMUSTQTY"]) + "," + |
| | | " \"FREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREALQTY"]) + "," + |
| | | " \"FCostRate\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCOSTWEIGHT"]) + "," + |
| | | " \"FBASEUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEUNITID"]) + "\"}," + |
| | | " \"FBASEMUSTQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEMUSTQTY"]) + "," + |
| | | " \"FBASEREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEREALQTY"]) + "," + |
| | | " \"FOWNERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERTYPEID"]) + "\"," + |
| | | " \"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERID"]) + "\"}," + |
| | | " \"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKID"]) + "\"}," + |
| | | sJson_StockPlace + |
| | | " \"FBOMID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMID"]) + "\"}," + |
| | | sJson_BatchNo + |
| | | " \"FISBACKFLUSH\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISBACKFLUSH"]) + "," + |
| | | " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," + |
| | | " \"FMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMTONO"]) + "\"," + |
| | | " \"FPROJECTNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPROJECTNO"]) + "\"," + |
| | | " \"FWORKSHOPID1\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWORKSHOPID1"]) + "\"}," + |
| | | " \"FSHIFTGROUPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSHIFTGROUPID"]) + "\"}," + |
| | | " \"FMOBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOBILLNO"]) + "\"," + |
| | | " \"FMOID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOID"]) + "," + |
| | | " \"FMOENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYID"]) + "," + |
| | | " \"FMOENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYSEQ"]) + "," + |
| | | " \"FMemo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMemo"]) + "\"," + |
| | | " \"FSTOCKUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKUNITID"]) + "\"}," + |
| | | " \"FSTOCKREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKREALQTY"]) + "," + |
| | | " \"FSECUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSECUNITID"]) + "\"}," + |
| | | //\"FSecRealQty\":\"0\", |
| | | " \"FSRCBILLTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPE"]) + "\"," + |
| | | " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + |
| | | " \"FSRCINTERID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCINTERID"]) + "," + |
| | | " \"FBASEPRDREALQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEPRDREALQTY"]) + "," + |
| | | //\"FIsFinished\":\"false\", |
| | | //\"FStockStatusId\":{\"FNumber\":\"\"}, |
| | | " \"FSRCENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYSEQ"]) + "," + |
| | | " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOMAINENTRYID"]) + "," + |
| | | " \"FKEEPERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKEEPERTYPEID"]) + "\"," + |
| | | " \"FKEEPERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKEEPERID"]) + "\"}," + |
| | | sJson_FProduceDate + |
| | | //\"FSelReStkQty\":\"0\", |
| | | sJson_FExpiryDate + |
| | | //\"FBaseSelReStkQty\":\"0\", |
| | | " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," + |
| | | " \"FQAIP\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQAIP"]) + "\"," + |
| | | " \"FREQSRC\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQSRC"]) + "\"," + |
| | | " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLNO"]) + "\"," + |
| | | " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLID"]) + "," + |
| | | " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYSEQ"]) + "," + |
| | | " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYID"]) + "," + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialId\":{\"FNumber\":\"\"}, |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | " \"FEntity_Link\": [ { " + |
| | | " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"," + |
| | | " \"FEntity_Link_FBasePrdRealQtyOld\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBasePrdRealQtyOld"]) + "," + |
| | | " \"FEntity_Link_FBasePrdRealQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FBasePrdRealQty"]) + "" + |
| | | " } ]," + |
| | | " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "PRD_INSTOCK", sJson }); //调用保存方式 |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildProductIn '" + oMain.HBillNo + "','3711'"); |
| | | |
| | | if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "PRD_INSTOCK", sJson2 }); //提交单据 |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "PRD_INSTOCK", sJson3 }); //审核单据 |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "工序汇报转移生成生产入库单失败!" + HReturn + sJson; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (SaveMoveStockBill_ProcReportMove_CLD(oMain, HOutBillID, HOutBillNo, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "工序汇报转移生成生产入库单失败!登录失败!"; |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "工序汇报转移生成生产入库单失败!" + e.Message; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 工序汇报转移单 直接调拨单 (源单:生产用料清单) |
| | | /// </summary> |
| | | /// <param name="oMain"></param> |
| | | /// <param name="sErrMsg"></param> |
| | | /// <returns></returns> |
| | | public bool SaveMoveStockBill_ProcReportMove_CLD(Model.ClsKf_ProductInBillMain oMain, Int64 HOutBillID, string HOutBillNo, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //写入WMS调拨单 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_MoveStockBillSub_Insert_ProcReportMove " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'," + HOutBillID.ToString() + ",'" + HOutBillNo + "'"); |
| | | //插入主表 |
| | | oCn.RunProc("Insert Into Kf_ICStockBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" + |
| | | ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + |
| | | ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + |
| | | ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1207','1207'," + HOutBillID.ToString() + ",'" + HOutBillNo + "',convert(varchar(10),getdate(),120),'生产任务单-投料'" + |
| | | ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" + |
| | | ", " + oMain.HSupID.ToString() + "," + oMain.HWHID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HEmpID.ToString() + "," + oMain.HManagerID.ToString() + "," + oMain.HSecManagerID.ToString() + |
| | | ", " + oMain.HKeeperID.ToString() + "," + oMain.HDeptID.ToString() + ",'" + oMain.HExplanation + "','" + oMain.HBillNo + "'," + DBUtility.ClsPub.BoolToString(oMain.HRedBlueFlag) + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | //更新关联数量 |
| | | oCn.RunProc("exec h_p_Sc_UpDateMoveStockPPBomRelation_Add " + HOutBillID.ToString()); |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + HOutBillID.ToString()); |
| | | } |
| | | |
| | | //根据TMP表 返回 信息 |
| | | DataSet Ds; |
| | | Ds = oCn.RunProcReturn("exec h_p_Kf_GetMoveStockBill_ProcReportMove_CLD_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "'," + HOutBillID.ToString() + ",'" + HOutBillNo + "'," + oMain.HOWNERID.ToString(), "h_p_Kf_GetMoveStockBill_ProcReportMove_CLD_New"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "获取工序汇报转移中直接调拨单子表信息失败!"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + |
| | | "\"IsEntryBatchFill\":\"True\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + |
| | | "\"Model\":{ " + |
| | | //\"FID\":\"0\", |
| | | "\"FBillNo\":\"" + oMain.HBillNo + "\"," + |
| | | "\"FBillTypeID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillTypeID"]) + "\"}," + |
| | | "\"FBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBizType"]) + "\"," + |
| | | "\"FTransferDirect\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferDirect"]) + "\"," + |
| | | "\"FTransferBizType\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FTransferBizType"]) + "\"," + |
| | | "\"FSettleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSettleOrgId"]) + "\"}," + |
| | | "\"FSaleOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSaleOrgId"]) + "\"}," + |
| | | "\"FStockOutOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOutOrgId"]) + "\"}," + |
| | | "\"FOwnerTypeOutIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeOutIdHead"]) + "\"," + |
| | | "\"FOwnerOutIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerOutIdHead"]) + "\"}," + |
| | | "\"FStockOrgId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FStockOrgId"]) + "\"}," + |
| | | "\"FIsIncludedTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsIncludedTax"]) + "," + |
| | | "\"FIsPriceExcludeTax\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FIsPriceExcludeTax"]) + "," + |
| | | "\"FOwnerTypeIdHead\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerTypeIdHead"]) + "\"," + |
| | | "\"FSETTLECURRID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSETTLECURRID"]) + "\"}," + |
| | | "\"FOwnerIdHead\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FOwnerIdHead"]) + "\"}," + |
| | | //\"FStockerId\":{\"FNumber\":\"\"}, |
| | | //\"FStockerGroupId\":{\"FNumber\":\"\"}, |
| | | "\"FDATE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDATE"]) + "\"," + |
| | | //\"FNote\":\"\", |
| | | "\"FBaseCurrId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBaseCurrId"]) + "\"}," + |
| | | "\"FSUPPLIERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FSUPPLIERID"]) + "\"}," + |
| | | //\"FCustID\":{\"FNUMBER\":\"\"}, |
| | | //\"FScanBox\":\"\", |
| | | //\"FThirdSystem\":\"\", |
| | | //\"FThirdSrcBillNo\":\"\", |
| | | //\"FThirdSrcId\":\"\", |
| | | "\"FBillEntry\": [ "; |
| | | string sJson_Entry = ""; |
| | | for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) |
| | | { |
| | | if (sJson_Entry != "") |
| | | { |
| | | sJson_Entry = sJson_Entry + " , "; |
| | | } |
| | | string sJson_BatchNo = ""; |
| | | string sJson_SrcStockPlace = ""; |
| | | string sJson_DestStockPlace = ""; |
| | | string sJson_FAUXPROPID = ""; |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") //是否启用批次管理 |
| | | { |
| | | sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; |
| | | } |
| | | else |
| | | { |
| | | sJson_BatchNo = ""; |
| | | } |
| | | //辅助属性 |
| | | sJson_FAUXPROPID = " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}},"; |
| | | //调入仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) == "") |
| | | { |
| | | sJson_SrcStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_SrcStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockLocId"]) + "\"}},"; |
| | | } |
| | | //调出仓位 |
| | | if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) == "") |
| | | { |
| | | sJson_DestStockPlace = ""; |
| | | } |
| | | else |
| | | { |
| | | sJson_DestStockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockLocId"]) + "\"}},"; |
| | | } |
| | | // |
| | | sJson_Entry = sJson_Entry + " {" + |
| | | //\"FEntryID\":\"0\", |
| | | " \"FMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMaterialId"]) + "\"}," + |
| | | //" \"FAuxPropId\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAuxPropId"]) + "\"}}," + |
| | | sJson_FAUXPROPID + |
| | | " \"FUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUnitID"]) + "\"}," + |
| | | " \"FQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQty"]) + "," + |
| | | sJson_BatchNo + |
| | | " \"FSrcStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockId"]) + "\"}," + |
| | | sJson_SrcStockPlace + |
| | | //\"FPrice\":\"0\", |
| | | " \"FDestStockId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockId"]) + "\"}," + |
| | | sJson_DestStockPlace + |
| | | " \"FBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBomId"]) + "\"}," + |
| | | " \"FSrcStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcStockStatusId"]) + "\"}," + |
| | | //\"FDeliChkQualifyType\":\"\", |
| | | //\"FAmount\":\"0\", |
| | | //\"FProduceDate\":\"1900-01-01\", |
| | | " \"FDestStockStatusId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestStockStatusId"]) + "\"}," + |
| | | " \"FMtoNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMtoNo"]) + "\"," + |
| | | " \"FBusinessDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBusinessDate"]) + "\"," + |
| | | //\"FExpiryDate\":\"1900-01-01\", |
| | | " \"FOwnerTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeOutId"]) + "\"," + |
| | | " \"FOwnerOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerOutId"]) + "\"}," + |
| | | " \"FOwnerTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerTypeId"]) + "\"," + |
| | | " \"FOwnerId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOwnerId"]) + "\"}," + |
| | | //\"FNoteEntry\":\"\", |
| | | " \"FProjectNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FProjectNo"]) + "\"," + |
| | | //\"FOutJoinQty\":\"0\", |
| | | " \"FSecUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSecUnitId"]) + "\"}," + |
| | | //\"FSecQty\":\"0\", |
| | | //\"FBASEOUTJOINQTY\":\"0\", |
| | | " \"FBaseUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseUnitId"]) + "\"}," + |
| | | " \"FExtAuxUnitId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FExtAuxUnitId"]) + "\"}," + |
| | | //\"FExtAuxUnitQty\":\"0\", |
| | | " \"FBaseQty\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBaseQty"]) + "," + |
| | | " \"FISFREE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISFREE"]) + "," + |
| | | " \"FKeeperTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeId"]) + "\"," + |
| | | //\"FActQty\":\"0\", |
| | | " \"FKeeperId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperId"]) + "\"}," + |
| | | " \"FKeeperTypeOutId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperTypeOutId"]) + "\"," + |
| | | " \"FKeeperOutId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FKeeperOutId"]) + "\"}," + |
| | | //\"FDiscountRate\":\"0\", |
| | | //\"FRepairQty\":\"0\", |
| | | //\"FRETURNNOTE\":\"\", |
| | | " \"FDestLot\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestLot"]) + "\"}," + |
| | | " \"FDestMaterialId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestMaterialId"]) + "\"}," + |
| | | " \"FDestBomId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FDestBomId"]) + "\"}," + |
| | | //\"FServiceContext\":\"\", |
| | | //\"FPriceUnitID\":{\"FNumber\":\"\"}, |
| | | //\"FPriceQty\":\"0\", |
| | | //\"FPriceBaseQty\":\"0\", |
| | | //\"FSOEntryId\":\"0\", |
| | | " \"FTransReserveLink\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FTransReserveLink"]) + "," + |
| | | //\"FQmEntryId\":\"0\", |
| | | //\"FConvertEntryId\":\"0\", |
| | | //\"FThirdSrcEntryId\":\"\", |
| | | " \"FOrderNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOrderNo"]) + "\"," + |
| | | " \"FSNUnitID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUnitID"]) + "\"}," + |
| | | " \"FORDERTYPE\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FORDERTYPE"]) + "\"}," + |
| | | " \"FSrcBillTypeId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillTypeId"]) + "\"," + |
| | | " \"FSrcBillNo\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSrcBillNo"]) + "\"," + |
| | | |
| | | //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", |
| | | //\"FSerialNo\":\"\", |
| | | //\"FSerialNote\":\"\"}] |
| | | |
| | | " \"FBillEntry_Link\": [{" + |
| | | " \"FBillEntry_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + |
| | | " \"FBillEntry_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + |
| | | " \"FBillEntry_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + |
| | | " \"FBillEntry_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + |
| | | " \"FBillEntry_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + |
| | | " \"FBillEntry_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" + |
| | | " } ]," + |
| | | " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}"; |
| | | } |
| | | string sJson_End = " ] }}"; |
| | | string sJson = sJson_Main + sJson_Entry + sJson_End; |
| | | |
| | | //从配置文件获取 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) |
| | | { |
| | | var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save", |
| | | new object[] { "STK_TransferDirect", sJson }); |
| | | |
| | | //生成单据后更新自定义字段 |
| | | oCn.RunProc("exec h_p_Sc_UpDateSelfFildMove '" + oMain.HBillNo + "','3720'"); |
| | | |
| | | if (oSystemParameterMain.Kf_MoveStockBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | string sJson2 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result2 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Submit", |
| | | new object[] { "STK_TransferDirect", sJson2 }); |
| | | |
| | | string sJson3 = "{\"CreateOrgId\":0,\"Numbers\":[\"" + oMain.HBillNo + "\"]}"; |
| | | var result3 = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Audit", |
| | | new object[] { "STK_TransferDirect", sJson3 }); |
| | | |
| | | HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString(); |
| | | } |
| | | else |
| | | { |
| | | HReturn = result.ToString(); |
| | | } |
| | | if (HReturn.Contains("\"IsSuccess\":false") == true) |
| | | { |
| | | sErrMsg = "工序汇报转移中生成直接调拨单失败!" + HReturn + sJson; |
| | | 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; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //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; |
| | |
| | | } |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | //根据物料条码得到对应源单信息,非多源单模式,判断是否已有源单记录(单据类型=1203,其他入库单除外) |
| | | if (SourceFlag || HBillType == "1203") |
| | |
| | | } |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | //根据条码获取条码信息,存在相同物料时自动获取一行源单信息 |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | |
| | | |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | //根据条码获取条码信息 |
| | | DAL.ClsGy_BarCodeBill_View dal = new DAL.ClsGy_BarCodeBill_View(); |
| | |
| | | } |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | |
| | | //根据条码获取条码信息 |
| | |
| | | } |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | |
| | | } |
| | | //蓝字产品入库、外购入库、委外入库、生产汇报,根据物料条码得到对应源单信息,非多源单模式 |
| | | //未扫描源单的情况下,第一次扫描物料条码获取源单信息并存入临时表 |
| | | //采购入库(1201)、产品入库(1202)、委外入库(1210)、生产汇报(3711) |
| | | //采购入库(1201)、产品入库(1202)、其他入库(1203)、委外入库(1210)、生产汇报(3711) |
| | | if (SourceFlag == false && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210" || HBillType == "3711")) |
| | | { |
| | | if (HSourceBillType != "-1") |
| | |
| | | { |
| | | dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0]["HMaterID"]); |
| | | HQty = DBUtility.ClsPub.isDoule(ds6.Tables[0].Rows[0]["HQty"]); |
| | | sRelQty = HQty; |
| | | } |
| | | else |
| | | { |
| | |
| | | // sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | // return false; |
| | | //} |
| | | //生产领料单-先进先出控制 |
| | | if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | //先进先出控制 |
| | | if ((HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | || (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y") //系统参数 销售出库单-先进先出控制 |
| | | ) |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + model.HBatchNo + "','" + model.HBarCode + "'," + model.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | //其他入库、其他出库 森楷专用 |
| | | else if ((HBillType == "1203" || HBillType == "1206") && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //判断是否启用一键扫码模式,Y为启用,未启用时只扫描物料条码 |
| | | if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N") |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | string sBarCode_New; |
| | | 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) |
| | | { |
| | | 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) |
| | | { |
| | | sErrMsg = "此模块不允许反向拆码!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (HBillType == "1203") |
| | | { |
| | | HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]); |
| | | |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数 其他入库单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn"); |
| | | if (dsyd == null || dsyd.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | SourceFlag = true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + 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) |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | string sBarCode_New; |
| | | 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) |
| | | { |
| | | 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) |
| | | { |
| | | sErrMsg = "此模块不允许反向拆码!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (HBillType == "1203") |
| | | { |
| | | HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]); |
| | | |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数 其他入库单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn"); |
| | | if (dsyd == null || dsyd.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | SourceFlag = true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + 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 == "源单条码") |
| | | { |
| | | if (sBarBillName == "入库申请单") |
| | | { |
| | | oBar = get_SourceBarCode_OtherIn(HBillID, HBillNo, HBillType, sBarCode, "1241", HMaker, HOWNERID, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "源单类型名称设置不正确!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效条码类型!"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //生产入库 多源单模式 |
| | | else if (HBillType == "1202" && oSystemParameter.omodel.Kf_ProductInBill_MulSourceBill == "Y") |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #region 其他入库 扫描源单条码 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_OtherIn(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单时获取系统参数失败! " + sErrMsg; |
| | | return null; |
| | | } |
| | | |
| | | if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数 其他入库单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";将源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | oBar.HMulSourceFlag = sMulSourceFlag; |
| | | oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | oBar.HSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]); |
| | | 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"]); |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 生产领料 扫描源单条码 |
| | | |
| | |
| | | //先进先出控制 |
| | | if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut"); |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出临时表失败!"; |
| | |
| | | } |
| | | } |
| | | } |
| | | //先进先出下架清单 |
| | | else if (oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y") //系统参数 生产领料单-先进先出下架清单 |
| | | { |
| | | DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MateOut"); |
| | | if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出下架清单失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(FIFOList.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(FIFOList.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | oBar.HMulSourceFlag = sMulSourceFlag; |
| | | oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]); |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 销售出库 扫描源单条码 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_SellOut(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单时获取系统参数失败! " + sErrMsg; |
| | | return null; |
| | | } |
| | | |
| | | if (oSystemParameter.omodel.Kf_SellOutBill_MulSourceBill.ToUpper() == "Y") //系统参数 销售出库单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_SellOut " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HFIFOWhID.ToString() + "," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_SellOut"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";将源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | //先进先出控制 |
| | | if (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y") //系统参数 销售出库单-先进先出控制 |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_SellOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_SellOut"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | //先进先出下架清单 |
| | | else if (oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y") //系统参数 销售出库单-先进先出下架清单 |
| | | { |
| | | DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_SellOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_SellOut"); |
| | | if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出下架清单失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(FIFOList.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(FIFOList.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HMulSourceFlag = sMulSourceFlag; |
| | | oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | oBar.HSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]); |
| | | oBar.HCustom = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HCustom"]); |
| | | return oBar; |
| | | } |
| | | else |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 直接调拨 扫描源单条码 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_SourceBarCode_MoveStock(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单时获取系统参数失败! " + sErrMsg; |
| | | return null; |
| | | } |
| | | |
| | | if (oSystemParameter.omodel.Kf_MoveStockBill_MulSourceBill.ToUpper() == "Y") //系统参数 直接调拨单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_MoveStock " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HFIFOWhID.ToString() + "," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_MoveStock"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";将源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | //先进先出控制 |
| | | if (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y") //系统参数 直接调拨单-先进先出控制 |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MoveStock " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MoveStock"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | //先进先出下架清单 |
| | | else if (oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y") //系统参数 直接调拨单-先进先出下架清单 |
| | | { |
| | | DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MoveStock " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MoveStock"); |
| | | if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出下架清单失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(FIFOList.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(FIFOList.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | oBar.HBarType = "源单条码"; |
| | | oBar.HMulSourceFlag = sMulSourceFlag; |
| | | oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | oBar.HSupID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSupID"]); |
| | | oBar.HSupName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSupName"]); |
| | | oBar.HDeptID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HDeptID"]); |
| | | oBar.HDeptName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HDeptName"]); |
| | | oBar.HStockOutOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockOutOrgID"]); |
| | | oBar.HStockOutOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockOutOrgName"]); |
| | | oBar.HStockInOrgID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HStockInOrgID"]); |
| | | oBar.HStockInOrgName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockInOrgName"]); |
| | | oBar.HStockStyle = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HStockStyle"]); |
| | | 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.HSCWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCWhID"]); |
| | | oBar.HSCWhName = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSCWhName"]); |
| | | oBar.HSCSPFlag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HSCSPFlag"]); |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";" + DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | // #region 扫描物料条码调用方法 |
| | | #region 物料条码调用方法 |
| | | |
| | | // #region 扫描物料条码 |
| | | #region 一键扫码 |
| | | |
| | | // [WebMethod] |
| | | // public Model.ClsKf_ICStockBill_WMS get_MaterBarCode_New(string HBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID, Int64 HStockOutOrgID, string HExpressNumber, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sErrMsg) |
| | | // { |
| | | // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | // Model.ClsKf_ICStockBill_WMS model = new Model.ClsKf_ICStockBill_WMS(); |
| | | // //获取系统参数 |
| | | // Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | // if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | // { |
| | | // sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | // return null; |
| | | // } |
| | | // //判断条码是否为空 |
| | | // if (HBarCode.Trim() == "") |
| | | // { |
| | | // sErrMsg = "条码不能为空,请重新扫描物料条码!"; |
| | | // return null; |
| | | // } |
| | | // //判断条码是否含特殊符号 # ,如果含有则拆分,截取 # 前字符串 |
| | | // string[] NewBarCode; |
| | | // if (HBarCode.CompareTo("#") > 0) |
| | | // { |
| | | // NewBarCode = HBarCode.Split(Convert.ToChar("#")); |
| | | // HBarCode = NewBarCode[0]; |
| | | // } |
| | | // //获取条码档案信息 |
| | | // Model.ClsGy_BarCodeBill_WMS_Model_View oBar = new Model.ClsGy_BarCodeBill_WMS_Model_View(); |
| | | // DataSet ds1 = oCn.RunProcReturn("Select * from h_v_Gy_BarCodeBill_New Where HBarCode='" + HBarCode + "'", "h_v_Gy_BarCodeBill_New"); |
| | | // if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "所扫描物料条码:" + HBarCode + " 无效,不存在条码档案中!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // oBar.HItemID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HItemID"]); |
| | | // oBar.HBarCode = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCode"]); |
| | | // oBar.HBarCodeType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCodeType"]); |
| | | // oBar.HStopflag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HStopflag"]); |
| | | // oBar.HRemark = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | // oBar.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]); |
| | | // oBar.HUnitID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HUnitID"]); |
| | | // oBar.HAuxPropID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HAuxPropID"]); |
| | | // oBar.HBatchNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBatchNo"]); |
| | | // oBar.HQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQty"]); |
| | | // oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | // oBar.HMTONo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HMTONo"]); |
| | | // oBar.HSTOCKORGID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSTOCKORGID"]); |
| | | // oBar.HOWNERID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HOWNERID"]); |
| | | // } |
| | | // //判断条码是否可用 |
| | | // if (oBar.HStopflag) |
| | | // { |
| | | // sErrMsg = "所扫描物料条码:" + HBarCode + " 已作废,不允许进行扫码操作!"; |
| | | // return null; |
| | | // } |
| | | // //入库、汇报模块,有源单条码 且 条码类型为唯一条码,扫描物料条码时自动带出源单信息 |
| | | // //采购入库(1201)、产品入库(1202)、委外入库(1210)、生产汇报(3711) |
| | | // if (oBar.HBarCodeType == "唯一条码" && oBar.HSourceBillNo == "" && HSourceBillType != "-1" |
| | | // && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210" || HBillType == "3711")) |
| | | // { |
| | | // Int64 HAccessFlag = 1; //是否物料条码带出源单信息标志(0为直接扫源单条码,1为物料条码带出源单信息) |
| | | // model = getSourceBill_New(HInterID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, HRedBlueFlag, HMaker, 0, 0, 0, HStockOrgID, HAccessFlag, SourceFlag, oSystemParameter.omodel, ref sErrMsg); |
| | | // if (model == null) |
| | | // { |
| | | // sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单失败!" + sErrMsg; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // HSourceBillType = model.HSourceBillType; |
| | | // SourceFlag = true; |
| | | // return model; |
| | | // } |
| | | // } |
| | | //一键扫码模式,根据条码前缀走 不同方法(仓库、仓位、部门)(源单、物料条码) |
| | | [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));//截取条码前三位字符串 |
| | | |
| | | // //1、首次扫码防串单判断; 2、源单类型是否在源单列表里判断;3、唯一条码是否存在相同条码判断; 4、有源单,物料是否在源单中判断 |
| | | // DataSet ds2 = oCn.RunProcReturn("exec h_p_WMS_GetSourceInterID_AddBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + oSystemParameter.omodel.WMS_BarCodeMustSameSourceBill + "'," + HStockOrgID.ToString(), "h_p_WMS_GetSourceInterID_AddBarCode"); |
| | | // if (ds2 == null || ds2.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "扫描物料条码,判断条码是否在源单中时发生错误!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HRemark"]); |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillType"]); |
| | | // oBar.HMaterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HMaterID"]); |
| | | // oBar.HinitQty = DBUtility.ClsPub.isDoule(ds2.Tables[0].Rows[0]["HQtyMust"]); //剩余未扫码数量(应收数量-扫码总数量 或0),非唯一条码用到 |
| | | // } |
| | | // } |
| | | //获取系统参数 |
| | | 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" || HBillType == "1206") && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | string sBarCode_New; |
| | | 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) |
| | | { |
| | | 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) |
| | | { |
| | | sErrMsg = "此模块不允许反向拆码!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (HBillType == "1203") |
| | | { |
| | | HSourceBillNo = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(dsTBarCode.Tables[0].Rows[0]["HSourceBillType"]); |
| | | //oBar = get_SourceBarCode_OtherIn(HBillID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HOWNERID, ref sErrMsg); |
| | | //if (oBar == null) |
| | | //{ |
| | | // return null; |
| | | //} |
| | | //SourceFlag = true; |
| | | |
| | | // //获取、判断仓库、仓位 |
| | | // DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetWHIDandSPID_AddBarCode " + HInterID.ToString() + ",'" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWhID + "," + HSCSPID + "," + oBar.HSourceInterID + "," + oBar.HSourceEntryID + "," + oBar.HMaterID + "," + HStockOrgID + "," + HStockOutOrgID + ",'" + oBar.HBarCodeType + "','" + oSystemParameter.omodel.WMS_WMSStockCtl + "'", "h_p_WMS_GetWHIDandSPID_AddBarCode"); |
| | | // if (ds3 == null || ds3.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "扫描物料条码,判断仓库、仓位值时发生错误!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]); |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // model.HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]); |
| | | // model.HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]); |
| | | // model.HSCWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCWHID"]); |
| | | // model.HSCSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCSPID"]); |
| | | // } |
| | | // } |
| | | Int64 sMulSourceFlag = 0; //多源单标志(0为非多源单模式,1为多源单模式) |
| | | if (oSystemParameter.omodel.Kf_OtherInBill_MulSourceBill.ToUpper() == "Y") //系统参数 其他入库单-多源单模式 |
| | | { |
| | | sMulSourceFlag = 1; |
| | | } |
| | | |
| | | // //初步获取条码数量 |
| | | // if (oBar.HBarCodeType == "唯一条码") |
| | | // { |
| | | // if (HQty > 0 && oBar.HQty > HQty) //0<界面递入数量<条码档案数量,取递入数量 |
| | | // { |
| | | // oBar.HQty = HQty; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // if (HQty > 0) //界面递入数量>0,取递入数量 |
| | | // { |
| | | // oBar.HQty = HQty; |
| | | // } |
| | | // else if (oBar.HinitQty > 0) //界面递入数量<0,源单剩余未扫码数量>0,取源单剩余未扫码数量 |
| | | // { |
| | | // oBar.HQty = oBar.HinitQty; |
| | | // } |
| | | // } |
| | | //将源单信息存入条码出入库临时表 |
| | | DataSet dsyd = oCn.RunProcReturn("exec h_p_WMS_AddSourceBarCode_OtherIn " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + sMulSourceFlag.ToString() + ",'" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddSourceBarCode_OtherIn"); |
| | | if (dsyd == null || dsyd.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";将条码对应源单信息存入条码出入库临时表失败!"; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsyd.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | SourceFlag = true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";" + DBUtility.ClsPub.isStrNull(dsyd.Tables[0].Rows[0]["HRemark"]); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // //生产领料(1204)、销售出库(1205)、其他出库蓝字(1206)、委外出库(1211) |
| | | // //外购退料(1239)、产品退库(1245)、其他入库红字(1248)、委外退库(1246) |
| | | // //生产补料(1254) |
| | | // if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211" |
| | | // || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246" |
| | | // || HBillType == "1254") |
| | | // { |
| | | // if (oSystemParameter.omodel.WMS_ERPStockCtl == "Y") |
| | | // { |
| | | 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; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HBillID + ";扫描失败!" + sBarCode_New + sErrMsg; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return oBar; |
| | | } |
| | | } |
| | | //销售出库 森楷专用 |
| | | else if (HBillType == "1205" && oSystemParameter.omodel.WMS_CampanyName == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //判断是否启用一键扫码模式,Y为启用,未启用时只扫描物料条码 |
| | | if (oSystemParameter.omodel.WMS_OneKeyMode.ToUpper() == "N") |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | 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 |
| | | { |
| | | 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) |
| | | { |
| | | //根据单个条码获取对应整托条码信息写入条码出入库临时表 |
| | | 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 |
| | | { |
| | | 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 == "源单条码") |
| | | { |
| | | if (sBarBillName == "发货通知单") |
| | | { |
| | | oBar = get_SourceBarCode_SellOut(HBillID, HBillNo, HBillType, sBarCode, "1402", HMaker, 0, HOWNERID, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | return oBar; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "源单类型名称设置不正确!"; |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "无效条码类型!"; |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //生产入库 多源单模式 |
| | | 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.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | } |
| | | |
| | | 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 == "森楷") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | 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) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | 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 |
| | | if (SourceFlag == false) |
| | | { |
| | | HSourceBillType = "-1"; |
| | | } |
| | | |
| | | //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(DsWMS.Tables[0].Rows[0]["HWhID"]); |
| | | HSCSPID = DBUtility.ClsPub.isLong(DsWMS.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; |
| | | |
| | | //先进先出控制 |
| | | if ((HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_FIFOCtl == "Y") //系统参数 直接调拨单-先进先出控制 |
| | | ) |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + oMain.HBatchNo + "','" + oMain.HBarCode + "'," + oMain.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "请根据先进先出清单扫码!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | oMain.HWhID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HWHID"]); |
| | | oMain.HStockPlaceID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSPID"]); |
| | | oMain.HQty = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HQty"]); |
| | | oMain.HQtyMust = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HSumQtyMust"]); |
| | | oMain.HSourceInterID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceInterID"]); |
| | | oMain.HSourceEntryID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | oMain.HSourceBillType = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillType"]); |
| | | } |
| | | } |
| | | |
| | | 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 扫描物料条码 |
| | | |
| | | // [WebMethod] |
| | | // public Model.ClsKf_ICStockBill_WMS get_MaterBarCode_New(string HBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID, Int64 HStockOutOrgID, string HExpressNumber, ref string sHSourceBillNo, ref string sHSourceBillType, ref long sHSupID, ref string sHSupName, ref long sHDeptID, ref string sHDeptName, ref string sErrMsg) |
| | | // { |
| | | // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | // Model.ClsKf_ICStockBill_WMS model = new Model.ClsKf_ICStockBill_WMS(); |
| | | // //获取系统参数 |
| | | // Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | // if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | // { |
| | | // sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | // return null; |
| | | // } |
| | | // //判断条码是否为空 |
| | | // if (HBarCode.Trim() == "") |
| | | // { |
| | | // sErrMsg = "条码不能为空,请重新扫描物料条码!"; |
| | | // return null; |
| | | // } |
| | | // //判断条码是否含特殊符号 # ,如果含有则拆分,截取 # 前字符串 |
| | | // string[] NewBarCode; |
| | | // if (HBarCode.CompareTo("#") > 0) |
| | | // { |
| | | // NewBarCode = HBarCode.Split(Convert.ToChar("#")); |
| | | // HBarCode = NewBarCode[0]; |
| | | // } |
| | | // //获取条码档案信息 |
| | | // Model.ClsGy_BarCodeBill_WMS_Model_View oBar = new Model.ClsGy_BarCodeBill_WMS_Model_View(); |
| | | // DataSet ds1 = oCn.RunProcReturn("Select * from h_v_Gy_BarCodeBill_New Where HBarCode='" + HBarCode + "'", "h_v_Gy_BarCodeBill_New"); |
| | | // if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "所扫描物料条码:" + HBarCode + " 无效,不存在条码档案中!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // oBar.HItemID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HItemID"]); |
| | | // oBar.HBarCode = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCode"]); |
| | | // oBar.HBarCodeType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBarCodeType"]); |
| | | // oBar.HStopflag = DBUtility.ClsPub.isBool(ds1.Tables[0].Rows[0]["HStopflag"]); |
| | | // oBar.HRemark = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | // oBar.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]); |
| | | // oBar.HUnitID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HUnitID"]); |
| | | // oBar.HAuxPropID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HAuxPropID"]); |
| | | // oBar.HBatchNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBatchNo"]); |
| | | // oBar.HQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQty"]); |
| | | // oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillType"]); |
| | | // oBar.HMTONo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HMTONo"]); |
| | | // oBar.HSTOCKORGID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSTOCKORGID"]); |
| | | // oBar.HOWNERID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HOWNERID"]); |
| | | // } |
| | | // //判断条码是否可用 |
| | | // if (oBar.HStopflag) |
| | | // { |
| | | // sErrMsg = "所扫描物料条码:" + HBarCode + " 已作废,不允许进行扫码操作!"; |
| | | // return null; |
| | | // } |
| | | // //入库、汇报模块,有源单条码 且 条码类型为唯一条码,扫描物料条码时自动带出源单信息 |
| | | // //采购入库(1201)、产品入库(1202)、委外入库(1210)、生产汇报(3711) |
| | | // if (oBar.HBarCodeType == "唯一条码" && oBar.HSourceBillNo == "" && HSourceBillType != "-1" |
| | | // && (HBillType == "1201" || HBillType == "1202" || HBillType == "1210" || HBillType == "3711")) |
| | | // { |
| | | // Int64 HAccessFlag = 1; //是否物料条码带出源单信息标志(0为直接扫源单条码,1为物料条码带出源单信息) |
| | | // model = getSourceBill_New(HInterID, HBillNo, HBillType, oBar.HSourceBillNo, oBar.HSourceBillType, HRedBlueFlag, HMaker, 0, 0, 0, HStockOrgID, HAccessFlag, SourceFlag, oSystemParameter.omodel, ref sErrMsg); |
| | | // if (model == null) |
| | | // { |
| | | // sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";扫描源单失败!" + sErrMsg; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // HSourceBillType = model.HSourceBillType; |
| | | // SourceFlag = true; |
| | | // return model; |
| | | // } |
| | | // } |
| | | |
| | | // //1、首次扫码防串单判断; 2、源单类型是否在源单列表里判断;3、唯一条码是否存在相同条码判断; 4、有源单,物料是否在源单中判断 |
| | | // DataSet ds2 = oCn.RunProcReturn("exec h_p_WMS_GetSourceInterID_AddBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + ",'" + oSystemParameter.omodel.WMS_BarCodeMustSameSourceBill + "'," + HStockOrgID.ToString(), "h_p_WMS_GetSourceInterID_AddBarCode"); |
| | | // if (ds2 == null || ds2.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "扫描物料条码,判断条码是否在源单中时发生错误!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HRemark"]); |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // oBar.HSourceInterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // oBar.HSourceEntryID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // oBar.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // oBar.HSourceBillType = DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HSourceBillType"]); |
| | | // oBar.HMaterID = DBUtility.ClsPub.isLong(ds2.Tables[0].Rows[0]["HMaterID"]); |
| | | // oBar.HinitQty = DBUtility.ClsPub.isDoule(ds2.Tables[0].Rows[0]["HQtyMust"]); //剩余未扫码数量(应收数量-扫码总数量 或0),非唯一条码用到 |
| | | // } |
| | | // } |
| | | |
| | | // //获取、判断仓库、仓位 |
| | | // DataSet ds3 = oCn.RunProcReturn("exec h_p_WMS_GetWHIDandSPID_AddBarCode " + HInterID.ToString() + ",'" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWhID + "," + HSCSPID + "," + oBar.HSourceInterID + "," + oBar.HSourceEntryID + "," + oBar.HMaterID + "," + HStockOrgID + "," + HStockOutOrgID + ",'" + oBar.HBarCodeType + "','" + oSystemParameter.omodel.WMS_WMSStockCtl + "'", "h_p_WMS_GetWHIDandSPID_AddBarCode"); |
| | | // if (ds3 == null || ds3.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "扫描物料条码,判断仓库、仓位值时发生错误!"; |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds3.Tables[0].Rows[0]["HRemark"]); |
| | | // return null; |
| | | // } |
| | | // else |
| | | // { |
| | | // model.HWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HWHID"]); |
| | | // model.HSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSPID"]); |
| | | // model.HSCWhID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCWHID"]); |
| | | // model.HSCSPID = DBUtility.ClsPub.isLong(ds3.Tables[0].Rows[0]["HSCSPID"]); |
| | | // } |
| | | // } |
| | | |
| | | // //初步获取条码数量 |
| | | // if (oBar.HBarCodeType == "唯一条码") |
| | | // { |
| | | // if (HQty > 0 && oBar.HQty > HQty) //0<界面递入数量<条码档案数量,取递入数量 |
| | | // { |
| | | // oBar.HQty = HQty; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // if (HQty > 0) //界面递入数量>0,取递入数量 |
| | | // { |
| | | // oBar.HQty = HQty; |
| | | // } |
| | | // else if (oBar.HinitQty > 0) //界面递入数量<0,源单剩余未扫码数量>0,取源单剩余未扫码数量 |
| | | // { |
| | | // oBar.HQty = oBar.HinitQty; |
| | | // } |
| | | // } |
| | | |
| | | // //生产领料(1204)、销售出库(1205)、其他出库蓝字(1206)、委外出库(1211) |
| | | // //外购退料(1239)、产品退库(1245)、其他入库红字(1248)、委外退库(1246) |
| | | // //生产补料(1254) |
| | | // if (HBillType == "1204" || HBillType == "1205" || HBillType == "1206" || HBillType == "1211" |
| | | // || HBillType == "1239" || HBillType == "1245" || HBillType == "1248" || HBillType == "1246" |
| | | // || HBillType == "1254") |
| | | // { |
| | | // if (oSystemParameter.omodel.WMS_ERPStockCtl == "Y") |
| | | // { |
| | | |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // //非唯一条码扫描时判断仓库仓位是否已选择 |
| | | // if (dal.omodel_View.HBarCodeType != "唯一条码") |
| | | // { |
| | | // if (oSystemParameter.omodel.WMS_ERPStockCtl == "N") |
| | | // { |
| | | // //非唯一条码扫描时判断仓库仓位是否已选择 |
| | | // if (dal.omodel_View.HBarCodeType != "唯一条码") |
| | | // { |
| | | // if (oSystemParameter.omodel.WMS_ERPStockCtl == "N") |
| | | // { |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // //判断ERP库存 返回ERP库存数量 |
| | | // DataSet ds6 = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + dal.omodel_View.HMaterID.ToString() + "," + dal.omodel_View.HAuxPropID.ToString() + ",'" + dal.omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory"); |
| | | // if (ds6 == null || ds6.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "判断ERP库存,未知错误!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0][0]) == 0) |
| | | // { |
| | | // dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0]["HMaterID"]); |
| | | // HQty = DBUtility.ClsPub.isDoule(ds6.Tables[0].Rows[0]["HQty"]); |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds6.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // //判断条码库存 返回库存数量 仓库 仓位 |
| | | // DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View(); |
| | | // if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty)) |
| | | // { |
| | | // } |
| | | // else |
| | | // { |
| | | // //判断ERP库存 返回ERP库存数量 |
| | | // DataSet ds6 = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + dal.omodel_View.HMaterID.ToString() + "," + dal.omodel_View.HAuxPropID.ToString() + ",'" + dal.omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HOWNERID.ToString(), "h_p_IF_CheckQtyByERPICInventory"); |
| | | // if (ds6 == null || ds6.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "判断ERP库存,未知错误!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0][0]) == 0) |
| | | // { |
| | | // dal.omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds6.Tables[0].Rows[0]["HMaterID"]); |
| | | // HQty = DBUtility.ClsPub.isDoule(ds6.Tables[0].Rows[0]["HQty"]); |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds6.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // //判断条码库存 返回库存数量 仓库 仓位 |
| | | // DAL.ClsKF_PonderationBillMain_Temp_View Tempdal = new DAL.ClsKF_PonderationBillMain_Temp_View(); |
| | | // if (Tempdal.CheckQtyByBarCode(HBillID, HBillType, sBarCode, ref HWhID, ref HSPID, sRelQty, ref sRelQty)) |
| | | // { |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // if (sRelQty == 0) |
| | | // { |
| | | // sErrMsg = "无库存!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = "库存不足,已获取实际库存数量!"; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // //采购入库(1201)、产品入库(1202)、其他入库蓝字(1203)、委外入库(1210) |
| | | // //生产退料(1244)、销售退库(1247)、其他出库红字(1249)、委外退料(1238) |
| | | // else |
| | | // { |
| | | // //判断并获取 仓库 仓位信息 |
| | | // DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID"); |
| | | // if (ds4 == null || ds4.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "判断并获取仓库仓位信息,未知错误!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 0) |
| | | // { |
| | | // HWhID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HWHID"]); |
| | | // HSPID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HSPID"]); |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // //判断条码扫描数量 返回剩余未扫描数量 |
| | | // if (tem.IsBarCode_New(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg)) |
| | | // { |
| | | // } |
| | | // else |
| | | // { |
| | | // if (sRelQty == 0) |
| | | // { |
| | | // sErrMsg = "无库存!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = "库存不足,已获取实际库存数量!"; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // //采购入库(1201)、产品入库(1202)、其他入库蓝字(1203)、委外入库(1210) |
| | | // //生产退料(1244)、销售退库(1247)、其他出库红字(1249)、委外退料(1238) |
| | | // else |
| | | // { |
| | | // //判断并获取 仓库 仓位信息 |
| | | // DataSet ds4 = oCn.RunProcReturn("exec h_p_WMS_GetBillWHID " + HBillID.ToString() + ",'" + HBillType + "','" + sBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_GetBillWHID"); |
| | | // if (ds4 == null || ds4.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "判断并获取仓库仓位信息,未知错误!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0][0]) == 0) |
| | | // { |
| | | // HWhID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HWHID"]); |
| | | // HSPID = DBUtility.ClsPub.isLong(ds4.Tables[0].Rows[0]["HSPID"]); |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds4.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | // } |
| | | // //判断条码扫描数量 返回剩余未扫描数量 |
| | | // if (tem.IsBarCode_New(sBarCode, HBillType, HRedBlueFlag, ref sRelQty, ref sErrMsg)) |
| | | // { |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = sErrMsg; |
| | | // return false; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // sErrMsg = sErrMsg; |
| | | // return false; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // if (HExpressNumber == "工序汇报转移单") |
| | | // { |
| | | // model.HSubBillType = "1270"; |
| | | // HExpressNumber = ""; |
| | | // } |
| | | // model.HInterID = HBillID; |
| | | // model.HBillNo = HBillNo; |
| | | // model.HBillType = HBillType; |
| | | // model.HMaker = HMaker; |
| | | // // |
| | | // model.HMaterID = dal.omodel_View.HMaterID; |
| | | // model.HAuxPropID = dal.omodel_View.HAuxPropID; |
| | | // model.HErpClsID = dal.omodel_View.HErpClsID; |
| | | // model.HQty = sRelQty; |
| | | // model.HQtyMust = dal.omodel_View.HinitQty; |
| | | // model.HBarCode = dal.omodel_View.HBarCode; |
| | | // model.HBatchNo = dal.omodel_View.HBatchNo; |
| | | // model.HMTONo = dal.omodel_View.HMTONo; |
| | | // if (HExpressNumber == "工序汇报转移单") |
| | | // { |
| | | // model.HSubBillType = "1270"; |
| | | // HExpressNumber = ""; |
| | | // } |
| | | // model.HInterID = HBillID; |
| | | // model.HBillNo = HBillNo; |
| | | // model.HBillType = HBillType; |
| | | // model.HMaker = HMaker; |
| | | // // |
| | | // model.HMaterID = dal.omodel_View.HMaterID; |
| | | // model.HAuxPropID = dal.omodel_View.HAuxPropID; |
| | | // model.HErpClsID = dal.omodel_View.HErpClsID; |
| | | // model.HQty = sRelQty; |
| | | // model.HQtyMust = dal.omodel_View.HinitQty; |
| | | // model.HBarCode = dal.omodel_View.HBarCode; |
| | | // model.HBatchNo = dal.omodel_View.HBatchNo; |
| | | // model.HMTONo = dal.omodel_View.HMTONo; |
| | | |
| | | // model.HWhID = HWhID; |
| | | // model.HStockPlaceID = HSPID; |
| | | // model.HSourceInterID = dal.omodel_View.HSourceInterID; |
| | | // model.HSourceEntryID = dal.omodel_View.HSourceEntryID; |
| | | // model.HSourceBillNo = dal.omodel_View.HSourceBillNo; |
| | | // model.HSourceBillType = HSourceBillType; |
| | | // model.HRedBlueFlag = HRedBlueFlag; |
| | | // model.HPieceQty = 1; |
| | | // model.HSTOCKORGID = HOWNERID; |
| | | // model.HOWNERID = HOWNERID; |
| | | // model.HCusBarCode = HExpressNumber; |
| | | // model.HWhID = HWhID; |
| | | // model.HStockPlaceID = HSPID; |
| | | // model.HSourceInterID = dal.omodel_View.HSourceInterID; |
| | | // model.HSourceEntryID = dal.omodel_View.HSourceEntryID; |
| | | // model.HSourceBillNo = dal.omodel_View.HSourceBillNo; |
| | | // model.HSourceBillType = HSourceBillType; |
| | | // model.HRedBlueFlag = HRedBlueFlag; |
| | | // model.HPieceQty = 1; |
| | | // model.HSTOCKORGID = HOWNERID; |
| | | // model.HOWNERID = HOWNERID; |
| | | // model.HCusBarCode = HExpressNumber; |
| | | |
| | | // ////获取系统参数 |
| | | // //Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | // //if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | // //{ |
| | | // // sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | // // return false; |
| | | // //} |
| | | // //生产领料单-先进先出控制 |
| | | // if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | // { |
| | | // DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + model.HBatchNo + "','" + model.HBarCode + "'," + model.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | // if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "请根据先进先出清单扫码!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | //{ |
| | | // model.HWhID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HWHID"]); |
| | | // model.HStockPlaceID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSPID"]); |
| | | // model.HQty = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HQty"]); |
| | | // model.HQtyMust = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HSumQtyMust"]); |
| | | // model.HSourceInterID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // model.HSourceEntryID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // model.HSourceBillNo = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // model.HSourceBillType = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillType"]); |
| | | //} |
| | | // } |
| | | // ////获取系统参数 |
| | | // //Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | // //if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | // //{ |
| | | // // sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | // // return false; |
| | | // //} |
| | | // //生产领料单-先进先出控制 |
| | | // if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | // { |
| | | // DataSet FIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HBillID.ToString() + ",'" + HBillType + "','" + model.HBatchNo + "','" + model.HBarCode + "'," + model.HQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | // if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sErrMsg = "请根据先进先出清单扫码!"; |
| | | // return false; |
| | | // } |
| | | // else |
| | | //{ |
| | | // model.HWhID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HWHID"]); |
| | | // model.HStockPlaceID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSPID"]); |
| | | // model.HQty = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HQty"]); |
| | | // model.HQtyMust = DBUtility.ClsPub.isDoule(FIFO.Tables[0].Rows[0]["HSumQtyMust"]); |
| | | // model.HSourceInterID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceInterID"]); |
| | | // model.HSourceEntryID = DBUtility.ClsPub.isLong(FIFO.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | // model.HSourceBillNo = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | // model.HSourceBillType = DBUtility.ClsPub.isStrNull(FIFO.Tables[0].Rows[0]["HSourceBillType"]); |
| | | //} |
| | | // } |
| | | |
| | | // //物料条码写入临时表时,判断仓库仓位是否正确 |
| | | // DataSet ds5 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + model.HWhID.ToString() + "," + model.HStockPlaceID.ToString(), "h_p_WMS_CheckWHandSP"); |
| | | //if (ds5 == null || ds5.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // sErrMsg = "扫描物料条码存入临时表时判断仓库仓位是否正确,未知错误!"; |
| | | // return false; |
| | | //} |
| | | //else |
| | | //{ |
| | | // if (DBUtility.ClsPub.isLong(ds5.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds5.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | //} |
| | | // //物料条码写入临时表时,判断仓库仓位是否正确 |
| | | // DataSet ds5 = oCn.RunProcReturn("exec h_p_WMS_CheckWHandSP " + model.HWhID.ToString() + "," + model.HStockPlaceID.ToString(), "h_p_WMS_CheckWHandSP"); |
| | | //if (ds5 == null || ds5.Tables[0].Rows.Count == 0) |
| | | //{ |
| | | // sErrMsg = "扫描物料条码存入临时表时判断仓库仓位是否正确,未知错误!"; |
| | | // return false; |
| | | //} |
| | | //else |
| | | //{ |
| | | // if (DBUtility.ClsPub.isLong(ds5.Tables[0].Rows[0][0]) == 1) |
| | | // { |
| | | // sErrMsg = DBUtility.ClsPub.isStrNull(ds5.Tables[0].Rows[0]["HRemark"]); |
| | | // return false; |
| | | // } |
| | | //} |
| | | |
| | | ////将物料条码信息写入出入库条码临时表 |
| | | //if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg)) |
| | | //{ |
| | | ////将物料条码信息写入出入库条码临时表 |
| | | //if (set_SavePonderationBillMain_Temp_Select_Qty(model, HQty, ref sErrMsg)) |
| | | //{ |
| | | |
| | | //} |
| | | //else |
| | | //{ |
| | | // sErrMsg = "扫描失败!" + sErrMsg; |
| | | // return false; |
| | | //} |
| | | //return true; |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // sErrMsg = "扫描失败!" + sErrMsg; |
| | | // return false; |
| | | //} |
| | | //return true; |
| | | // } |
| | | |
| | | // #endregion |
| | | // #endregion |
| | | |
| | | |
| | | // #endregion |
| | | // #endregion |
| | | |
| | | |
| | | #region 模具条码处理方法 |
| | | |
| | | #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(); |
| | |
| | | //判断是否启用先进先出管理(Y,N),是否启用扫码简易模式,只显示已扫码源单记录(Y,N) |
| | | if (HBillType == "1204") //生产领料单 |
| | | { |
| | | if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //生产领料单-先进先出控制 |
| | | if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y") //生产领料单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | |
| | | sSimpleMode = "Y"; |
| | | } |
| | | } |
| | | if (HBillType == "1205" && oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y") //销售出库单-先进先出控制 |
| | | else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y")) //销售出库单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | if (HBillType == "1211" && oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y") //委外出库单-先进先出控制 |
| | | else if (HBillType == "1211" && oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y") //委外出库单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y")) //直接调拨单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 扫描单据条码 *校验模式 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_BillBarCode_BillCheck(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_BillCheck '" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString(), "h_p_WMS_AddBillBarCode_BillCheck"); |
| | | 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] |
| | |
| | | { |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | 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)) |
| | |
| | | Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | |
| | | double sRelQty = 0; |
| | | string sBillTypeOneScan = ""; //是否启用一次扫码控制('Y'为启用) |
| | | if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y") |
| | | string sWHSPCtl = "Y"; //校验-是否校对仓库仓位('Y'为校对) |
| | | if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBillCheck_WHSPCtl == "N") |
| | | { |
| | | //直接调拨单 |
| | | sBillTypeOneScan = "Y"; |
| | | sWHSPCtl = "N"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断是否启用一次扫码控制,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck"); |
| | | string sMultilineCtl = "N"; //校验-多行相同物料自动拆分换行匹配('Y'为自动拆分) |
| | | if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBillCheck_MultilineCtl == "Y") |
| | | { |
| | | //直接调拨单 |
| | | sMultilineCtl = "Y"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sWHSPCtl + "','" + sMultilineCtl + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck_New"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断所扫条码是否在单据中发生错误!"; |
| | |
| | | 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"]); //源单可扫数量 |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HSumQtyMust"]); //HSumQtyMust为源单相同物料剩余可扫数量 |
| | | HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); |
| | | HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); |
| | | HSCWHID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCWHID"]); |
| | | HSCSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCSPID"]); |
| | | } |
| | | else |
| | | { |
| | |
| | | double sERPQty = 0; //ERP库存数量 |
| | | |
| | | //库存控制-WMS负库存控制 |
| | | if (oSystemParameterMain.WMS_WMSStockCtl == "Y") |
| | | if (omodel_View.HBarCodeType == "唯一条码" && 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; |
| | | sRelQty = 0; |
| | | } |
| | | else |
| | | { |
| | | HSCWHID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HWhID"]); |
| | | HSCSPID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HSPID"]); |
| | | sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); |
| | | //判断扫描条码数量与条码库存数量 |
| | | if (sRelQty > sWMSQty) |
| | |
| | | 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 = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | oMain.HPieceQty = 1; |
| | | oMain.HSTOCKORGID = HOWNERID; |
| | | oMain.HOWNERID = HOWNERID; |
| | | if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBill_BillTypeOneScan == "Y") |
| | | { |
| | | //直接调拨单 |
| | | //一次扫码控制,同一条码、同一单据类型,在WMS表和TEMP表里,只允许进行一次扫码 |
| | | DataSet dsOneScan = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan_New"); |
| | | if (dsOneScan == null || dsOneScan.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsOneScan.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(dsOneScan.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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)"); |
| | | double sSumQty = 0; |
| | | double sRemQty = 0; |
| | | for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) |
| | | { |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[i]["HQtyMust"]); //存在相同物料时,其中一行源单剩余可扫数量 |
| | | sSumQty = sSumQty + omodel_View.HSourceQty; |
| | | sRemQty = sRelQty - sSumQty; |
| | | |
| | | //数量 |
| | | //只存在一行数据时,数量=条码可扫数量 |
| | | if (ds1.Tables[0].Rows.Count==1) |
| | | { |
| | | oMain.HQty = sRelQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量<所选行源单剩余可扫数量 或 所选行源单为最后一条数据时 ,数量=条码剩余数量 |
| | | else if (sRemQty <= 0 || (i == ds1.Tables[0].Rows.Count-1 && sRemQty > 0)) |
| | | { |
| | | oMain.HQty = sRemQty + omodel_View.HSourceQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量>所选行源单剩余可扫数量 ,数量=所选行源单剩余可扫数量 |
| | | else |
| | | { |
| | | oMain.HQty = omodel_View.HSourceQty; |
| | | } |
| | | //条码条数 |
| | | if (i == 0) |
| | | { |
| | | oMain.HPieceQty = 1; |
| | | } |
| | | else |
| | | { |
| | | oMain.HPieceQty = 0; |
| | | } |
| | | |
| | | oMain.HInterID = HBillID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | | oMain.HMaker = HMaker; |
| | | oMain.HMaterID = omodel_View.HMaterID; |
| | | oMain.HAuxPropID = omodel_View.HAuxPropID; |
| | | 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 = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceInterID"]); |
| | | oMain.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceEntryID"]); |
| | | oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[i]["HSourceBillNo"]); |
| | | oMain.HSourceBillType = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | 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)"); |
| | | |
| | | if (sRemQty <= 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | |
| | | double sRelQty = 0; |
| | | string sBillTypeOneScan = ""; //是否启用一次扫码控制('Y'为启用) |
| | | if (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y") |
| | | string sWHSPCtl = "Y"; //校验-是否校对仓库仓位('Y'为校对) |
| | | if (HBillType == "1203") |
| | | { |
| | | //其他出库单 |
| | | sBillTypeOneScan = "Y"; |
| | | //其他入库单 |
| | | sWHSPCtl = "Y"; |
| | | } |
| | | else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBill_BillTypeOneScan == "Y") |
| | | else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBillCheck_WHSPCtl == "N") |
| | | { |
| | | //领料出库单 |
| | | sBillTypeOneScan = "Y"; |
| | | sWHSPCtl = "N"; |
| | | } |
| | | else if (HBillType == "1206") |
| | | { |
| | | //其他出库单 |
| | | sWHSPCtl = "Y"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断是否启用一次扫码控制,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sBillTypeOneScan + "'", "h_p_WMS_AddBarCode_BillCheck"); |
| | | string sMultilineCtl = "N"; //校验-多行相同物料自动拆分换行匹配('Y'为自动拆分) |
| | | if (HBillType == "1203") |
| | | { |
| | | //其他入库单 |
| | | sMultilineCtl = "N"; |
| | | } |
| | | else if (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBillCheck_MultilineCtl == "Y") |
| | | { |
| | | //领料出库单 |
| | | sMultilineCtl = "Y"; |
| | | } |
| | | else if (HBillType == "1206") |
| | | { |
| | | //其他出库单 |
| | | sMultilineCtl = "N"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_BillCheck_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",'" + sWHSPCtl + "','" + sMultilineCtl + "'", "h_p_WMS_AddBarCode_BillCheck_New"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断所扫条码是否在单据中发生错误!"; |
| | |
| | | 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"]); //源单可扫数量 |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HSumQtyMust"]); //HSumQtyMust为源单相同物料剩余可扫数量 |
| | | HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); |
| | | HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); |
| | | } |
| | | else |
| | | { |
| | |
| | | sRelQty = omodel_View.HQty; |
| | | } |
| | | |
| | | //其他入库校验,根据系统参数:其他入库校验-应收数量 控制扫码数量能否可超单据数量(小于等于应收、完全等于应收、不控制) |
| | | if (HBillType == "1203" && (oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_OtherInBillCheck_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; |
| | | } |
| | | } |
| | | //领料出库校验,根据系统参数:领料出库校验-应收数量 控制扫码数量能否可超单据数量(小于等于应收、完全等于应收、不控制) |
| | | if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "完全等于应收")) |
| | | else if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "完全等于应收")) |
| | | { |
| | | if (omodel_View.HSourceQty == 0) |
| | | { |
| | |
| | | sRelQty = omodel_View.HQty; |
| | | } |
| | | |
| | | //其他入库校验,根据系统参数:其他入库校验-应收数量 控制扫码数量能否可超单据数量(小于等于应收、完全等于应收、不控制) |
| | | if (HBillType == "1203" && (oSystemParameterMain.Kf_OtherInBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_OtherInBillCheck_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; |
| | | } |
| | | } |
| | | //领料出库校验,根据系统参数:领料出库校验-应收数量 控制扫码数量能否可超单据数量(小于等于应收、完全等于应收、不控制) |
| | | if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "完全等于应收")) |
| | | else if (HBillType == "1204" && (oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "小于等于应收" || oSystemParameterMain.Kf_MateOutBillCheck_MustQtyCtl == "完全等于应收")) |
| | | { |
| | | if (omodel_View.HSourceQty == 0) |
| | | { |
| | |
| | | || HBillType == "1254") |
| | | { |
| | | //库存控制-WMS负库存控制 |
| | | if (oSystemParameterMain.WMS_WMSStockCtl == "Y") |
| | | if (omodel_View.HBarCodeType == "唯一条码" && oSystemParameterMain.WMS_WMSStockCtl == "Y") |
| | | { |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP"); |
| | | if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断WMS条码库存,发生错误!"; |
| | | return false; |
| | | sRelQty = 0; |
| | | } |
| | | else |
| | | { |
| | | HWhID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HWhID"]); |
| | | HSPID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HSPID"]); |
| | | sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); |
| | | //判断扫描条码数量与条码库存数量 |
| | | if(sRelQty> sWMSQty) |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | //一次扫码控制,同一条码、同一单据类型,在WMS表和TEMP表里,只允许进行一次扫码 |
| | | if ((HBillType == "1203" && oSystemParameterMain.Kf_OtherInBill_BillTypeOneScan == "Y") |
| | | || (HBillType == "1204" && oSystemParameterMain.Kf_MateOutBill_BillTypeOneScan == "Y") |
| | | || (HBillType == "1206" && oSystemParameterMain.Kf_OtherOutBill_BillTypeOneScan == "Y")) |
| | | { |
| | | DataSet dsOneScan = oCn.RunProcReturn("exec h_p_WMS_CheckBarCodeOneScan_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + ",0,0,'" + HMaker + "'", "h_p_WMS_CheckBarCodeOneScan_New"); |
| | | if (dsOneScan == null || dsOneScan.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(dsOneScan.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(dsOneScan.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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)"); |
| | | double sSumQty = 0; |
| | | double sRemQty = 0; |
| | | for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) |
| | | { |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[i]["HQtyMust"]); //存在相同物料时,其中一行源单剩余可扫数量 |
| | | sSumQty = sSumQty + omodel_View.HSourceQty; |
| | | sRemQty = sRelQty - sSumQty; |
| | | |
| | | //数量 |
| | | //只存在一行数据时,数量=条码可扫数量 |
| | | if (ds1.Tables[0].Rows.Count == 1) |
| | | { |
| | | oMain.HQty = sRelQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量<所选行源单剩余可扫数量 或 所选行源单为最后一条数据时 ,数量=条码剩余数量 |
| | | else if (sRemQty <= 0 || (i == ds1.Tables[0].Rows.Count - 1 && sRemQty > 0)) |
| | | { |
| | | oMain.HQty = sRemQty + omodel_View.HSourceQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量>所选行源单剩余可扫数量 ,数量=所选行源单剩余可扫数量 |
| | | else |
| | | { |
| | | oMain.HQty = omodel_View.HSourceQty; |
| | | } |
| | | //条码条数 |
| | | if (i == 0) |
| | | { |
| | | oMain.HPieceQty = 1; |
| | | } |
| | | else |
| | | { |
| | | oMain.HPieceQty = 0; |
| | | } |
| | | |
| | | oMain.HInterID = HBillID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | | oMain.HMaker = HMaker; |
| | | oMain.HMaterID = omodel_View.HMaterID; |
| | | oMain.HAuxPropID = omodel_View.HAuxPropID; |
| | | 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 = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceInterID"]); |
| | | oMain.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceEntryID"]); |
| | | oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[i]["HSourceBillNo"]); |
| | | oMain.HSourceBillType = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | 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)"); |
| | | |
| | | if (sRemQty <= 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | 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)) |
| | |
| | | //单据条码 |
| | | 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) |
| | | oBar = get_BillBarCode_BillCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | sErrMsg = "所扫单据条码不属于当前模块!"; |
| | | sErrMsg = "启用一键扫码模式," + 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 if (sBarBillName == "领料出库单" && HBillType == "1204") |
| | | { |
| | | oBar = get_BillBarCode_MateOutCheck(HBillNo, HBillType, HMaker, HOWNERID, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | sErrMsg = "启用一键扫码模式," + sErrMsg; |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | oBar.HBarType = "单据条码"; |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "启用一键扫码模式,所扫条码前缀不属于当前模块单据号前缀!"; |
| | | return null; |
| | | } |
| | | oBar.HBarType = "单据条码"; |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | |
| | | else |
| | | { |
| | | return DS; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 界面同步单据按钮调用方法 *校验模式 |
| | | |
| | | [WebMethod] |
| | | public bool set_UpdateTemp_BillCheck(Int64 HBillID, string HBillNo, string HBillType, string HMaker, Int64 HOWNERID, ref string sErrMsg) |
| | | { |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "获取系统参数失败! " + sErrMsg; |
| | | return false; |
| | | } |
| | | |
| | | string sWHSPCtl = "Y"; //校验-是否校对仓库仓位('Y'为校对) |
| | | if (HBillType == "1204" && oSystemParameter.omodel.Kf_MateOutBillCheck_WHSPCtl == "N") |
| | | { |
| | | //领料出库单 |
| | | sWHSPCtl = "N"; |
| | | } |
| | | else if (HBillType == "1207" && oSystemParameter.omodel.Kf_MoveStockBillCheck_WHSPCtl == "N") |
| | | { |
| | | //直接调拨单 |
| | | sWHSPCtl = "N"; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_UpdateTemp_BillCheck " + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HMaker + "'," + HOWNERID.ToString() + ",'" + sWHSPCtl + "'", "h_p_WMS_UpdateTemp_BillCheck"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ";同步单据信息发生错误!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HRemark"]); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | //判断条码是否含特殊符号 # ,如果含有则 拆分 |
| | | string[] NewBarCode; |
| | | if (sBarCode.CompareTo("#") > 0) |
| | | if (sBarCode.Contains("#")) |
| | | { |
| | | NewBarCode = sBarCode.Split(Convert.ToChar("#")); |
| | | sBarCode = NewBarCode[0]; |
| | | HQty = DBUtility.ClsPub.isDoule(NewBarCode[1]); |
| | | } |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |