You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
9.8 KiB
C#

10 months ago
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.WMSNew;
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.WMSDeliver
{
/// <summary>
/// 数据访问类:WMSDeliver
/// </summary>
public partial class WMSDeliverDAL
{
public WMSDeliverDAL()
{ }
#region BasicMethod
static Database db = DatabaseFactory.CreateDatabase();
static public int Add(WMSNew model)
{
//动软代码
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into wms(");
strSql.Append("GID,WMSNO,CUSTOMERNAME,FACTORY,CONTRACTNO,WMSDATE,CREATEUSER,CREATETIME,CHARGEUNIT,STARTBILLINGDATE,ARCLIENT,EIP,");
strSql.Append("GOODSPACK,GOODSKGS,GOODSRKSL,GOODSPACKSTOCK,GOODSSTOCK,CORPID,GOODSNAME,STORAGENAME,ASSOCIATEDNO)");
strSql.Append(" values (");
strSql.Append("@GID,@WMSNO,@CUSTOMERNAME,@FACTORY,@CONTRACTNO,@WMSDATE,@CREATEUSER,@CREATETIME,@CHARGEUNIT,@STARTBILLINGDATE,@ARCLIENT,@EIP,");
strSql.Append("@GOODSPACK,@GOODSKGS,@GOODSRKSL,@GOODSPACKSTOCK,@GOODSSTOCK,@CORPID,@GOODSNAME,@STORAGENAME,@ASSOCIATEDNO)");
SqlParameter[] parameters =
{
new SqlParameter("@GID", SqlDbType.VarChar, 50),
new SqlParameter("@WMSNO", SqlDbType.VarChar, 50),
new SqlParameter("@CUSTOMERNAME", SqlDbType.VarChar, 50),
new SqlParameter("@FACTORY", SqlDbType.VarChar, 50),
new SqlParameter("@CONTRACTNO", SqlDbType.VarChar, 50),
new SqlParameter("@WMSDATE", SqlDbType.VarChar, 50),
new SqlParameter("@CREATEUSER", SqlDbType.VarChar, 50),
new SqlParameter("@CREATETIME", SqlDbType.VarChar, 50),
new SqlParameter("@CHARGEUNIT", SqlDbType.VarChar, 50),
new SqlParameter("@STARTBILLINGDATE", SqlDbType.VarChar, 50),
new SqlParameter("@ARCLIENT", SqlDbType.VarChar, 50),
new SqlParameter("@EIP", SqlDbType.VarChar, 10),
new SqlParameter("@GOODSPACK", SqlDbType.VarChar, 50),
new SqlParameter("@GOODSKGS", SqlDbType.VarChar, 50),
new SqlParameter("@GOODSRKSL", SqlDbType.VarChar, 50),
new SqlParameter("@GOODSPACKSTOCK", SqlDbType.VarChar, 50),
new SqlParameter("@GOODSSTOCK", SqlDbType.VarChar, 50),
new SqlParameter("@CORPID", SqlDbType.VarChar,36),
new SqlParameter("@GOODSNAME", SqlDbType.VarChar, 200),
new SqlParameter("@STORAGENAME", SqlDbType.VarChar, 200),
new SqlParameter("@ASSOCIATEDNO", SqlDbType.VarChar, 200)
};
parameters[0].Value = model.GID;
parameters[1].Value = model.WMSNO;
parameters[2].Value = model.CUSTOMERNAME;
parameters[3].Value = "";
parameters[4].Value = model.CONTRACTNO;
parameters[5].Value = DateTime.Now.ToString("yyyy-MM-dd");
parameters[6].Value = model.CREATEUSER;
parameters[7].Value = model.CREATETIME;
parameters[8].Value = model.CHARGEUNIT;
//parameters[9].Value = model.STARTBILLINGDATE;
parameters[9].Value = DateTime.Now.ToString("yyyy-MM-dd"); ;
parameters[10].Value = model.ARCLIENT;
parameters[11].Value = "true";
parameters[12].Value = model.GOODSPACK;
parameters[13].Value = model.GOODSKGS;
parameters[14].Value = model.GOODSRKSL;
parameters[15].Value = model.GOODSPACKSTOCK;
parameters[16].Value = model.GOODSSTOCK;
parameters[17].Value = model.CORPID;
parameters[18].Value = model.GOODSNAME;
parameters[19].Value = model.STORAGENAME;
parameters[20].Value = model.GID;//保存时费用需要,要不然报先 保存业务信息的弹框
//公共代码
SqlCommand com = new SqlCommand();
com.CommandText = strSql.ToString();
com.Parameters.AddRange(parameters);
return db.ExecuteNonQuery(com);
}
static public int AddWMSIN(WMSNewIN model)
{
//动软代码
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into wms_in(");
strSql.Append("GID,ASSOCIATEDNO,GOODSNAME,JIANSHU1,GOODSPACK,GOODSKGS,GOODSRKSL,CHARGEUNIT,GOODSSTOCK,");
strSql.Append("GOODSPACKSTOCK,CORPID,TRAYNO,STORAGENAME,CONTRACTNO)");
strSql.Append(" values (");
strSql.Append("@GID,@ASSOCIATEDNO,@GOODSNAME,@JIANSHU1,@GOODSPACK,@GOODSKGS,@GOODSRKSL,@CHARGEUNIT,@GOODSSTOCK,");
strSql.Append("@GOODSPACKSTOCK,@CORPID,@TRAYNO,@STORAGENAME,@CONTRACTNO)");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50),
new SqlParameter("@ASSOCIATEDNO", SqlDbType.VarChar,50),
new SqlParameter("@GOODSNAME", SqlDbType.VarChar,200),
new SqlParameter("@JIANSHU1", SqlDbType.VarChar,50),
new SqlParameter("@GOODSPACK", SqlDbType.VarChar,50),
new SqlParameter("@GOODSKGS", SqlDbType.VarChar,50),
new SqlParameter("@GOODSRKSL", SqlDbType.VarChar,50),
new SqlParameter("@CHARGEUNIT", SqlDbType.VarChar,50),
new SqlParameter("@GOODSSTOCK", SqlDbType.VarChar,50),
new SqlParameter("@GOODSPACKSTOCK", SqlDbType.VarChar,50),
new SqlParameter("@CORPID", SqlDbType.VarChar,36),
new SqlParameter("@TRAYNO", SqlDbType.VarChar,100),
new SqlParameter("@STORAGENAME", SqlDbType.VarChar,100),
new SqlParameter("@CONTRACTNO", SqlDbType.VarChar,100),
};
parameters[0].Value = model.GID;
parameters[1].Value = model.ASSOCIATEDNO;
parameters[2].Value = model.GOODSNAME;
parameters[3].Value = model.JIANSHU1;
parameters[4].Value = model.GOODSPACK;
parameters[5].Value = model.GOODSKGS;
parameters[6].Value = model.GOODSRKSL;
parameters[7].Value = model.CHARGEUNIT;
parameters[8].Value = model.GOODSSTOCK;
parameters[9].Value = model.GOODSPACKSTOCK;
parameters[10].Value = model.CORPID;
parameters[11].Value = model.TRAYNO;
parameters[12].Value = model.STORAGENAME;
parameters[13].Value = model.CONTRACTNO;
//公共代码
SqlCommand com = new SqlCommand();
com.CommandText = strSql.ToString();
com.Parameters.AddRange(parameters);
return db.ExecuteNonQuery(com);
}
static public int AddGoods(EIP_Goods model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into WMS_EIPGoods(");
strSql.Append("GID,BSNO,TRGID,SPECS,GOODSNAME,PKGS,UNIT,WEIGHT,REMARK,CORPID,REMNANT,CONTRACTNUM,TRAYNO)");
strSql.Append(" values (");
strSql.Append("@GID,@BSNO,@TRGID,@SPECS,@GOODSNAME,@PKGS,@UNIT,@WEIGHT,@REMARK,@CORPID,@REMNANT,@CONTRACTNUM,@TRAYNO)");
SqlParameter[] parameters = {
new SqlParameter("@GID", SqlDbType.VarChar,50),
new SqlParameter("@BSNO", SqlDbType.VarChar,100),
new SqlParameter("@TRGID", SqlDbType.VarChar,50),
new SqlParameter("@SPECS", SqlDbType.VarChar,50),
new SqlParameter("@GOODSNAME", SqlDbType.VarChar,50),
new SqlParameter("@PKGS", SqlDbType.Int,4),
new SqlParameter("@UNIT", SqlDbType.VarChar,50),
new SqlParameter("@WEIGHT", SqlDbType.Decimal,9),
new SqlParameter("@REMARK", SqlDbType.VarChar,500),
new SqlParameter("@CORPID", SqlDbType.VarChar,36),
new SqlParameter("@REMNANT",SqlDbType.Int,4),
new SqlParameter("@CONTRACTNUM",SqlDbType.Int,4),
new SqlParameter("@TRAYNO", SqlDbType.VarChar,50),
};
parameters[0].Value = model.GID ?? (Object)DBNull.Value; ;
parameters[1].Value = model.BSNO ?? (Object)DBNull.Value; ;
parameters[2].Value = model.TRGID ?? (Object)DBNull.Value; ;
parameters[3].Value = model.SPECS ?? (Object)DBNull.Value; ;
parameters[4].Value = model.GOODSNAME ?? (Object)DBNull.Value; ;
parameters[5].Value = model.PKGS ?? (Object)DBNull.Value; ;
parameters[6].Value = model.UNIT ?? (Object)DBNull.Value; ;
parameters[7].Value = model.WEIGHT ?? (Object)DBNull.Value; ;
parameters[8].Value = model.REMARK ?? (Object)DBNull.Value; ;
parameters[9].Value = model.CORPID ?? (Object)DBNull.Value; ;
parameters[10].Value = model.REMNANT ?? (Object)DBNull.Value; ;
parameters[11].Value = model.CONTRACTNUM ?? (Object)DBNull.Value; ;
parameters[12].Value = model.TRAYNO ?? (Object)DBNull.Value; ;
//公共代码
SqlCommand com = new SqlCommand();
com.CommandText = strSql.ToString();
com.Parameters.AddRange(parameters);
return db.ExecuteNonQuery(com);
}
#endregion BasicMethod
#region ExtensionMethod
#endregion ExtensionMethod
}
}