using System; using System.Data; using System.Collections.Generic; using System.Text; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.Areas.CommMng.Models; using HcUtility.Comm; using DSWeb.MvcShipping.Models.WMSDeliver; using DSWeb.MvcShipping.Models.WMSOUT_GuiGe; using DSWeb.Areas.CommMng.DAL; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Models.MsStevedores; using DSWeb.MvcShipping.DAL.MsSysParamSet; using System.Data.SqlClient; using DSWeb.DataAccess; using DSWeb.EntityDA; //Please add references namespace DSWeb.MvcShipping.DAL.WMSStock { /// /// 数据访问类:WMSStock /// public partial class WMSStockDAL { public WMSStockDAL() { } #region BasicMethod static Database db = DatabaseFactory.CreateDatabase(); static public bool Add(WMSOUT_GuiGe model) { //动软代码 StringBuilder strSql = new StringBuilder(); strSql.Append("insert into wms_out(GID,BSNO,CUSTOMERNAME,SALECONTRACT,GOODSNAME,DODATE,CREATEUSER,EIP,"); strSql.Append("ISDETAIL,CREATETIME,GOODSPFSL,GOODSPACKPFSL,ISDELETE,GOODSOUTFEE,ARCLIENTWMSOUT,STORAGENAME,ACCDATE,"); strSql.Append("REMARK,REMARK2)"); strSql.Append(" values (@GID,@BSNO,@CUSTOMERNAME,@SALECONTRACT,@GOODSNAME,@DODATE,@CREATEUSER,@EIP,"); strSql.Append("@ISDETAIL,@CREATETIME,@GOODSPFSL,@GOODSPACKPFSL,@ISDELETE,@GOODSOUTFEE,"); strSql.Append("@ARCLIENTWMSOUT,@STORAGENAME,@ACCDATE,@REMARK,@REMARK2)"); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50), new SqlParameter("@BSNO", SqlDbType.VarChar,50), new SqlParameter("@CUSTOMERNAME", SqlDbType.VarChar,100), new SqlParameter("@SALECONTRACT", SqlDbType.VarChar,50), new SqlParameter("@GOODSNAME", SqlDbType.VarChar,50), new SqlParameter("@DODATE", SqlDbType.VarChar,50), new SqlParameter("@CREATEUSER", SqlDbType.VarChar,50), new SqlParameter("@EIP", SqlDbType.VarChar,10), new SqlParameter("@ISDETAIL", SqlDbType.VarChar,10), new SqlParameter("@CREATETIME", SqlDbType.VarChar,50), new SqlParameter("@GOODSPFSL", SqlDbType.VarChar,50), new SqlParameter("@GOODSPACKPFSL", SqlDbType.VarChar,50), new SqlParameter("@ISDELETE", SqlDbType.VarChar,10), new SqlParameter("@GOODSOUTFEE", SqlDbType.VarChar,10), new SqlParameter("@ARCLIENTWMSOUT", SqlDbType.VarChar,100), new SqlParameter("@STORAGENAME", SqlDbType.VarChar,100), new SqlParameter("@ACCDATE", SqlDbType.VarChar,50), new SqlParameter("@REMARK", SqlDbType.VarChar,100), new SqlParameter("@REMARK2", SqlDbType.VarChar,100), }; parameters[0].Value = model.GID; parameters[1].Value = model.BSNO; parameters[2].Value = model.CUSTOMERNAME; parameters[3].Value = model.SALECONTRACT; parameters[4].Value = model.GOODSNAME; parameters[5].Value = model.DODATE; parameters[6].Value = model.CREATEUSER; parameters[7].Value = "1"; parameters[8].Value = "1"; parameters[9].Value = (model.CREATETIME).ToString("d"); parameters[10].Value = model.GOODSPFSL; parameters[11].Value = model.GOODSPACKPFSL; parameters[12].Value = "0"; parameters[13].Value = model.GOODSOUTFEE; parameters[14].Value = model.ARCLIENTWMSOUT; parameters[15].Value = model.STORAGENAME; parameters[16].Value = model.ACCDATE; parameters[17].Value = model.REMARK; parameters[18].Value = model.REMARK2; //公共代码 SqlCommand com = new SqlCommand(); com.CommandText = strSql.ToString(); com.Parameters.AddRange(parameters); if (db.ExecuteNonQuery(com) > 0) return true; else return false; } static public bool AddWMSOut(WmsOutDetailModels model) { //动软代码 StringBuilder strSql = new StringBuilder(); strSql.Append("insert into wms_out_detail(GID,OUTBSNO,INBSNO,GOODSNAME,GOODSNAMEID,"); strSql.Append("TRAYNO,GOODSPFSL,GOODSPACKPFSL,DODATE,STARTBILLINGDATE,ENDBILLINGDATE,STORAGENAME) "); strSql.Append(" values (@GID,@OUTBSNO,@INBSNO,@GOODSNAME,@GOODSNAMEID,"); strSql.Append("@TRAYNO,@GOODSPFSL,@GOODSPACKPFSL,@DODATE,@STARTBILLINGDATE,@ENDBILLINGDATE,@STORAGENAME)"); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50), new SqlParameter("@OUTBSNO", SqlDbType.VarChar,50), new SqlParameter("@INBSNO", SqlDbType.VarChar,50), new SqlParameter("@GOODSNAME", SqlDbType.VarChar,200), new SqlParameter("@GOODSNAMEID", SqlDbType.VarChar,200), new SqlParameter("@TRAYNO", SqlDbType.VarChar,50), new SqlParameter("@GOODSPFSL", SqlDbType.VarChar,50), new SqlParameter("@GOODSPACKPFSL", SqlDbType.VarChar,50), new SqlParameter("@DODATE", SqlDbType.VarChar,50), new SqlParameter("@STARTBILLINGDATE", SqlDbType.VarChar,50), new SqlParameter("@ENDBILLINGDATE", SqlDbType.VarChar,50), new SqlParameter("@STORAGENAME", SqlDbType.VarChar,100), }; parameters[0].Value = model.GID; parameters[1].Value = model.OUTBSNO; parameters[2].Value = model.INBSNO; parameters[3].Value = model.GOODSNAME; parameters[4].Value = model.GOODSNAMEID; parameters[5].Value = model.TRAYNO; parameters[6].Value = model.GOODSPFSL; parameters[7].Value = model.GOODSPACKPFSL; parameters[8].Value = model.DODATE; parameters[9].Value = model.STARTBILLINGDATE; parameters[10].Value = model.ENDBILLINGDATE; parameters[11].Value = model.STORAGENAME; //公共代码 SqlCommand com = new SqlCommand(); com.CommandText = strSql.ToString(); com.Parameters.AddRange(parameters); if (db.ExecuteNonQuery(com) > 0) return true; else return false; } #endregion BasicMethod #region ExtensionMethod #endregion ExtensionMethod } }