| | |
| | | } |
| | | } |
| | | } |
| | | if (oSystemParameter.omodel.Kf_SellOutBill_ERPMode.ToUpper() == "MES") //只生成WMS单据 |
| | | { |
| | | if (set_SaveSellOutBill_MES(oMain, sHSourceType, oSystemParameter.omodel, ref sErrMsg) == true) |
| | | { |
| | | //"保存成功!"; |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | //"保存失败!"; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | sErrMsg = "保存销售出库单失败!" + sErrMsg; |
| | | return false; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 销售出库单 只生成WMS单据 |
| | | |
| | | [WebMethod] |
| | | public bool set_SaveSellOutBill_MES(Model.ClsKf_SellOutBillMain 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_SellOutBillSub_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" + |
| | | ",HSTOCKORGID,HOWNERID" + |
| | | ") " + |
| | | " values('1205','1205'," + 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.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + |
| | | ") "); |
| | | |
| | | //更新关联数量 |
| | | if (sHSourceType == "1401")//销售订单 |
| | | { |
| | | oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "1402") //发货通知单 |
| | | { |
| | | oCn.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToSellOut_Add " + oMain.HInterID.ToString()); |
| | | } |
| | | else if (sHSourceType == "-1")//无源单 |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = "单据号:" + oMain.HBillNo + ",单据ID:" + oMain.HInterID + ";错误的源单类型"; |
| | | oCn.RollBack(); |
| | | return false; |
| | | } |
| | | |
| | | if (oSystemParameterMain.Kf_SellOutBill_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; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 销售出库CLOUD * |
| | | |
| | | [WebMethod] |