| | |
| | | } |
| | | } |
| | | } |
| | | if (oSystemParameter.omodel.Kf_MoveStockBill_ERPMode.ToUpper() == "MES") //只生成WMS单据 |
| | | { |
| | | if (set_SaveMoveStockBill_MES(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | sErrMsg = "保存调拨单失败!" + sErrMsg; |
| | | return false; |
| | | } |
| | |
| | | LogService.Write("生成直接调拨单(源单:无源单)成功!" + sRemark); |
| | | sErrMsg = "生成直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 直接调拨单 只生成WMS单据 |
| | | |
| | | [WebMethod] |
| | | public bool set_SaveMoveStockBill_MES(Model.ClsKf_MoveStockBillMain oMain, string sHSourceType, 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 = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //写入WMS调拨单 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_MoveStockBillSub_Insert_New " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','-1'"); |
| | | //插入主表 |
| | | 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,HTransferDirect,HShipType" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1207','1207'," + 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.HTransferDirect + "','" + oMain.HShipType + "'" + |
| | | ", " + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | |
| | | //更新关联数量 |
| | | if (sHSourceType == "3720")//生产用料清单 |
| | | { |
| | | oCn.RunProc("exec h_p_Sc_UpDateMoveStockPPBomRelation_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1604") //委外用料清单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_WWPPBomToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1402") //发货通知单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_SeOutStockToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1243") //调拨申请单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1242") //出库申请单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_StockOutRequestToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1214") //生产发料通知单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_MateOutRequestToMoveStock_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "-1")//无源单 |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | sErrMsg = "生成直接调拨单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";生成直接调拨单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | if (oSystemParameter.omodel.Kf_OtherOutBill_ERPMode.ToUpper() == "MES") //只生成WMS单据 |
| | | { |
| | | if (set_SaveOtherOutBill_MES(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | sErrMsg = "保存其他出库单失败!" + sErrMsg; |
| | | return false; |
| | |
| | | LogService.Write("生成其他出库单(源单:无源单)成功!" + sRemark); |
| | | sErrMsg = "生成其他出库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 其他出库 只生成WMS单据 |
| | | |
| | | //其他出库 |
| | | [WebMethod] |
| | | public bool set_SaveOtherOutBill_MES(Model.ClsKf_OtherOutBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | |
| | | if (oSystemParameterMain.WMS_BillDateMode == "N") //系统参数 单据日期是否取界面递入日期 |
| | | { |
| | | oMain.HDate = DateTime.Today; |
| | | } |
| | | |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + s; |
| | | return false; |
| | | } |
| | | oMain.HYear = sYear; |
| | | oMain.HPeriod = sPeriod; |
| | | |
| | | oCn.BeginTran(); |
| | | //生成出入库单据 |
| | | //插入子表 |
| | | oCn.RunProc("EXEC h_p_Kf_OtherOutBillSub_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('1206','1206'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HDate.ToShortDateString() + "','" + 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() + |
| | | ") "); |
| | | |
| | | //更新关联数量 |
| | | if (sHSourceType == "-1") //无源单 |
| | | { |
| | | |
| | | } |
| | | else if (sHSourceType == "1242") //出库申请单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_StockOutRequestToOtherOut_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | sErrMsg = "生成其他出库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";生成其他出库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | if (oSystemParameter.omodel.Kf_OtherInBill_ERPMode.ToUpper() == "MES") //只生成WMS单据 |
| | | { |
| | | if (set_SaveOtherInBill_MES(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | sErrMsg = "保存其他入库单失败!" + sErrMsg; |
| | | return false; |
| | |
| | | } |
| | | else if (oSystemParameterMain.WMS_CampanyName == "森楷" || sHSourceType == "1241") //入库申请单 |
| | | { |
| | | if (SaveOtherInBill_StockInRequest_CLD_SenKai(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | if (SaveOtherInBill_StockInRequest_CLD_Merge_SenKai(oMain, sHSourceType, oSystemParameterMain, ref sErrMsg)) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | |
| | | LogService.Write("生成其他入库单(源单:入库申请单),多行数据合并下推生单失败成功!" + sRemark); |
| | | sErrMsg = "生成其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 其他入库CLOUD 只生成WMS单据 |
| | | |
| | | //生成入库单 |
| | | [WebMethod] |
| | | public bool set_SaveOtherInBill_MES(Model.ClsKf_OtherInBillMain oMain, string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | try |
| | | { |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | |
| | | if (oSystemParameterMain.WMS_BillDateMode == "N") //系统参数 单据日期是否取界面递入日期 |
| | | { |
| | | oMain.HDate = DateTime.Today; |
| | | } |
| | | |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oMain.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";" + 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 + "','" + oMain.HDate.ToShortDateString() + "','" + 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() + |
| | | ") "); |
| | | |
| | | //更新关联数量 |
| | | if (sHSourceType == "-1") //无源单 |
| | | { |
| | | |
| | | } |
| | | else if (sHSourceType == "1241") //入库申请单 |
| | | { |
| | | oCn.RunProc("exec h_p_Kf_UpDateRelation_StockInRequestToOtherIn_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_OtherInBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | //审核WMS单据 |
| | | oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + oMain.HInterID.ToString()); |
| | | } |
| | | |
| | | sErrMsg = "生成其他入库单成功!单据号为:" + oMain.HBillNo; |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";生成其他入库单失败!" + e.Message; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 将源单信息存入条码出入库临时表 生产汇报、生产入库、采购入库、委外入库、其他入库 |
| | | |
| | | #region 扫描物料条码带出源单信息调用 |
| | | |
| | | #region 扫描唯一条码,将源单信息存入条码出入库临时表 生产汇报、生产入库、采购入库、委外入库、其他入库 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_SourceBill_MaterBarCode(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID, Int64 HAccessFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | |
| | | |
| | | |
| | | |
| | | #region 扫描托盘条码,将源单信息存入条码出入库临时表 生产汇报、生产入库、采购入库、委外入库、其他入库 |
| | | |
| | | [WebMethod] |
| | | public Model.ClsKf_ICStockBill_WMS get_SourceBill_PackBarCode(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID, Int64 HAccessFlag, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS(); |
| | | |
| | | if (HBillType == "3711") |
| | | { |
| | | //生产汇报单 |
| | | oBar = get_SourceBill_ICMOReport(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else if (HBillType == "1201") |
| | | { |
| | | //采购入库单 |
| | | oBar = get_SourceBill_POStockIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else if (HBillType == "1202") |
| | | { |
| | | //生产入库单 |
| | | oBar = get_SourceBill_ProductIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else if (HBillType == "1203") |
| | | { |
| | | //其他入库单 |
| | | oBar = get_SourceBill_OtherIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else if (HBillType == "1210") |
| | | { |
| | | //委外入库单 |
| | | oBar = get_SourceBill_EntrustIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, HAccessFlag, oSystemParameterMain, ref sErrMsg); |
| | | if (oBar == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return oBar; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 直接扫描源单条码调用 |
| | | |
| | | #region 生产入库 扫描源单条码 |
| | | |
| | |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |