|
|
using System;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
using System.Configuration;
|
|
|
using System.Web;
|
|
|
using System.Web.Security;
|
|
|
using System.Web.UI;
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
using System.Web.UI.WebControls;
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
using DSWeb.DataAccess;
|
|
|
using DSWeb.Models;
|
|
|
using System.Data.SqlClient;
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
namespace DSWeb.EntityDA
|
|
|
{
|
|
|
public class WmsInDA
|
|
|
{
|
|
|
private const string SQL_SELECT_INFO = "select GID,ASSOCIATEDNO,BLNO,CONTRACTNO,CNTRNO,SEALNO,BSNO,CLIENTCODE,CLIENTNAME,DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME,GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,CHARGEUNIT,GOODSRKSL,GOODSSTOCK,ISLOCK,LOCKTIME,LOCKUSER,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,FREESTORAGEPERIOD,GOODSPACKSTOCK,GOODSKGS,CLIENTCODEOLD,CLIENTNAMEOLD,KINDPKGS,ARFEE,APFEE,CTNALL,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSGRADE,STACKLOCATION,GOODSPACKACTUAL,GOODSRKSLACTUAL,ISCHANGE,CORPID,MARKETVALUE,BANKVALUE,LINENUM from wms_in where GID=@GID and ISDELETE=0";//,CHARGEPRICE
|
|
|
|
|
|
private const string SQL_SELECT_INFO_BY_BSNO = "select GID,ASSOCIATEDNO,BLNO,CONTRACTNO,CNTRNO,SEALNO,BSNO,CLIENTCODE,CLIENTNAME,DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME,GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,CHARGEUNIT,GOODSRKSL,GOODSSTOCK,ISLOCK,LOCKTIME,LOCKUSER,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,FREESTORAGEPERIOD,GOODSPACKSTOCK,GOODSKGS,CLIENTCODEOLD,CLIENTNAMEOLD,KINDPKGS,ARFEE,APFEE,CTNALL,ISCHANGE,CORPID,MARKETVALUE,BANKVALUE,LINENUM from wms_in where BSNO=@BSNO and ISDELETE=0";//,CHARGEPRICE
|
|
|
|
|
|
private const string SQL_DELETE_INFO = "DELETE FROM wms_in WHERE GID=@GID";
|
|
|
|
|
|
private string strSql = "insert into wms_in(GID,ASSOCIATEDNO,BLNO,CONTRACTNO,CNTRNO,SEALNO,BSNO,CLIENTCODE,CLIENTNAME,{0}STORAGECODE,STORAGENAME,AREACODE,AREANAME,GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,CHARGEUNIT,GOODSRKSL,GOODSSTOCK,ISLOCK,LOCKUSER,ISDELETE,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,FREESTORAGEPERIOD,GOODSPACKSTOCK,GOODSKGS,CLIENTCODEOLD,CLIENTNAMEOLD,KINDPKGS,ARFEE,APFEE,CTNALL,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSGRADE,STACKLOCATION,GOODSPACKACTUAL,GOODSRKSLACTUAL,ISCHANGE,CORPID,MARKETVALUE,BANKVALUE,LINENUM) "
|
|
|
+ " values(@GID,@ASSOCIATEDNO,@BLNO,@CONTRACTNO,@CNTRNO,@SEALNO,@BSNO,@CLIENTCODE,@CLIENTNAME,{1}@STORAGECODE,@STORAGENAME,@AREACODE,@AREANAME,@GOODSCODE,@GOODSNAME,@GOODSTYPE,@GOODSMODEL,@GOODSSTANDARD,@GOODSPACK,@CHARGEUNIT,@GOODSRKSL,@GOODSSTOCK,@ISLOCK,@LOCKUSER,@ISDELETE,@DELETEUSER,@CREATEUSER,getdate(),@MODIFIEDUSER,getdate(),@REMARK,@FREESTORAGEPERIOD,@GOODSPACKSTOCK,@GOODSKGS,@CLIENTCODEOLD,@CLIENTNAMEOLD,@KINDPKGS,@ARFEE,@APFEE,@CTNALL,@GOODSTHICKNESS,@GOODSWIDTH,@GOODSLENGTH,@GOODSSLICE,@GOODSGRADE,@STACKLOCATION,@GOODSPACKACTUAL,@GOODSRKSLACTUAL,@ISCHANGE,@CORPID,@MARKETVALUE,@BANKVALUE,@LINENUM)";//,CHARGEPRICE,@CHARGEPRICE
|
|
|
|
|
|
private string strSqlUpdateInfo = "update wms_in set BLNO=@BLNO,CONTRACTNO=@CONTRACTNO,CNTRNO=@CNTRNO,SEALNO=@SEALNO,BSNO=@BSNO,CLIENTCODE=@CLIENTCODE,CLIENTNAME=@CLIENTNAME,{0}STORAGECODE=@STORAGECODE,STORAGENAME=@STORAGENAME,AREACODE=@AREACODE,AREANAME=@AREANAME,GOODSCODE=@GOODSCODE,GOODSNAME=@GOODSNAME,GOODSTYPE=@GOODSTYPE,GOODSMODEL=@GOODSMODEL,GOODSSTANDARD=@GOODSSTANDARD,GOODSPACK=@GOODSPACK,CHARGEUNIT=@CHARGEUNIT,GOODSRKSL=@GOODSRKSL,GOODSSTOCK=@GOODSSTOCK,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=getdate(),REMARK=@REMARK,FREESTORAGEPERIOD=@FREESTORAGEPERIOD,GOODSPACKSTOCK=@GOODSPACKSTOCK,GOODSKGS=@GOODSKGS,KINDPKGS=@KINDPKGS,ARFEE=@ARFEE,APFEE=@APFEE,CTNALL=@CTNALL,CORPID=@CORPID,MARKETVALUE=@MARKETVALUE,BANKVALUE=@BANKVALUE,ISCHANGE=@ISCHANGE,LINENUM=@LINENUM where GID=@GID";// ASSOCIATEDNO=@ASSOCIATEDNO,CHARGEPRICE=@CHARGEPRICE
|
|
|
|
|
|
public WmsInDA()
|
|
|
{
|
|
|
}
|
|
|
|
|
|
#region 根据GID获取信息
|
|
|
/// <summary>
|
|
|
/// 根据GID获取信息
|
|
|
/// </summary>
|
|
|
/// <param name="strRoleGID"></param>
|
|
|
/// <returns></returns>
|
|
|
public WmsInEntity GetID(string strGID)
|
|
|
{
|
|
|
//初始化返回变量
|
|
|
WmsInEntity WmsInEntity = null;
|
|
|
//初始化参数并赋值
|
|
|
SqlParameter parm = new SqlParameter("@GID", SqlDbType.VarChar, 100);
|
|
|
parm.Value = strGID;
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO, parm))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
WmsInEntity = new WmsInEntity();
|
|
|
//读取字段值
|
|
|
while (sqlRead.Read())
|
|
|
{
|
|
|
if (!sqlRead.IsDBNull(0)) { WmsInEntity.GID = sqlRead.GetString(0); }// 惟一编号
|
|
|
if (!sqlRead.IsDBNull(1)) { WmsInEntity.ASSOCIATEDNO = sqlRead.GetString(1); }// 关联号
|
|
|
if (!sqlRead.IsDBNull(2)) { WmsInEntity.BLNO = sqlRead.GetString(2); }// 提单号
|
|
|
if (!sqlRead.IsDBNull(3)) { WmsInEntity.CONTRACTNO = sqlRead.GetString(3); }// 合同号
|
|
|
if (!sqlRead.IsDBNull(4)) { WmsInEntity.CNTRNO = sqlRead.GetString(4); }// 箱号
|
|
|
if (!sqlRead.IsDBNull(5)) { WmsInEntity.SEALNO = sqlRead.GetString(5); }// 封号
|
|
|
if (!sqlRead.IsDBNull(6)) { WmsInEntity.BSNO = sqlRead.GetString(6); }// 仓单明细号
|
|
|
if (!sqlRead.IsDBNull(7)) { WmsInEntity.CLIENTCODE = sqlRead.GetString(7); }// 客户编码
|
|
|
if (!sqlRead.IsDBNull(8)) { WmsInEntity.CLIENTNAME = sqlRead.GetString(8); }// 客户名称
|
|
|
if (!sqlRead.IsDBNull(9)) { WmsInEntity.DODATE = sqlRead.GetDateTime(9); }// 操作时间
|
|
|
if (!sqlRead.IsDBNull(10)) { WmsInEntity.STORAGECODE = sqlRead.GetString(10); }// 仓库编码
|
|
|
if (!sqlRead.IsDBNull(11)) { WmsInEntity.STORAGENAME = sqlRead.GetString(11); }// 仓库名称
|
|
|
if (!sqlRead.IsDBNull(12)) { WmsInEntity.AREACODE = sqlRead.GetString(12); }// 库位编码
|
|
|
if (!sqlRead.IsDBNull(13)) { WmsInEntity.AREANAME = sqlRead.GetString(13); }// 库位名称
|
|
|
if (!sqlRead.IsDBNull(14)) { WmsInEntity.GOODSCODE = sqlRead.GetString(14); }// 货物编号
|
|
|
if (!sqlRead.IsDBNull(15)) { WmsInEntity.GOODSNAME = sqlRead.GetString(15); }// 货物名称
|
|
|
if (!sqlRead.IsDBNull(16)) { WmsInEntity.GOODSTYPE = sqlRead.GetString(16); }// 货物类型
|
|
|
if (!sqlRead.IsDBNull(17)) { WmsInEntity.GOODSMODEL = sqlRead.GetString(17); }// 型号
|
|
|
if (!sqlRead.IsDBNull(18)) { WmsInEntity.GOODSSTANDARD = sqlRead.GetString(18); }// 规格
|
|
|
if (!sqlRead.IsDBNull(19)) { WmsInEntity.GOODSPACK = sqlRead.GetDecimal(19); }// 件数
|
|
|
if (!sqlRead.IsDBNull(20)) { WmsInEntity.CHARGEUNIT = sqlRead.GetString(20); }// 计费单位
|
|
|
//if (!sqlRead.IsDBNull(21)) { WmsInEntity.CHARGEPRICE = sqlRead.GetDecimal(21); }// 计费单价
|
|
|
if (!sqlRead.IsDBNull(21)) { WmsInEntity.GOODSRKSL = sqlRead.GetDecimal(21); }// 入库量
|
|
|
if (!sqlRead.IsDBNull(22)) { WmsInEntity.GOODSSTOCK = sqlRead.GetDecimal(22); }// 库存量
|
|
|
if (!sqlRead.IsDBNull(23)) { WmsInEntity.ISLOCK = sqlRead.GetBoolean(23); }// 是否锁定
|
|
|
if (!sqlRead.IsDBNull(24)) { WmsInEntity.LOCKTIME = sqlRead.GetDateTime(24); }// 锁定时间
|
|
|
if (!sqlRead.IsDBNull(25)) { WmsInEntity.LOCKUSER = sqlRead.GetString(25); }// 锁定操作人
|
|
|
if (!sqlRead.IsDBNull(26)) { WmsInEntity.ISDELETE = sqlRead.GetBoolean(26); }// 是否废除
|
|
|
if (!sqlRead.IsDBNull(27)) { WmsInEntity.DELETETIME = sqlRead.GetDateTime(27); }// 废除时间
|
|
|
if (!sqlRead.IsDBNull(28)) { WmsInEntity.DELETEUSER = sqlRead.GetString(28); }// 废除操作人
|
|
|
if (!sqlRead.IsDBNull(29)) { WmsInEntity.CREATEUSER = sqlRead.GetString(29); }// 创建人
|
|
|
if (!sqlRead.IsDBNull(30)) { WmsInEntity.CREATETIME = sqlRead.GetDateTime(30); }// 创建时间
|
|
|
if (!sqlRead.IsDBNull(31)) { WmsInEntity.MODIFIEDUSER = sqlRead.GetString(31); }// 最后一次更新操作人
|
|
|
if (!sqlRead.IsDBNull(32)) { WmsInEntity.MODIFIEDTIME = sqlRead.GetDateTime(32); }// 最后一次更新操作时间
|
|
|
if (!sqlRead.IsDBNull(33)) { WmsInEntity.REMARK = sqlRead.GetString(33); }// 备注
|
|
|
if (!sqlRead.IsDBNull(34)) { WmsInEntity.FREESTORAGEPERIOD = sqlRead.GetInt32(34); }// 免仓储期
|
|
|
if (!sqlRead.IsDBNull(35)) { WmsInEntity.GOODSPACKSTOCK = sqlRead.GetDecimal(35); }// 剩余件数
|
|
|
if (!sqlRead.IsDBNull(36)) { WmsInEntity.GOODSKGS = sqlRead.GetDecimal(36); }// 重量
|
|
|
if (!sqlRead.IsDBNull(37)) { WmsInEntity.CLIENTCODEOLD = sqlRead.GetString(37); }// 原客户编码
|
|
|
if (!sqlRead.IsDBNull(38)) { WmsInEntity.CLIENTNAMEOLD = sqlRead.GetString(38); }// 原客户名称
|
|
|
if (!sqlRead.IsDBNull(39)) { WmsInEntity.KINDPKGS = sqlRead.GetString(39); }//
|
|
|
if (!sqlRead.IsDBNull(40)) { WmsInEntity.ARFEE = sqlRead.GetDecimal(40); }//
|
|
|
if (!sqlRead.IsDBNull(41)) { WmsInEntity.APFEE = sqlRead.GetDecimal(41); }//
|
|
|
if (!sqlRead.IsDBNull(42)) { WmsInEntity.CTNALL = sqlRead.GetString(42); }//
|
|
|
if (!sqlRead.IsDBNull(43)) { WmsInEntity.GOODSTHICKNESS = sqlRead.GetDecimal(43); }//
|
|
|
if (!sqlRead.IsDBNull(44)) { WmsInEntity.GOODSWIDTH = sqlRead.GetDecimal(44); }//
|
|
|
if (!sqlRead.IsDBNull(45)) { WmsInEntity.GOODSLENGTH = sqlRead.GetDecimal(45); }//
|
|
|
if (!sqlRead.IsDBNull(46)) { WmsInEntity.GOODSSLICE = sqlRead.GetDecimal(46); }//
|
|
|
if (!sqlRead.IsDBNull(47)) { WmsInEntity.GOODSGRADE = sqlRead.GetString(47); }//
|
|
|
if (!sqlRead.IsDBNull(48)) { WmsInEntity.STACKLOCATION = sqlRead.GetString(48); }//
|
|
|
if (!sqlRead.IsDBNull(49)) { WmsInEntity.GOODSPACKACTUAL = sqlRead.GetDecimal(49); }//
|
|
|
if (!sqlRead.IsDBNull(50)) { WmsInEntity.GOODSRKSLACTUAL = sqlRead.GetDecimal(50); }//
|
|
|
if (!sqlRead.IsDBNull(51)) { WmsInEntity.ISCHANGE = sqlRead.GetBoolean(51); }//
|
|
|
if (!sqlRead.IsDBNull(52)) { WmsInEntity.CORPID = sqlRead.GetString(52); }//
|
|
|
if (!sqlRead.IsDBNull(53)) { WmsInEntity.MARKETVALUE = sqlRead.GetDecimal(53); }//
|
|
|
if (!sqlRead.IsDBNull(54)) { WmsInEntity.BANKVALUE = sqlRead.GetDecimal(54); }//
|
|
|
if (!sqlRead.IsDBNull(55)) { WmsInEntity.LINENUM = sqlRead.GetInt32(55); }//
|
|
|
}
|
|
|
}
|
|
|
catch (Exception exceError)
|
|
|
{
|
|
|
//抛出异常
|
|
|
throw exceError;
|
|
|
}
|
|
|
}
|
|
|
return WmsInEntity;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 根据BSNO获取信息
|
|
|
/// <summary>
|
|
|
/// 根据BSNO获取信息
|
|
|
/// </summary>
|
|
|
/// <param name="strBSNO"></param>
|
|
|
/// <returns></returns>
|
|
|
public WmsInEntity GetByBSNO(string strBSNO)
|
|
|
{
|
|
|
//初始化返回变量
|
|
|
WmsInEntity WmsInEntity = null;
|
|
|
//初始化参数并赋值
|
|
|
SqlParameter parm = new SqlParameter("@BSNO", SqlDbType.VarChar, 100);
|
|
|
parm.Value = strBSNO;
|
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO_BY_BSNO, parm))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
WmsInEntity = new WmsInEntity();
|
|
|
//读取字段值
|
|
|
while (sqlRead.Read())
|
|
|
{
|
|
|
if (!sqlRead.IsDBNull(0)) { WmsInEntity.GID = sqlRead.GetString(0); }// 惟一编号
|
|
|
if (!sqlRead.IsDBNull(1)) { WmsInEntity.ASSOCIATEDNO = sqlRead.GetString(1); }// 关联号
|
|
|
if (!sqlRead.IsDBNull(2)) { WmsInEntity.BLNO = sqlRead.GetString(2); }// 提单号
|
|
|
if (!sqlRead.IsDBNull(3)) { WmsInEntity.CONTRACTNO = sqlRead.GetString(3); }// 合同号
|
|
|
if (!sqlRead.IsDBNull(4)) { WmsInEntity.CNTRNO = sqlRead.GetString(4); }// 箱号
|
|
|
if (!sqlRead.IsDBNull(5)) { WmsInEntity.SEALNO = sqlRead.GetString(5); }// 封号
|
|
|
if (!sqlRead.IsDBNull(6)) { WmsInEntity.BSNO = sqlRead.GetString(6); }// 仓单明细号
|
|
|
if (!sqlRead.IsDBNull(7)) { WmsInEntity.CLIENTCODE = sqlRead.GetString(7); }// 客户编码
|
|
|
if (!sqlRead.IsDBNull(8)) { WmsInEntity.CLIENTNAME = sqlRead.GetString(8); }// 客户名称
|
|
|
if (!sqlRead.IsDBNull(9)) { WmsInEntity.DODATE = sqlRead.GetDateTime(9); }// 操作时间
|
|
|
if (!sqlRead.IsDBNull(10)) { WmsInEntity.STORAGECODE = sqlRead.GetString(10); }// 仓库编码
|
|
|
if (!sqlRead.IsDBNull(11)) { WmsInEntity.STORAGENAME = sqlRead.GetString(11); }// 仓库名称
|
|
|
if (!sqlRead.IsDBNull(12)) { WmsInEntity.AREACODE = sqlRead.GetString(12); }// 库位编码
|
|
|
if (!sqlRead.IsDBNull(13)) { WmsInEntity.AREANAME = sqlRead.GetString(13); }// 库位名称
|
|
|
if (!sqlRead.IsDBNull(14)) { WmsInEntity.GOODSCODE = sqlRead.GetString(14); }// 货物编号
|
|
|
if (!sqlRead.IsDBNull(15)) { WmsInEntity.GOODSNAME = sqlRead.GetString(15); }// 货物名称
|
|
|
if (!sqlRead.IsDBNull(16)) { WmsInEntity.GOODSTYPE = sqlRead.GetString(16); }// 货物类型
|
|
|
if (!sqlRead.IsDBNull(17)) { WmsInEntity.GOODSMODEL = sqlRead.GetString(17); }// 型号
|
|
|
if (!sqlRead.IsDBNull(18)) { WmsInEntity.GOODSSTANDARD = sqlRead.GetString(18); }// 规格
|
|
|
if (!sqlRead.IsDBNull(19)) { WmsInEntity.GOODSPACK = sqlRead.GetDecimal(19); }// 件数
|
|
|
if (!sqlRead.IsDBNull(20)) { WmsInEntity.CHARGEUNIT = sqlRead.GetString(20); }// 计费单位
|
|
|
//if (!sqlRead.IsDBNull(21)) { WmsInEntity.CHARGEPRICE = sqlRead.GetDecimal(21); }// 计费单价
|
|
|
if (!sqlRead.IsDBNull(21)) { WmsInEntity.GOODSRKSL = sqlRead.GetDecimal(21); }// 入库量
|
|
|
if (!sqlRead.IsDBNull(22)) { WmsInEntity.GOODSSTOCK = sqlRead.GetDecimal(22); }// 库存量
|
|
|
if (!sqlRead.IsDBNull(23)) { WmsInEntity.ISLOCK = sqlRead.GetBoolean(23); }// 是否锁定
|
|
|
if (!sqlRead.IsDBNull(24)) { WmsInEntity.LOCKTIME = sqlRead.GetDateTime(24); }// 锁定时间
|
|
|
if (!sqlRead.IsDBNull(25)) { WmsInEntity.LOCKUSER = sqlRead.GetString(25); }// 锁定操作人
|
|
|
if (!sqlRead.IsDBNull(26)) { WmsInEntity.ISDELETE = sqlRead.GetBoolean(26); }// 是否废除
|
|
|
if (!sqlRead.IsDBNull(27)) { WmsInEntity.DELETETIME = sqlRead.GetDateTime(27); }// 废除时间
|
|
|
if (!sqlRead.IsDBNull(28)) { WmsInEntity.DELETEUSER = sqlRead.GetString(28); }// 废除操作人
|
|
|
if (!sqlRead.IsDBNull(29)) { WmsInEntity.CREATEUSER = sqlRead.GetString(29); }// 创建人
|
|
|
if (!sqlRead.IsDBNull(30)) { WmsInEntity.CREATETIME = sqlRead.GetDateTime(30); }// 创建时间
|
|
|
if (!sqlRead.IsDBNull(31)) { WmsInEntity.MODIFIEDUSER = sqlRead.GetString(31); }// 最后一次更新操作人
|
|
|
if (!sqlRead.IsDBNull(32)) { WmsInEntity.MODIFIEDTIME = sqlRead.GetDateTime(32); }// 最后一次更新操作时间
|
|
|
if (!sqlRead.IsDBNull(33)) { WmsInEntity.REMARK = sqlRead.GetString(33); }// 备注
|
|
|
if (!sqlRead.IsDBNull(34)) { WmsInEntity.FREESTORAGEPERIOD = sqlRead.GetInt32(34); }// 免仓储期
|
|
|
if (!sqlRead.IsDBNull(35)) { WmsInEntity.GOODSPACKSTOCK = sqlRead.GetDecimal(35); }// 件数
|
|
|
if (!sqlRead.IsDBNull(36)) { WmsInEntity.GOODSKGS = sqlRead.GetDecimal(36); }// 重量
|
|
|
if (!sqlRead.IsDBNull(37)) { WmsInEntity.CLIENTCODEOLD = sqlRead.GetString(37); }// 原客户编码
|
|
|
if (!sqlRead.IsDBNull(38)) { WmsInEntity.CLIENTNAMEOLD = sqlRead.GetString(38); }// 原客户名称
|
|
|
if (!sqlRead.IsDBNull(39)) { WmsInEntity.KINDPKGS = sqlRead.GetString(39); }//
|
|
|
if (!sqlRead.IsDBNull(40)) { WmsInEntity.ARFEE = sqlRead.GetDecimal(40); }//
|
|
|
if (!sqlRead.IsDBNull(41)) { WmsInEntity.APFEE = sqlRead.GetDecimal(41); }//
|
|
|
if (!sqlRead.IsDBNull(42)) { WmsInEntity.CTNALL = sqlRead.GetString(42); }//
|
|
|
if (!sqlRead.IsDBNull(43)) { WmsInEntity.ISCHANGE = sqlRead.GetBoolean(43); }//
|
|
|
if (!sqlRead.IsDBNull(44)) { WmsInEntity.CORPID = sqlRead.GetString(44); }//
|
|
|
if (!sqlRead.IsDBNull(45)) { WmsInEntity.MARKETVALUE = sqlRead.GetDecimal(45); }//
|
|
|
if (!sqlRead.IsDBNull(46)) { WmsInEntity.BANKVALUE = sqlRead.GetDecimal(46); }//
|
|
|
if (!sqlRead.IsDBNull(47)) { WmsInEntity.LINENUM = sqlRead.GetInt32(47); }//
|
|
|
}
|
|
|
}
|
|
|
catch (Exception exceError)
|
|
|
{
|
|
|
//抛出异常
|
|
|
throw exceError;
|
|
|
}
|
|
|
}
|
|
|
return WmsInEntity;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 插入信息
|
|
|
/// </summary>
|
|
|
/// <param name="WmsInEntity">实体类</param>
|
|
|
/// <returns>值为1插入数据正常,-1操作异常</returns>
|
|
|
public int InserInfo(WmsInEntity infoEntity)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
//获取参数
|
|
|
SqlParameter[] parms = GetInsertParms();
|
|
|
parms[0].Value = infoEntity.GID;// 惟一编号
|
|
|
parms[1].Value = infoEntity.ASSOCIATEDNO;// 关联号
|
|
|
parms[2].Value = infoEntity.BLNO;// 提单号
|
|
|
parms[3].Value = infoEntity.CONTRACTNO;// 合同号
|
|
|
parms[4].Value = infoEntity.CNTRNO;// 箱号
|
|
|
parms[5].Value = infoEntity.SEALNO;// 封号
|
|
|
parms[6].Value = infoEntity.BSNO;// 仓单明细号
|
|
|
parms[7].Value = infoEntity.CLIENTCODE;// 客户编码
|
|
|
parms[8].Value = infoEntity.CLIENTNAME;// 客户名称
|
|
|
parms[9].Value = infoEntity.STORAGECODE;// 仓库编码
|
|
|
parms[10].Value = infoEntity.STORAGENAME;// 仓库名称
|
|
|
parms[11].Value = infoEntity.AREACODE;// 库位编码
|
|
|
parms[12].Value = infoEntity.AREANAME;// 库位名称
|
|
|
parms[13].Value = infoEntity.GOODSCODE;// 货物编号
|
|
|
parms[14].Value = infoEntity.GOODSNAME;// 货物名称
|
|
|
parms[15].Value = infoEntity.GOODSTYPE;// 货物类型
|
|
|
parms[16].Value = infoEntity.GOODSMODEL;// 型号
|
|
|
parms[17].Value = infoEntity.GOODSSTANDARD;// 规格
|
|
|
parms[18].Value = infoEntity.GOODSPACK;// 件数
|
|
|
parms[19].Value = infoEntity.CHARGEUNIT;// 计费单位
|
|
|
//parms[20].Value = infoEntity.CHARGEPRICE;// 计费单价
|
|
|
parms[20].Value = infoEntity.GOODSRKSL;// 入库量
|
|
|
parms[21].Value = infoEntity.GOODSSTOCK;// 库存量
|
|
|
parms[22].Value = infoEntity.ISLOCK;// 是否锁定
|
|
|
parms[23].Value = infoEntity.LOCKUSER;// 锁定操作人
|
|
|
parms[24].Value = infoEntity.ISDELETE;// 是否废除
|
|
|
parms[25].Value = infoEntity.DELETEUSER;// 废除操作人
|
|
|
parms[26].Value = infoEntity.CREATEUSER;// 创建人
|
|
|
parms[27].Value = infoEntity.MODIFIEDUSER;// 最后一次更新操作人
|
|
|
parms[28].Value = infoEntity.REMARK;// 备注
|
|
|
parms[29].Value = infoEntity.FREESTORAGEPERIOD;//
|
|
|
parms[30].Value = infoEntity.GOODSPACKSTOCK;//
|
|
|
parms[31].Value = infoEntity.GOODSKGS;// 重量
|
|
|
parms[32].Value = infoEntity.CLIENTCODEOLD;// 客户编码
|
|
|
parms[33].Value = infoEntity.CLIENTNAMEOLD;// 客户名称
|
|
|
parms[34].Value = infoEntity.KINDPKGS;//
|
|
|
parms[35].Value = infoEntity.ARFEE;//
|
|
|
parms[36].Value = infoEntity.APFEE;//
|
|
|
parms[37].Value = infoEntity.CTNALL;//
|
|
|
parms[38].Value = infoEntity.GOODSTHICKNESS;
|
|
|
parms[39].Value = infoEntity.GOODSWIDTH;
|
|
|
parms[40].Value = infoEntity.GOODSLENGTH;
|
|
|
parms[41].Value = infoEntity.GOODSSLICE;
|
|
|
parms[42].Value = infoEntity.GOODSGRADE;
|
|
|
parms[43].Value = infoEntity.STACKLOCATION;
|
|
|
parms[44].Value = infoEntity.GOODSPACKACTUAL;
|
|
|
parms[45].Value = infoEntity.GOODSRKSLACTUAL;
|
|
|
parms[46].Value = infoEntity.ISCHANGE;
|
|
|
parms[47].Value = infoEntity.CORPID;
|
|
|
parms[48].Value = infoEntity.MARKETVALUE;
|
|
|
parms[49].Value = infoEntity.BANKVALUE;
|
|
|
parms[50].Value = infoEntity.LINENUM;
|
|
|
|
|
|
//parms[31].Value = infoEntity.DODATE;// 操作时间
|
|
|
//parms[32].Value = infoEntity.LOCKTIME;// 锁定时间
|
|
|
//parms[33].Value = infoEntity.DELETETIME;// 废除时间
|
|
|
//parms[34].Value = infoEntity.CREATETIME;// 创建时间
|
|
|
//parms[35].Value = infoEntity.MODIFIEDTIME;// 最后一次更新操作时间
|
|
|
//操作时间
|
|
|
string strDODATE = infoEntity.DODATE.ToString().IndexOf("0001")>-1 ? "getdate()," : "'" + infoEntity.DODATE.ToString() + "',";
|
|
|
string strDODATE_name = "DODATE,";
|
|
|
strSql = String.Format(strSql, strDODATE_name, strDODATE);
|
|
|
//
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql, parms);
|
|
|
if (existVal > 0)
|
|
|
{
|
|
|
iResult = 1;
|
|
|
//
|
|
|
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('插入wms_in海运业务预订舱表','插入操作','BSNO=" + infoEntity.BSNO + "','" + infoEntity.INPUTBY + "')";
|
|
|
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -1;//执行异常
|
|
|
}
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新信息
|
|
|
/// </summary>
|
|
|
/// <param name="WmsInEntity">实体类</param>
|
|
|
/// <returns>值为1更新数据正常,-1操作异常</returns>
|
|
|
public int UpdateInfo(WmsInEntity infoEntity)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
//获取参数
|
|
|
SqlParameter[] parms = GetUpdateParms();
|
|
|
parms[0].Value = infoEntity.GID;// 惟一编号
|
|
|
parms[1].Value = infoEntity.ASSOCIATEDNO;// 关联号
|
|
|
parms[2].Value = infoEntity.BLNO;// 提单号
|
|
|
parms[3].Value = infoEntity.CONTRACTNO;// 合同号
|
|
|
parms[4].Value = infoEntity.CNTRNO;// 箱号
|
|
|
parms[5].Value = infoEntity.SEALNO;// 封号
|
|
|
parms[6].Value = infoEntity.BSNO;// 仓单明细号
|
|
|
parms[7].Value = infoEntity.CLIENTCODE;// 客户编码
|
|
|
parms[8].Value = infoEntity.CLIENTNAME;// 客户名称
|
|
|
parms[9].Value = infoEntity.STORAGECODE;// 仓库编码
|
|
|
parms[10].Value = infoEntity.STORAGENAME;// 仓库名称
|
|
|
parms[11].Value = infoEntity.AREACODE;// 库位编码
|
|
|
parms[12].Value = infoEntity.AREANAME;// 库位名称
|
|
|
parms[13].Value = infoEntity.GOODSCODE;// 货物编号
|
|
|
parms[14].Value = infoEntity.GOODSNAME;// 货物名称
|
|
|
parms[15].Value = infoEntity.GOODSTYPE;// 货物类型
|
|
|
parms[16].Value = infoEntity.GOODSMODEL;// 型号
|
|
|
parms[17].Value = infoEntity.GOODSSTANDARD;// 规格
|
|
|
parms[18].Value = infoEntity.GOODSPACK;// 件数
|
|
|
parms[19].Value = infoEntity.CHARGEUNIT;// 计费单位
|
|
|
//parms[20].Value = infoEntity.CHARGEPRICE;// 计费单价
|
|
|
parms[20].Value = infoEntity.GOODSRKSL;// 入库量
|
|
|
parms[21].Value = infoEntity.GOODSSTOCK;// 库存量
|
|
|
parms[22].Value = infoEntity.MODIFIEDUSER;// 最后一次更新操作人
|
|
|
parms[23].Value = infoEntity.REMARK;// 备注
|
|
|
parms[24].Value = infoEntity.FREESTORAGEPERIOD;//
|
|
|
parms[25].Value = infoEntity.GOODSPACKSTOCK;//
|
|
|
parms[26].Value = infoEntity.GOODSKGS;// 重量
|
|
|
parms[27].Value = infoEntity.KINDPKGS;//
|
|
|
parms[28].Value = infoEntity.ARFEE;//
|
|
|
parms[29].Value = infoEntity.APFEE;//
|
|
|
parms[30].Value = infoEntity.CTNALL;//
|
|
|
parms[31].Value = infoEntity.CORPID;//
|
|
|
parms[32].Value = infoEntity.MARKETVALUE;
|
|
|
parms[33].Value = infoEntity.BANKVALUE;
|
|
|
parms[34].Value = infoEntity.ISCHANGE;
|
|
|
parms[35].Value = infoEntity.LINENUM;
|
|
|
|
|
|
//parms[27].Value = infoEntity.CLIENTCODEOLD;// 客户编码
|
|
|
//parms[28].Value = infoEntity.CLIENTNAMEOLD;// 客户名称
|
|
|
//parms[26].Value = infoEntity.ISLOCK;// 是否锁定
|
|
|
//parms[27].Value = infoEntity.LOCKUSER;// 锁定操作人
|
|
|
//parms[28].Value = infoEntity.ISDELETE;// 是否废除
|
|
|
//parms[29].Value = infoEntity.DELETEUSER;// 废除操作人
|
|
|
//parms[30].Value = infoEntity.CREATEUSER;// 创建人
|
|
|
//parms[31].Value = infoEntity.DODATE;// 操作时间
|
|
|
//parms[32].Value = infoEntity.LOCKTIME;// 锁定时间
|
|
|
//parms[33].Value = infoEntity.DELETETIME;// 废除时间
|
|
|
//parms[34].Value = infoEntity.CREATETIME;// 创建时间
|
|
|
//parms[35].Value = infoEntity.MODIFIEDTIME;// 最后一次更新操作时间
|
|
|
|
|
|
//开船日期
|
|
|
string strDODATE = infoEntity.DODATE.ToString().IndexOf("0001")>-1 ? "" : "DODATE='" + infoEntity.DODATE.ToString() + "',";
|
|
|
strSqlUpdateInfo = String.Format(strSqlUpdateInfo, strDODATE);
|
|
|
//
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlUpdateInfo, parms);
|
|
|
if (existVal > 0)
|
|
|
{
|
|
|
iResult = 1;
|
|
|
//
|
|
|
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('更新所有wms_in海运业务预订舱表内容','更新操作','BSNO=" + infoEntity.BSNO + "','')";
|
|
|
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -1;//执行异常
|
|
|
}
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
#region 生成插入语句参数
|
|
|
/// <summary>
|
|
|
/// 生成插入语句参数
|
|
|
/// </summary>
|
|
|
/// <returns>返回SqlParameter数组</returns>
|
|
|
private SqlParameter[] GetInsertParms()
|
|
|
{
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
new SqlParameter("@GID",SqlDbType.VarChar,100),//惟一编号
|
|
|
new SqlParameter("@ASSOCIATEDNO",SqlDbType.VarChar,100),//关联号
|
|
|
new SqlParameter("@BLNO",SqlDbType.VarChar,30),//提单号
|
|
|
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),//合同号
|
|
|
new SqlParameter("@CNTRNO",SqlDbType.VarChar,30),//箱号
|
|
|
new SqlParameter("@SEALNO",SqlDbType.VarChar,12),//封号
|
|
|
new SqlParameter("@BSNO",SqlDbType.VarChar,100),//仓单明细号
|
|
|
new SqlParameter("@CLIENTCODE",SqlDbType.VarChar,20),//客户编码
|
|
|
new SqlParameter("@CLIENTNAME",SqlDbType.VarChar,20),//客户名称
|
|
|
new SqlParameter("@STORAGECODE",SqlDbType.VarChar,50),//仓库编码
|
|
|
new SqlParameter("@STORAGENAME",SqlDbType.VarChar,100),//仓库名称
|
|
|
new SqlParameter("@AREACODE",SqlDbType.VarChar,50),//库位编码
|
|
|
new SqlParameter("@AREANAME",SqlDbType.VarChar,100),//库位名称
|
|
|
new SqlParameter("@GOODSCODE",SqlDbType.VarChar,50),//货物编号
|
|
|
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,100),//货物名称/品名
|
|
|
new SqlParameter("@GOODSTYPE",SqlDbType.VarChar,50),//货物类型
|
|
|
new SqlParameter("@GOODSMODEL",SqlDbType.VarChar,100),//型号
|
|
|
new SqlParameter("@GOODSSTANDARD",SqlDbType.VarChar,100),//规格
|
|
|
new SqlParameter("@GOODSPACK",SqlDbType.Decimal),//件数
|
|
|
new SqlParameter("@CHARGEUNIT",SqlDbType.VarChar,10),//计费单位
|
|
|
//new SqlParameter("@CHARGEPRICE",SqlDbType.Decimal),//计费单价
|
|
|
new SqlParameter("@GOODSRKSL",SqlDbType.Decimal),//入库量
|
|
|
new SqlParameter("@GOODSSTOCK",SqlDbType.Decimal) ,//库存量
|
|
|
new SqlParameter("@ISLOCK",SqlDbType.Bit),//是否锁定
|
|
|
new SqlParameter("@LOCKUSER",SqlDbType.VarChar,36),//锁定操作人
|
|
|
new SqlParameter("@ISDELETE",SqlDbType.Bit),//是否废除
|
|
|
new SqlParameter("@DELETEUSER",SqlDbType.VarChar,36),//废除操作人
|
|
|
new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人
|
|
|
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//最后一次更新操作人
|
|
|
new SqlParameter("@REMARK",SqlDbType.VarChar,1024),//备注
|
|
|
new SqlParameter("@FREESTORAGEPERIOD",SqlDbType.Int),//
|
|
|
new SqlParameter("@GOODSPACKSTOCK",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@GOODSKGS",SqlDbType.Decimal),//重量
|
|
|
new SqlParameter("@CLIENTCODEOLD",SqlDbType.VarChar,20),//原客户编码
|
|
|
new SqlParameter("@CLIENTNAMEOLD",SqlDbType.VarChar,20),//原客户名称
|
|
|
new SqlParameter("@KINDPKGS",SqlDbType.VarChar,20),//
|
|
|
new SqlParameter("@ARFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@APFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@CTNALL",SqlDbType.VarChar,10),
|
|
|
new SqlParameter("@GOODSTHICKNESS", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSWIDTH", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSLENGTH", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSSLICE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSGRADE", SqlDbType.VarChar,50) ,
|
|
|
new SqlParameter("@STACKLOCATION", SqlDbType.VarChar,50) ,
|
|
|
new SqlParameter("@GOODSPACKACTUAL", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSRKSLACTUAL", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@ISCHANGE",SqlDbType.Bit) ,
|
|
|
new SqlParameter("@CORPID", SqlDbType.VarChar,36) ,
|
|
|
new SqlParameter("@MARKETVALUE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@BANKVALUE", SqlDbType.Decimal,9),
|
|
|
new SqlParameter("@LINENUM", SqlDbType.Int)
|
|
|
|
|
|
//new SqlParameter("@DODATE",SqlDbType.Datetime),//操作时间
|
|
|
//new SqlParameter("@LOCKTIME",SqlDbType.Datetime),//锁定时间
|
|
|
//new SqlParameter("@DELETETIME",SqlDbType.Datetime),//废除时间
|
|
|
//new SqlParameter("@CREATETIME",SqlDbType.Datetime),//创建时间
|
|
|
//new SqlParameter("@MODIFIEDTIME",SqlDbType.Datetime),//最后一次更新操作时间
|
|
|
};
|
|
|
return parms;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 生成更新语句参数
|
|
|
/// <summary>
|
|
|
/// 生成更新语句参数
|
|
|
/// </summary>
|
|
|
/// <returns>返回SqlParameter数组</returns>
|
|
|
private SqlParameter[] GetUpdateParms()
|
|
|
{
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
new SqlParameter("@GID",SqlDbType.VarChar,100),//惟一编号
|
|
|
new SqlParameter("@ASSOCIATEDNO",SqlDbType.VarChar,100),//关联号
|
|
|
new SqlParameter("@BLNO",SqlDbType.VarChar,30),//提单号
|
|
|
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),//合同号
|
|
|
new SqlParameter("@CNTRNO",SqlDbType.VarChar,30),//箱号
|
|
|
new SqlParameter("@SEALNO",SqlDbType.VarChar,12),//封号
|
|
|
new SqlParameter("@BSNO",SqlDbType.VarChar,100),//仓单明细号
|
|
|
new SqlParameter("@CLIENTCODE",SqlDbType.VarChar,20),//客户编码
|
|
|
new SqlParameter("@CLIENTNAME",SqlDbType.VarChar,20),//客户名称
|
|
|
new SqlParameter("@STORAGECODE",SqlDbType.VarChar,50),//仓库编码
|
|
|
new SqlParameter("@STORAGENAME",SqlDbType.VarChar,100),//仓库名称
|
|
|
new SqlParameter("@AREACODE",SqlDbType.VarChar,50),//库位编码
|
|
|
new SqlParameter("@AREANAME",SqlDbType.VarChar,100),//库位名称
|
|
|
new SqlParameter("@GOODSCODE",SqlDbType.VarChar,50),//货物编号
|
|
|
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,100),//货物名称/品名
|
|
|
new SqlParameter("@GOODSTYPE",SqlDbType.VarChar,50),//货物类型
|
|
|
new SqlParameter("@GOODSMODEL",SqlDbType.VarChar,100),//型号
|
|
|
new SqlParameter("@GOODSSTANDARD",SqlDbType.VarChar,100),//规格
|
|
|
new SqlParameter("@GOODSPACK",SqlDbType.Decimal),//件数
|
|
|
new SqlParameter("@CHARGEUNIT",SqlDbType.VarChar,10),//计费单位
|
|
|
//new SqlParameter("@CHARGEPRICE",SqlDbType.Decimal),//计费单价
|
|
|
new SqlParameter("@GOODSRKSL",SqlDbType.Decimal),//入库量
|
|
|
new SqlParameter("@GOODSSTOCK",SqlDbType.Decimal) ,//库存量
|
|
|
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//最后一次更新操作人
|
|
|
new SqlParameter("@REMARK",SqlDbType.VarChar,1024),//备注
|
|
|
new SqlParameter("@FREESTORAGEPERIOD",SqlDbType.Int),//
|
|
|
new SqlParameter("@GOODSPACKSTOCK",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@GOODSKGS",SqlDbType.Decimal),//重量
|
|
|
new SqlParameter("@KINDPKGS",SqlDbType.VarChar,20),//
|
|
|
new SqlParameter("@ARFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@APFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@CTNALL",SqlDbType.VarChar,10),//
|
|
|
new SqlParameter("@CORPID",SqlDbType.VarChar,36) ,
|
|
|
new SqlParameter("@MARKETVALUE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@BANKVALUE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@ISCHANGE",SqlDbType.Bit),
|
|
|
new SqlParameter("@LINENUM", SqlDbType.Int)
|
|
|
|
|
|
//new SqlParameter("@CLIENTCODEOLD",SqlDbType.VarChar,20),//客户编码
|
|
|
//new SqlParameter("@CLIENTNAMEOLD",SqlDbType.VarChar,20)//客户名称
|
|
|
//new SqlParameter("@ISLOCK",SqlDbType.Bit),//是否锁定
|
|
|
//new SqlParameter("@LOCKUSER",SqlDbType.VarChar,36),//锁定操作人
|
|
|
//new SqlParameter("@ISDELETE",SqlDbType.Bit),//是否废除
|
|
|
//new SqlParameter("@DELETEUSER",SqlDbType.VarChar,36),//废除操作人
|
|
|
//new SqlParameter("@CREATEUSER",SqlDbType.VarChar,36),//创建人
|
|
|
//new SqlParameter("@DODATE",SqlDbType.Datetime),//操作时间
|
|
|
//new SqlParameter("@LOCKTIME",SqlDbType.Datetime),//锁定时间
|
|
|
//new SqlParameter("@DELETETIME",SqlDbType.Datetime),//废除时间
|
|
|
//new SqlParameter("@CREATETIME",SqlDbType.Datetime),//创建时间
|
|
|
//new SqlParameter("@MODIFIEDTIME",SqlDbType.Datetime),//最后一次更新操作时间
|
|
|
};
|
|
|
return parms;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 更新账户列表信息
|
|
|
/// <summary>
|
|
|
/// 更新账户列表信息
|
|
|
/// </summary>
|
|
|
/// <param name="sqlList">更新SQL语句组,将所有要执行的更新语句写入ArrayList,每个索引对应一条SQL语句,执行时需要遍历操作</param>
|
|
|
/// <returns>返回状态值 为1表示更新完成;为-1更新出现异常但未正确回滚事务;为-2更新异常,事务已经成功回滚;默认状态为0</returns>
|
|
|
public int UpdateFromGrid(List<WmsInEntity> WmsInEntities)
|
|
|
{
|
|
|
int result = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
foreach (WmsInEntity model in WmsInEntities)
|
|
|
{
|
|
|
string strSql = "update wms_in set BLNO=@BLNO,CONTRACTNO=@CONTRACTNO,CNTRNO=@CNTRNO,SEALNO=@SEALNO,BSNO=@BSNO,CLIENTCODE=@CLIENTCODE,CLIENTNAME=@CLIENTNAME,{0}STORAGECODE=@STORAGECODE,STORAGENAME=@STORAGENAME,AREACODE=@AREACODE,AREANAME=@AREANAME,GOODSCODE=@GOODSCODE,GOODSNAME=@GOODSNAME,GOODSTYPE=@GOODSTYPE,GOODSMODEL=@GOODSMODEL,GOODSSTANDARD=@GOODSSTANDARD,GOODSPACK=@GOODSPACK,CHARGEUNIT=@CHARGEUNIT,GOODSRKSL=@GOODSRKSL,GOODSSTOCK=@GOODSSTOCK,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=getdate(),REMARK=@REMARK,FREESTORAGEPERIOD=@FREESTORAGEPERIOD,GOODSPACKSTOCK=@GOODSPACKSTOCK,GOODSKGS=@GOODSKGS,KINDPKGS=@KINDPKGS,ARFEE=@ARFEE,APFEE=@APFEE,CTNALL=@CTNALL,GOODSTHICKNESS = @GOODSTHICKNESS,GOODSWIDTH = @GOODSWIDTH,GOODSLENGTH = @GOODSLENGTH,GOODSSLICE = @GOODSSLICE,GOODSGRADE = @GOODSGRADE,STACKLOCATION = @STACKLOCATION,GOODSPACKACTUAL = @GOODSPACKACTUAL,GOODSRKSLACTUAL = @GOODSRKSLACTUAL,MARKETVALUE = @MARKETVALUE,BANKVALUE = @BANKVALUE,LINENUM = @LINENUM where GID=@GID";//,CORPID = @CORPID
|
|
|
|
|
|
SqlParameter[] parms = {
|
|
|
new SqlParameter("@GID",SqlDbType.VarChar,100),//惟一编号
|
|
|
new SqlParameter("@ASSOCIATEDNO",SqlDbType.VarChar,100),//关联号
|
|
|
new SqlParameter("@BLNO",SqlDbType.VarChar,30),//提单号
|
|
|
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),//合同号
|
|
|
new SqlParameter("@CNTRNO",SqlDbType.VarChar,30),//箱号
|
|
|
new SqlParameter("@SEALNO",SqlDbType.VarChar,12),//封号
|
|
|
new SqlParameter("@BSNO",SqlDbType.VarChar,100),//仓单明细号
|
|
|
new SqlParameter("@CLIENTCODE",SqlDbType.VarChar,20),//客户编码
|
|
|
new SqlParameter("@CLIENTNAME",SqlDbType.VarChar,20),//客户名称
|
|
|
new SqlParameter("@STORAGECODE",SqlDbType.VarChar,50),//仓库编码
|
|
|
new SqlParameter("@STORAGENAME",SqlDbType.VarChar,100),//仓库名称
|
|
|
new SqlParameter("@AREACODE",SqlDbType.VarChar,50),//库位编码
|
|
|
new SqlParameter("@AREANAME",SqlDbType.VarChar,100),//库位名称
|
|
|
new SqlParameter("@GOODSCODE",SqlDbType.VarChar,50),//货物编号
|
|
|
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,100),//货物名称/品名
|
|
|
new SqlParameter("@GOODSTYPE",SqlDbType.VarChar,50),//货物类型
|
|
|
new SqlParameter("@GOODSMODEL",SqlDbType.VarChar,100),//型号
|
|
|
new SqlParameter("@GOODSSTANDARD",SqlDbType.VarChar,100),//规格
|
|
|
new SqlParameter("@GOODSPACK",SqlDbType.Decimal),//件数
|
|
|
new SqlParameter("@CHARGEUNIT",SqlDbType.VarChar,10),//计费单位
|
|
|
new SqlParameter("@GOODSRKSL",SqlDbType.Decimal),//入库量
|
|
|
new SqlParameter("@GOODSSTOCK",SqlDbType.Decimal) ,//库存量
|
|
|
new SqlParameter("@MODIFIEDUSER",SqlDbType.VarChar,36),//最后一次更新操作人
|
|
|
new SqlParameter("@REMARK",SqlDbType.VarChar,1024),//备注
|
|
|
new SqlParameter("@FREESTORAGEPERIOD",SqlDbType.Int),//
|
|
|
new SqlParameter("@GOODSPACKSTOCK",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@GOODSKGS",SqlDbType.Decimal),//重量
|
|
|
new SqlParameter("@KINDPKGS",SqlDbType.VarChar,20),//
|
|
|
new SqlParameter("@ARFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@APFEE",SqlDbType.Decimal),//
|
|
|
new SqlParameter("@CTNALL",SqlDbType.VarChar,30),
|
|
|
new SqlParameter("@GOODSTHICKNESS", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSWIDTH", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSLENGTH", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSSLICE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSGRADE", SqlDbType.VarChar,50) ,
|
|
|
new SqlParameter("@STACKLOCATION", SqlDbType.VarChar,50) ,
|
|
|
new SqlParameter("@GOODSPACKACTUAL", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@GOODSRKSLACTUAL", SqlDbType.Decimal,9) ,
|
|
|
//new SqlParameter("@CORPID", SqlDbType.VarChar,36) ,
|
|
|
new SqlParameter("@MARKETVALUE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@BANKVALUE", SqlDbType.Decimal,9) ,
|
|
|
new SqlParameter("@LINENUM", SqlDbType.Int)
|
|
|
};
|
|
|
|
|
|
parms[0].Value = model.GID;// 惟一编号
|
|
|
parms[1].Value = model.ASSOCIATEDNO;// 关联号
|
|
|
parms[2].Value = model.BLNO;// 提单号
|
|
|
parms[3].Value = model.CONTRACTNO;// 合同号
|
|
|
parms[4].Value = model.CNTRNO;// 箱号
|
|
|
parms[5].Value = model.SEALNO;// 封号
|
|
|
parms[6].Value = model.BSNO;// 仓单明细号
|
|
|
parms[7].Value = model.CLIENTCODE;// 客户编码
|
|
|
parms[8].Value = model.CLIENTNAME;// 客户名称
|
|
|
parms[9].Value = model.STORAGECODE;// 仓库编码
|
|
|
parms[10].Value = model.STORAGENAME;// 仓库名称
|
|
|
parms[11].Value = model.AREACODE;// 库位编码
|
|
|
parms[12].Value = model.AREANAME;// 库位名称
|
|
|
parms[13].Value = model.GOODSCODE;// 货物编号
|
|
|
parms[14].Value = model.GOODSNAME;// 货物名称
|
|
|
parms[15].Value = model.GOODSTYPE;// 货物类型
|
|
|
parms[16].Value = model.GOODSMODEL;// 型号
|
|
|
parms[17].Value = model.GOODSSTANDARD;// 规格
|
|
|
parms[18].Value = model.GOODSPACK;// 件数
|
|
|
parms[19].Value = model.CHARGEUNIT;// 计费单位
|
|
|
parms[20].Value = model.GOODSRKSL;// 入库量
|
|
|
parms[21].Value = model.GOODSSTOCK;// 库存量
|
|
|
parms[22].Value = model.MODIFIEDUSER;// 最后一次更新操作人
|
|
|
parms[23].Value = model.REMARK;// 备注
|
|
|
parms[24].Value = model.FREESTORAGEPERIOD;//
|
|
|
parms[25].Value = model.GOODSPACKSTOCK;//
|
|
|
parms[26].Value = model.GOODSKGS;// 重量
|
|
|
parms[27].Value = model.KINDPKGS;//
|
|
|
parms[28].Value = model.ARFEE;//
|
|
|
parms[29].Value = model.APFEE;//
|
|
|
parms[30].Value = model.CTNALL;//
|
|
|
parms[31].Value = model.GOODSTHICKNESS;
|
|
|
parms[32].Value = model.GOODSWIDTH;
|
|
|
parms[33].Value = model.GOODSLENGTH;
|
|
|
parms[34].Value = model.GOODSSLICE;
|
|
|
parms[35].Value = model.GOODSGRADE;
|
|
|
parms[36].Value = model.STACKLOCATION;
|
|
|
parms[37].Value = model.GOODSPACKACTUAL;
|
|
|
parms[38].Value = model.GOODSRKSLACTUAL;
|
|
|
//parms[39].Value = model.CORPID;
|
|
|
parms[39].Value = model.MARKETVALUE;
|
|
|
parms[40].Value = model.BANKVALUE;
|
|
|
parms[41].Value = model.LINENUM;
|
|
|
|
|
|
//操作时间
|
|
|
string strDODATE = model.DODATE.ToString().IndexOf("0001")>-1 ? "" : "DODATE='" + model.DODATE.ToString() + "',";
|
|
|
strSql = String.Format(strSql, strDODATE);
|
|
|
//
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql.ToString(), parms);
|
|
|
}
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
result = 1;//状态为1表示更新成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
result = -1;//有异常,更新失败
|
|
|
sqlTran.Rollback();
|
|
|
result = -2;//更新异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 入库明细更新与wms相关的信息
|
|
|
/// <summary>
|
|
|
/// 入库明细更新与wms相关的信息
|
|
|
/// </summary>
|
|
|
/// <param name="sqlList">更新SQL语句组,将所有要执行的更新语句写入ArrayList,每个索引对应一条SQL语句,执行时需要遍历操作</param>
|
|
|
/// <returns>返回状态值 为1表示更新完成;为-1更新出现异常但未正确回滚事务;为-2更新异常,事务已经成功回滚;默认状态为0</returns>
|
|
|
public int UpdateWmsInInfo(WmsInEntity model)
|
|
|
{
|
|
|
int result = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
string strSql = "update wms_in set BLNO=@BLNO,CONTRACTNO=@CONTRACTNO,CLIENTCODE=@CLIENTCODE,CLIENTNAME=@CLIENTNAME,AREANAME=@AREANAME,GOODSNAME=@GOODSNAME,GOODSMODEL=@GOODSMODEL,CHARGEUNIT=@CHARGEUNIT,STORAGENAME=@STORAGENAME,FREESTORAGEPERIOD=@FREESTORAGEPERIOD where ASSOCIATEDNO=@ASSOCIATEDNO";
|
|
|
SqlParameter[] parms = {
|
|
|
new SqlParameter("@ASSOCIATEDNO",SqlDbType.VarChar,100),//关联号
|
|
|
new SqlParameter("@BLNO",SqlDbType.VarChar,30),//提单号
|
|
|
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),//合同号
|
|
|
new SqlParameter("@CLIENTCODE",SqlDbType.VarChar,20),//客户编码
|
|
|
new SqlParameter("@CLIENTNAME",SqlDbType.VarChar,20),//客户名称
|
|
|
new SqlParameter("@AREANAME",SqlDbType.VarChar,100),//库位名称
|
|
|
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,100),//货物名称/品名
|
|
|
new SqlParameter("@GOODSMODEL",SqlDbType.VarChar,100),//型号
|
|
|
new SqlParameter("@CHARGEUNIT",SqlDbType.VarChar,10),//计费单位
|
|
|
new SqlParameter("@STORAGENAME",SqlDbType.VarChar,100),//仓库名称
|
|
|
new SqlParameter("@FREESTORAGEPERIOD",SqlDbType.Int)
|
|
|
};
|
|
|
parms[0].Value = model.ASSOCIATEDNO;// 关联号
|
|
|
parms[1].Value = model.BLNO;// 提单号
|
|
|
parms[2].Value = model.CONTRACTNO;// 合同号
|
|
|
parms[3].Value = model.CLIENTCODE;// 客户编码
|
|
|
parms[4].Value = model.CLIENTNAME;// 客户名称
|
|
|
parms[5].Value = model.AREANAME;// 库位名称
|
|
|
parms[6].Value = model.GOODSNAME;// 货物名称
|
|
|
parms[7].Value = model.GOODSMODEL;// 型号
|
|
|
parms[8].Value = model.CHARGEUNIT;// 计费单位
|
|
|
parms[9].Value = model.STORAGENAME;// 仓库名称
|
|
|
parms[10].Value = model.FREESTORAGEPERIOD;
|
|
|
//
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parms);
|
|
|
sqlTran.Commit();
|
|
|
result = 1;//状态为1表示更新成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
result = -1;//有异常,更新失败
|
|
|
sqlTran.Rollback();
|
|
|
result = -2;//更新异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 入库明细CBM更新与wms相关的信息
|
|
|
/// <summary>
|
|
|
/// 入库明细CBM更新与wms相关的信息
|
|
|
/// </summary>
|
|
|
/// <param name="sqlList">更新SQL语句组,将所有要执行的更新语句写入ArrayList,每个索引对应一条SQL语句,执行时需要遍历操作</param>
|
|
|
/// <returns>返回状态值 为1表示更新完成;为-1更新出现异常但未正确回滚事务;为-2更新异常,事务已经成功回滚;默认状态为0</returns>
|
|
|
public int UpdateWmsInCBMInfo(WmsInEntity model)
|
|
|
{
|
|
|
int result = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
string strSql = "update wms_in set BLNO=@BLNO,CONTRACTNO=@CONTRACTNO,CLIENTCODE=@CLIENTCODE,CLIENTNAME=@CLIENTNAME,AREANAME=@AREANAME,GOODSNAME=@GOODSNAME,CHARGEUNIT=@CHARGEUNIT,STORAGENAME=@STORAGENAME,FREESTORAGEPERIOD=@FREESTORAGEPERIOD where ASSOCIATEDNO=@ASSOCIATEDNO";
|
|
|
SqlParameter[] parms = {
|
|
|
new SqlParameter("@ASSOCIATEDNO",SqlDbType.VarChar,100),//关联号
|
|
|
new SqlParameter("@BLNO",SqlDbType.VarChar,30),//提单号
|
|
|
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),//合同号
|
|
|
new SqlParameter("@CLIENTCODE",SqlDbType.VarChar,20),//客户编码
|
|
|
new SqlParameter("@CLIENTNAME",SqlDbType.VarChar,20),//客户名称
|
|
|
new SqlParameter("@AREANAME",SqlDbType.VarChar,100),//库位名称
|
|
|
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,100),//货物名称/品名
|
|
|
new SqlParameter("@CHARGEUNIT",SqlDbType.VarChar,10),//计费单位
|
|
|
new SqlParameter("@STORAGENAME",SqlDbType.VarChar,100),//仓库名称
|
|
|
new SqlParameter("@FREESTORAGEPERIOD",SqlDbType.Int)
|
|
|
};
|
|
|
parms[0].Value = model.ASSOCIATEDNO;// 关联号
|
|
|
parms[1].Value = model.BLNO;// 提单号
|
|
|
parms[2].Value = model.CONTRACTNO;// 合同号
|
|
|
parms[3].Value = model.CLIENTCODE;// 客户编码
|
|
|
parms[4].Value = model.CLIENTNAME;// 客户名称
|
|
|
parms[5].Value = model.AREANAME;// 库位名称
|
|
|
parms[6].Value = model.GOODSNAME;// 货物名称
|
|
|
parms[7].Value = model.CHARGEUNIT;// 计费单位
|
|
|
parms[8].Value = model.STORAGENAME;// 仓库名称
|
|
|
parms[9].Value = model.FREESTORAGEPERIOD;
|
|
|
//
|
|
|
int existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, parms);
|
|
|
sqlTran.Commit();
|
|
|
result = 1;//状态为1表示更新成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
result = -1;//有异常,更新失败
|
|
|
sqlTran.Rollback();
|
|
|
result = -2;//更新异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 删除入库信息
|
|
|
/// <summary>
|
|
|
/// 删除入库信息
|
|
|
/// </summary>
|
|
|
/// <param name="strSel">入库信息GID</param>
|
|
|
/// <param name="strUserID">删除人ID</param>
|
|
|
/// <returns>值1表示删除成功 值-1表示有异常,删除失败 值-2表示插入异常,事务已回滚成功</returns>
|
|
|
public String GetWmsInDel(string strSel, string strUserID)
|
|
|
{
|
|
|
string alt = "";
|
|
|
//string str = "update wms_in set ISDELETE=1,DELETETIME=getdate(),DELETEUSER='" + strUserID + "' where GID in('" + strSel + "') and ISDELETE=0";
|
|
|
string str = "delete from wms_in where GID in('" + strSel + "')";
|
|
|
bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str);
|
|
|
if (bl == false)
|
|
|
{
|
|
|
alt = "入库信息表wms_in删除操作出错!";
|
|
|
return alt;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//str = str.Trim().Replace("'", "''");
|
|
|
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('删除销售订舱信息表wms_in','删除操作','" + str + "','" + strUserID + "')";
|
|
|
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
|
|
|
}
|
|
|
return alt;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取当前货主的此类货物的免仓储期
|
|
|
/// <summary>
|
|
|
/// 获取当前货主的此类货物的免仓储期
|
|
|
/// </summary>
|
|
|
/// <param name="strCLIENTNAME">货主名称</param>
|
|
|
/// <param name="strGOODSNAME">货物名称</param>
|
|
|
/// <param name="strDODATE">入库单号</param>
|
|
|
/// <param name="strUserID">操作人gid</param>
|
|
|
/// <returns></returns>
|
|
|
public string GetStrSQL(string strCLIENTNAME, string strGOODSNAME, string strDODATE, string strUserID)
|
|
|
{
|
|
|
string alt = "0";
|
|
|
string strSQL = "select FEESCALE from wms_rate where CUSTOMERNAME='" + strCLIENTNAME + "' and GOODSNAME='" + strGOODSNAME + "' and convert(char(10),STARTTIME,20)<=convert(char(10),'" + strDODATE + "',20) and convert(char(10),'" + strDODATE + "',20)<=convert(char(10),ENDTIME,20)";
|
|
|
DataSet DS = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, strSQL);
|
|
|
if (DS != null)
|
|
|
{
|
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
alt = DS.Tables[0].Rows[0]["FEESCALE"].ToString();
|
|
|
}
|
|
|
}
|
|
|
return alt;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取重量是否大于剩余重量(毛重-入库重量)
|
|
|
/// <summary>
|
|
|
/// 获取重量是否大于剩余重量(毛重-入库重量)
|
|
|
/// </summary>
|
|
|
/// <param name="strAssociatedno">业务关联编号</param>
|
|
|
/// <param name="strBlno">业务提单号</param>
|
|
|
/// <param name="strGid">当前入库单号</param>
|
|
|
/// <param name="strGOODSRKSL">入库重量</param>
|
|
|
/// <returns></returns>
|
|
|
public string GetGOODSRKSL(string strAssociatedno, string strBlno, string strGid, string strGOODSRKSL, string hd_comboCLIENTNAME)
|
|
|
{
|
|
|
string alt = "";
|
|
|
//获取参数
|
|
|
SqlParameter[] parms = new SqlParameter[]
|
|
|
{
|
|
|
new SqlParameter("@strAssociatedno",SqlDbType.VarChar,100),
|
|
|
new SqlParameter("@strBlno",SqlDbType.VarChar,30),
|
|
|
new SqlParameter("@strGid",SqlDbType.VarChar,100),
|
|
|
new SqlParameter("@clientname",SqlDbType.VarChar,20),
|
|
|
new SqlParameter("@strGOODSRKSL",SqlDbType.Decimal)
|
|
|
};
|
|
|
parms[0].Value = strAssociatedno;// 惟一值
|
|
|
parms[1].Value = strBlno;//
|
|
|
parms[2].Value = strGid;//
|
|
|
parms[3].Value = hd_comboCLIENTNAME;//
|
|
|
parms[4].Value = strGOODSRKSL;//
|
|
|
//
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
string sResult = SqlHelper.ExecuteSqlStoredProcedureReturnString(conn, "proc_getgoodsrksl", parms);
|
|
|
if (sResult == "error")
|
|
|
{
|
|
|
alt = "";
|
|
|
}
|
|
|
else if (sResult == "0")
|
|
|
{
|
|
|
alt = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
alt = "";
|
|
|
if (sResult.Trim() != "")
|
|
|
{
|
|
|
alt = "重量超出此票货物总重:"+sResult.Substring(1)+",请重新录入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return alt.Trim();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取件数是否大于剩余件数(总件数-入库件数)
|
|
|
/// <summary>
|
|
|
/// 获取件数是否大于剩余件数(总件数-入库件数)
|
|
|
/// </summary>
|
|
|
/// <param name="strAssociatedno">业务关联编号</param>
|
|
|
/// <param name="strBlno">业务提单号</param>
|
|
|
/// <param name="strGid">当前入库单号</param>
|
|
|
/// <param name="strGOODSRKSL">入库件数</param>
|
|
|
/// <returns></returns>
|
|
|
public string GetGOODSPACK(string strAssociatedno, string strBlno, string strGid, string strGOODSPACK, string hd_comboCLIENTNAME)
|
|
|
{
|
|
|
string alt = "";
|
|
|
//获取参数
|
|
|
SqlParameter[] parms = new SqlParameter[]
|
|
|
{
|
|
|
new SqlParameter("@strAssociatedno",SqlDbType.VarChar,100),
|
|
|
new SqlParameter("@strBlno",SqlDbType.VarChar,30),
|
|
|
new SqlParameter("@strGid",SqlDbType.VarChar,100),
|
|
|
new SqlParameter("@clientname",SqlDbType.VarChar,20),
|
|
|
new SqlParameter("@strGOODSPACK",SqlDbType.Decimal)
|
|
|
};
|
|
|
parms[0].Value = strAssociatedno;// 惟一值
|
|
|
parms[1].Value = strBlno;//
|
|
|
parms[2].Value = strGid;//
|
|
|
parms[3].Value = hd_comboCLIENTNAME;//
|
|
|
parms[4].Value = strGOODSPACK;//
|
|
|
//
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
string sResult = SqlHelper.ExecuteSqlStoredProcedureReturnString(conn, "proc_getgoodspack", parms);
|
|
|
if (sResult == "error")
|
|
|
{
|
|
|
alt = "";
|
|
|
}
|
|
|
else if (sResult == "0")
|
|
|
{
|
|
|
alt = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
alt = "";
|
|
|
if (sResult.Trim() != "")
|
|
|
{
|
|
|
alt = "件数超出此票货物总件数:"+sResult.Substring(1)+",请重新录入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return alt.Trim();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 根据SQL语句查询入库数据集
|
|
|
/// <summary>
|
|
|
/// 根据SQL语句查询数据集
|
|
|
/// </summary>
|
|
|
/// <param name="strSql"></param>
|
|
|
/// <returns></returns>
|
|
|
public DataSet GetExcuteSql(string strSql)
|
|
|
{
|
|
|
DataSet userSet = new DataSet();
|
|
|
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
|
|
|
return userSet;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新一条数据
|
|
|
/// </summary>
|
|
|
public bool Update(decimal outnum, Decimal outpacknum, string inbsno)
|
|
|
{
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("update wms_in set ");
|
|
|
strSql.Append(" GOODSSTOCK=GOODSSTOCK-@GOODSSTOCK, ");
|
|
|
strSql.Append(" GOODSPACKSTOCK=GOODSPACKSTOCK-@GOODSPACKPFSL ");
|
|
|
strSql.Append(" where BSNO=@BSNO ");
|
|
|
SqlParameter[] parameters = {
|
|
|
new SqlParameter("@GOODSSTOCK", SqlDbType.Decimal),
|
|
|
new SqlParameter("@GOODSPACKPFSL", SqlDbType.Decimal),
|
|
|
new SqlParameter("@BSNO", SqlDbType.VarChar,100)};
|
|
|
parameters[0].Value = outnum;
|
|
|
parameters[1].Value = outpacknum;
|
|
|
parameters[2].Value = inbsno;
|
|
|
|
|
|
//int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
|
|
|
int rows = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters);
|
|
|
if (rows > 0)
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 删除入库信息
|
|
|
/// <summary>
|
|
|
/// 删除入库信息
|
|
|
/// </summary>
|
|
|
/// <param name="strSel">入库信息GID</param>
|
|
|
/// <param name="strUserID">删除人ID</param>
|
|
|
/// <returns>值1表示删除成功 值-1表示有异常,删除失败 值-2表示插入异常,事务已回滚成功</returns>
|
|
|
public String GetWmsDel(string strSel, string strUserID)
|
|
|
{
|
|
|
string alt = "";
|
|
|
//string str = "update wms set ISDELETE=1,DELETETIME=getdate(),DELETEUSER='" + strUserID + "' where GID in('" + strSel + "') and ISDELETE=0";
|
|
|
//str = "delete from ch_fee where BSNO in('" + strSel + "')";
|
|
|
//bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str);
|
|
|
string str = "delete from wms_in where gid in('" + strSel + "')";
|
|
|
bool bl = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str);
|
|
|
if (bl == false)
|
|
|
{
|
|
|
alt = "入库信息表wms删除操作出错!";
|
|
|
return alt;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//str = str.Trim().Replace("'", "''");
|
|
|
//string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('删除销售订舱信息表wms','删除操作','" + str + "','" + strUserID + "')";
|
|
|
//bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
|
|
|
}
|
|
|
return alt;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 装卸费入账,并锁定入库信息
|
|
|
/// </summary>
|
|
|
public int setislock(string sGids, string strUserID)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
string strgids = "'" + sGids.Replace(",", "','") + "'";
|
|
|
string strSql = "update wms_in set ISLOCK=1,LOCKUSER='" + strUserID + "',LOCKTIME=getdate() where gid in (" + strgids + ")";
|
|
|
iResult = -4;//
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, null);
|
|
|
|
|
|
//
|
|
|
string[] items = sGids.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
for (int i = 0; i < items.Length; i++)
|
|
|
{
|
|
|
#region 费用参数
|
|
|
string PARM_FEE_GID = "@gid";
|
|
|
string PARM_FEE_BSNO = "@bsno";
|
|
|
string PARM_FEE_TYPE = "@fee_type";
|
|
|
string PARM_FEE_NAME = "@fee_name";
|
|
|
string PARM_FEE_REMARK = "@remark";
|
|
|
string PARM_FEE_FRT = "@fee_frt";
|
|
|
string PARM_FEE_AMOUNT = "@amount";
|
|
|
string PARM_FEE_CURRENCY = "@currency";
|
|
|
string PARM_FEE_QUANTITY = "@quantity";
|
|
|
string PARM_FEE_STATUS = "@fee_status";
|
|
|
string PARM_FEE_UNIT = "@unit";
|
|
|
string PARM_FEE_UNIT_PRICE = "@unit_price";
|
|
|
string PARM_FEE_COMMISSION_RATE = "@comm_rate";
|
|
|
string PARM_FEE_CUSTOMER_NAME = "@customer_name";
|
|
|
string PARM_FEE_EXCHANGE_RATE = "@exchange_rate";
|
|
|
string PARM_FEE_ISADVANCEPAY = "@is_advance_pay";
|
|
|
string PARM_FEE_ENTER_OPERATOR = "@enter_operator";
|
|
|
string PARM_FEE_AUDIT_WMSOUTBSNO = "@WMSOUTBSNO";
|
|
|
//
|
|
|
string strCUSTOMERNAME = "SELECT CLIENTNAME FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
object statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, strCUSTOMERNAME, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
strCUSTOMERNAME = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCUSTOMERNAME = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
string strTRUCKNAME = "SELECT TRUCKNAME FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, strTRUCKNAME, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
strTRUCKNAME = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTRUCKNAME = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
string strASSOCIATEDNO = "SELECT ASSOCIATEDNO FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, strASSOCIATEDNO, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
strASSOCIATEDNO = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strASSOCIATEDNO = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
int isFeeGain = 0;
|
|
|
#endregion
|
|
|
//
|
|
|
#region 应收费用合计入ch_fee表
|
|
|
//应收
|
|
|
string feehj = "SELECT isnull(ARFEE,0) as hj FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, feehj, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
feehj = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
feehj = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
if (decimal.Parse(feehj) != 0)
|
|
|
{
|
|
|
isFeeGain = 1;
|
|
|
string SQL_INSERT_CH_FEE = " INSERT INTO ch_fee (GID,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,COMMISSIONRATE,AMOUNT,CURRENCY,EXCHANGERATE,FEEFRT,REMARK,ISADVANCEDPAY,FEETYPE,BSNO,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO) VALUES(@gid,@fee_name,@customer_name,@unit,@unit_price,@quantity,@comm_rate,@amount,@currency,@exchange_rate,@fee_frt,@remark,@is_advance_pay,@fee_type,@bsno,@enter_operator,GETDATE(),@fee_status,@WMSOUTBSNO) ";
|
|
|
SqlParameter[] insertParms = new SqlParameter[] {
|
|
|
new SqlParameter(PARM_FEE_GID,SqlDbType.VarChar,36),
|
|
|
new SqlParameter(PARM_FEE_NAME,SqlDbType.VarChar,100),
|
|
|
new SqlParameter(PARM_FEE_CUSTOMER_NAME,SqlDbType.VarChar,50),
|
|
|
new SqlParameter(PARM_FEE_UNIT,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_UNIT_PRICE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_QUANTITY,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_COMMISSION_RATE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_AMOUNT,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_CURRENCY,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_EXCHANGE_RATE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_FRT,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_REMARK,SqlDbType.VarChar),
|
|
|
new SqlParameter(PARM_FEE_ISADVANCEPAY,SqlDbType.Bit),
|
|
|
new SqlParameter(PARM_FEE_TYPE,SqlDbType.Int),
|
|
|
new SqlParameter(PARM_FEE_BSNO,SqlDbType.VarChar,100),
|
|
|
new SqlParameter(PARM_FEE_ENTER_OPERATOR,SqlDbType.VarChar,50),
|
|
|
new SqlParameter(PARM_FEE_STATUS,SqlDbType.Int),
|
|
|
new SqlParameter(PARM_FEE_AUDIT_WMSOUTBSNO,SqlDbType.VarChar,100)
|
|
|
};
|
|
|
|
|
|
insertParms[0].Value = Guid.NewGuid().ToString();
|
|
|
insertParms[1].Value = "入库费";
|
|
|
insertParms[2].Value = strCUSTOMERNAME.Trim();
|
|
|
insertParms[3].Value = "重量";
|
|
|
insertParms[4].Value = decimal.Parse(feehj);
|
|
|
insertParms[5].Value = 1;
|
|
|
insertParms[6].Value = 1;
|
|
|
insertParms[7].Value = decimal.Parse(feehj);
|
|
|
insertParms[8].Value = "RMB";
|
|
|
insertParms[9].Value = 1;
|
|
|
insertParms[10].Value = "";
|
|
|
insertParms[11].Value = "";
|
|
|
insertParms[12].Value = false;
|
|
|
insertParms[13].Value = 1;
|
|
|
insertParms[14].Value = items[i].ToString().Trim();
|
|
|
insertParms[15].Value = strUserID;
|
|
|
insertParms[16].Value = 0;
|
|
|
insertParms[17].Value = items[i].ToString().Trim();
|
|
|
iResult = -5;//
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT_CH_FEE, insertParms);
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
#region 应付费用合计入ch_fee表
|
|
|
//应收
|
|
|
feehj = "SELECT isnull(APFEE,0) as hj FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, feehj, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
feehj = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
feehj = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
if (decimal.Parse(feehj) != 0)
|
|
|
{
|
|
|
isFeeGain = 1;
|
|
|
string SQL_INSERT_CH_FEE = " INSERT INTO ch_fee (GID,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,COMMISSIONRATE,AMOUNT,CURRENCY,EXCHANGERATE,FEEFRT,REMARK,ISADVANCEDPAY,FEETYPE,BSNO,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO) VALUES(@gid,@fee_name,@customer_name,@unit,@unit_price,@quantity,@comm_rate,@amount,@currency,@exchange_rate,@fee_frt,@remark,@is_advance_pay,@fee_type,@bsno,@enter_operator,GETDATE(),@fee_status,@WMSOUTBSNO) ";
|
|
|
SqlParameter[] insertParms = new SqlParameter[] {
|
|
|
new SqlParameter(PARM_FEE_GID,SqlDbType.VarChar,36),
|
|
|
new SqlParameter(PARM_FEE_NAME,SqlDbType.VarChar,100),
|
|
|
new SqlParameter(PARM_FEE_CUSTOMER_NAME,SqlDbType.VarChar,50),
|
|
|
new SqlParameter(PARM_FEE_UNIT,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_UNIT_PRICE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_QUANTITY,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_COMMISSION_RATE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_AMOUNT,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_CURRENCY,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_EXCHANGE_RATE,SqlDbType.Decimal),
|
|
|
new SqlParameter(PARM_FEE_FRT,SqlDbType.VarChar,20),
|
|
|
new SqlParameter(PARM_FEE_REMARK,SqlDbType.VarChar),
|
|
|
new SqlParameter(PARM_FEE_ISADVANCEPAY,SqlDbType.Bit),
|
|
|
new SqlParameter(PARM_FEE_TYPE,SqlDbType.Int),
|
|
|
new SqlParameter(PARM_FEE_BSNO,SqlDbType.VarChar,100),
|
|
|
new SqlParameter(PARM_FEE_ENTER_OPERATOR,SqlDbType.VarChar,50),
|
|
|
new SqlParameter(PARM_FEE_STATUS,SqlDbType.Int),
|
|
|
new SqlParameter(PARM_FEE_AUDIT_WMSOUTBSNO,SqlDbType.VarChar,100)
|
|
|
};
|
|
|
|
|
|
insertParms[0].Value = Guid.NewGuid().ToString();
|
|
|
insertParms[1].Value = "入库费";
|
|
|
insertParms[2].Value = strTRUCKNAME.Trim();
|
|
|
insertParms[3].Value = "重量";
|
|
|
insertParms[4].Value = decimal.Parse(feehj);
|
|
|
insertParms[5].Value = 1;
|
|
|
insertParms[6].Value = 1;
|
|
|
insertParms[7].Value = decimal.Parse(feehj);
|
|
|
insertParms[8].Value = "RMB";
|
|
|
insertParms[9].Value = 1;
|
|
|
insertParms[10].Value = "";
|
|
|
insertParms[11].Value = "";
|
|
|
insertParms[12].Value = false;
|
|
|
insertParms[13].Value = 2;
|
|
|
insertParms[14].Value = items[i].ToString().Trim();
|
|
|
insertParms[15].Value = strUserID;
|
|
|
insertParms[16].Value = 0;
|
|
|
insertParms[17].Value = items[i].ToString().Trim();
|
|
|
iResult = -6;//
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT_CH_FEE, insertParms);
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
#region 保存利润信息
|
|
|
if (isFeeGain == 1)
|
|
|
{
|
|
|
string SQL_SELECT_FEE_PROFIT_BY_BSNO = "SELECT BSNO FROM fee_gain WHERE BSNO = '" + strASSOCIATEDNO + "' ";
|
|
|
object bsnoObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, SQL_SELECT_FEE_PROFIT_BY_BSNO, null);
|
|
|
if (bsnoObj == null)//如果没有相关利润信息,则插入新的利润信息
|
|
|
{
|
|
|
SqlParameter[] insertProfitParms = new SqlParameter[] {
|
|
|
new SqlParameter("@bsno",SqlDbType.VarChar,100),//委托编号
|
|
|
new SqlParameter("@create_user",SqlDbType.VarChar,36)//创建人
|
|
|
};
|
|
|
insertProfitParms[0].Value = strASSOCIATEDNO;
|
|
|
insertProfitParms[1].Value = strUserID;
|
|
|
//
|
|
|
string SQL_INSERT_FEE_GAIN_RECALCULATE = " INSERT INTO fee_gain(BSNO,RMBDR,USDDR,OTDR,RMBCR,USDCR,OTCR,STLDRRMB,STLDRUSD, "
|
|
|
+ " STLDROT,STLCRRMB,STLCRUSD,STLCROT,STLDRTTL,STLCRTTL,RMBPROFIT,USDPROFIT,OTPROFIT, "
|
|
|
+ " DRTTL,CRTTL,TTLPROFIT,PROFITRATE,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME) "
|
|
|
+ " SELECT * FROM ("
|
|
|
+ " SELECT BSNO,SUM(RMBDR) AS RMBDR,SUM(USDDR) AS USDDR,0 AS OTDR,SUM(RMBCR) AS RMBCR,SUM(USDCR) AS USDCR,0 AS OTCR, "
|
|
|
+ " 0 AS STLDRRMB,0 AS STLDRUSD,0 AS STLDROT,0 AS STLCRRMB,0 AS STLCRUSD,0 AS STLCROT,0 AS STLDRTTL,0 AS STLCRTTL,SUM(RMBDR) - SUM(RMBCR) AS RMBPROFIT, "
|
|
|
+ " SUM(USDDR) - SUM(USDCR) AS USDPROFIT,0 AS OTPROFIT FROM "
|
|
|
+ " (SELECT CURRENCY,BSNO,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE,BSNO ) AS D GROUP BY BSNO) AS B, "
|
|
|
+ " (SELECT SUM(RMBDR+USDTORMBDR) as DRTTL,SUM(RMBCR+USDTORMBCR) as CRTTL,"
|
|
|
+ " SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT,"
|
|
|
//+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),2))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE,"
|
|
|
+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE,"
|
|
|
+ " @create_user as CREATEUSER,GETDATE() as CREATETIME,@create_user as MODIFIEDUSER,GETDATE() as MODIFIEDTIME "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS C) AS A ";
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT_FEE_GAIN_RECALCULATE, insertProfitParms);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SqlParameter[] updateProfitParms = new SqlParameter[] {
|
|
|
new SqlParameter("@bsno",SqlDbType.VarChar,100),//委托编号
|
|
|
new SqlParameter("@modified_user",SqlDbType.VarChar,36)//创建人
|
|
|
};
|
|
|
updateProfitParms[0].Value = strASSOCIATEDNO;
|
|
|
updateProfitParms[1].Value = strUserID;
|
|
|
//
|
|
|
string SQL_UPDATE_FEE_GAIN_RECALCULATE = " UPDATE fee_gain SET RMBDR = B.RMBDR,RMBCR = B.RMBCR,USDDR = B.USDDR,USDCR = B.USDCR,RMBPROFIT = A.RMBPROFIT,"
|
|
|
+ " USDPROFIT = A.USDPROFIT,TTLPROFIT = A.TTLPROFIT,DRTTL = A.DRTTL,CRTTL = A.CRTTL,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE(),PROFITRATE = A.PROFITRATE "
|
|
|
+ " FROM (SELECT SUM(RMBDR) AS RMBDR,SUM(RMBCR) AS RMBCR,SUM(USDDR) AS USDDR,SUM(USDCR) AS USDCR "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " FEETYPE FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS D) AS B, "
|
|
|
+ " (SELECT SUM(RMBDR) - SUM(RMBCR) AS RMBPROFIT,SUM(USDDR) - SUM(USDCR) AS USDPROFIT,SUM(RMBDR+USDTORMBDR) as DRTTL, "
|
|
|
+ " SUM(RMBCR+USDTORMBCR) as CRTTL,SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT, "
|
|
|
//+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),2))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE "
|
|
|
+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS C) AS A"
|
|
|
+ " WHERE fee_gain.BSNO = @bsno ";
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_FEE_GAIN_RECALCULATE, updateProfitParms);
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
//
|
|
|
//事务提交
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
iResult = 1;//状态为1表示插入成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 装卸费取消入账,并解除锁定入库信息
|
|
|
/// </summary>
|
|
|
public int setnotlock(string strgids, string strUserID)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//string strSql = "update wms set ISLOCK=0,LOCKUSER='" + strUserID + "',LOCKTIME=getdate() where gid in (" + strgids + ")";
|
|
|
//iResult = -3;//
|
|
|
//SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, null);
|
|
|
|
|
|
string strSql = "delete from ch_fee where BSNO in (" + strgids + ") or WMSOUTBSNO in (" + strgids + ")";
|
|
|
iResult = -5;//
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, null);
|
|
|
|
|
|
strSql = "update wms_in set ISLOCK=0,LOCKUSER='" + strUserID + "',LOCKTIME=getdate() where gid in (" + strgids + ")";
|
|
|
iResult = -4;//
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, null);
|
|
|
//
|
|
|
string[] items = strgids.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
for (int i = 0; i < items.Length; i++)
|
|
|
{
|
|
|
string strASSOCIATEDNO = "SELECT ASSOCIATEDNO FROM wms_in WHERE GID = '" + items[i].ToString().Trim() + "'";
|
|
|
object statusObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, strASSOCIATEDNO, null);
|
|
|
if (statusObj == null)
|
|
|
{
|
|
|
strASSOCIATEDNO = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strASSOCIATEDNO = statusObj.ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
#region 保存利润信息
|
|
|
string SQL_SELECT_FEE_PROFIT_BY_BSNO = "SELECT BSNO FROM fee_gain WHERE BSNO = '" + strASSOCIATEDNO + "' ";
|
|
|
object bsnoObj = SqlHelper.ExecuteScalar(sqlTran, CommandType.Text, SQL_SELECT_FEE_PROFIT_BY_BSNO, null);
|
|
|
if (bsnoObj == null)//如果没有相关利润信息,则插入新的利润信息
|
|
|
{
|
|
|
SqlParameter[] insertProfitParms = new SqlParameter[] {
|
|
|
new SqlParameter("@bsno",SqlDbType.VarChar,100),//委托编号
|
|
|
new SqlParameter("@create_user",SqlDbType.VarChar,36)//创建人
|
|
|
};
|
|
|
insertProfitParms[0].Value = strASSOCIATEDNO;
|
|
|
insertProfitParms[1].Value = strUserID;
|
|
|
//
|
|
|
string SQL_INSERT_FEE_GAIN_RECALCULATE = " INSERT INTO fee_gain(BSNO,RMBDR,USDDR,OTDR,RMBCR,USDCR,OTCR,STLDRRMB,STLDRUSD, "
|
|
|
+ " STLDROT,STLCRRMB,STLCRUSD,STLCROT,STLDRTTL,STLCRTTL,RMBPROFIT,USDPROFIT,OTPROFIT, "
|
|
|
+ " DRTTL,CRTTL,TTLPROFIT,PROFITRATE,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME) "
|
|
|
+ " SELECT * FROM ("
|
|
|
+ " SELECT BSNO,SUM(RMBDR) AS RMBDR,SUM(USDDR) AS USDDR,0 AS OTDR,SUM(RMBCR) AS RMBCR,SUM(USDCR) AS USDCR,0 AS OTCR, "
|
|
|
+ " 0 AS STLDRRMB,0 AS STLDRUSD,0 AS STLDROT,0 AS STLCRRMB,0 AS STLCRUSD,0 AS STLCROT,0 AS STLDRTTL,0 AS STLCRTTL,SUM(RMBDR) - SUM(RMBCR) AS RMBPROFIT, "
|
|
|
+ " SUM(USDDR) - SUM(USDCR) AS USDPROFIT,0 AS OTPROFIT FROM "
|
|
|
+ " (SELECT CURRENCY,BSNO,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE,BSNO ) AS D GROUP BY BSNO) AS B, "
|
|
|
+ " (SELECT SUM(RMBDR+USDTORMBDR) as DRTTL,SUM(RMBCR+USDTORMBCR) as CRTTL,"
|
|
|
+ " SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT,"
|
|
|
//+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),2))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE,"
|
|
|
+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE,"
|
|
|
+ " @create_user as CREATEUSER,GETDATE() as CREATETIME,@create_user as MODIFIEDUSER,GETDATE() as MODIFIEDTIME "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS C) AS A ";
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT_FEE_GAIN_RECALCULATE, insertProfitParms);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SqlParameter[] updateProfitParms = new SqlParameter[] {
|
|
|
new SqlParameter("@bsno",SqlDbType.VarChar,100),//委托编号
|
|
|
new SqlParameter("@modified_user",SqlDbType.VarChar,36)//创建人
|
|
|
};
|
|
|
updateProfitParms[0].Value = strASSOCIATEDNO;
|
|
|
updateProfitParms[1].Value = strUserID;
|
|
|
//
|
|
|
string SQL_UPDATE_FEE_GAIN_RECALCULATE = " UPDATE fee_gain SET RMBDR = B.RMBDR,RMBCR = B.RMBCR,USDDR = B.USDDR,USDCR = B.USDCR,RMBPROFIT = A.RMBPROFIT,"
|
|
|
+ " USDPROFIT = A.USDPROFIT,TTLPROFIT = A.TTLPROFIT,DRTTL = A.DRTTL,CRTTL = A.CRTTL,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE(),PROFITRATE = A.PROFITRATE "
|
|
|
+ " FROM (SELECT SUM(RMBDR) AS RMBDR,SUM(RMBCR) AS RMBCR,SUM(USDDR) AS USDDR,SUM(USDCR) AS USDCR "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " FEETYPE FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS D) AS B, "
|
|
|
+ " (SELECT SUM(RMBDR) - SUM(RMBCR) AS RMBPROFIT,SUM(USDDR) - SUM(USDCR) AS USDPROFIT,SUM(RMBDR+USDTORMBDR) as DRTTL, "
|
|
|
+ " SUM(RMBCR+USDTORMBCR) as CRTTL,SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT, "
|
|
|
//+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),2))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE "
|
|
|
+ " (CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE "
|
|
|
+ " FROM (SELECT CURRENCY,SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR,"
|
|
|
+ " SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR, "
|
|
|
+ " SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR,FEETYPE "
|
|
|
+ " FROM ch_fee WHERE BSNO = @bsno and FEENAME in (select [name] from code_fee where FEETYPE='普通') GROUP BY CURRENCY,EXCHANGERATE,FEETYPE ) AS C) AS A"
|
|
|
+ " WHERE fee_gain.BSNO = @bsno ";
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_FEE_GAIN_RECALCULATE, updateProfitParms);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
//事务提交
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
iResult = 1;//状态为1表示插入成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
//
|
|
|
|
|
|
}
|
|
|
}
|