|
|
using System;
|
|
|
using System.Data;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Text;
|
|
|
using DSWeb.MvcShipping.Models.WMS;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
|
using System.Web;
|
|
|
using System.Data.Common;
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
using WebSqlHelper;
|
|
|
using HcUtility.Core;
|
|
|
//using DSWeb.Areas.CommMng.Models;
|
|
|
using System.Data.SqlClient;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.Models;
|
|
|
using HcUtility.Comm;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using static DSWeb.Areas.CommMng.DAL.BasicDataRefDAL;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.WMS
|
|
|
{
|
|
|
|
|
|
public partial class WMSDAL
|
|
|
{
|
|
|
#region 仓储信息列表
|
|
|
|
|
|
static public List<WMSmb> GetDataList(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT [GID],[WMSNO],dbo.trimdate(WMSDATE) WMSDATE,[CUSTOMERNAME],[WMSOP],[STOREMAN] ");
|
|
|
strSql.Append(" ,[MODIFIEDUSER],[MODIFIEDTIME],[ISDELETE],[DELETEUSER],[DELETETIME],[TRUCKNAME] ");
|
|
|
strSql.Append(" ,[ISLOCK],[LOCKUSER],[LOCKTIME],isnull(GOODSPACK,0) GOODSPACK,isnull(GOODSPACKSTOCK,0) GOODSPACKSTOCK ");
|
|
|
strSql.Append(" ,isnull(GOODSRKSL,0) GOODSRKSL,isnull(GOODSSTOCK,0) GOODSSTOCK,isnull(ARFEE,0) ARFEE ");
|
|
|
strSql.Append(" ,isnull(APFEE,0) APFEE,[ASSOCIATEDNO],[BLNO],[FREESTORAGEPERIOD],[CONTRACTNO] ");
|
|
|
strSql.Append(" ,[GOODSNAME],[GOODSMODEL],[CLIENTCODEOLD],[CLIENTNAMEOLD],[STORAGENAME],[CHARGEUNIT] ");
|
|
|
strSql.Append(" ,[CORPID],dbo.trimdate(STARTBILLINGDATE) [STARTBILLINGDATE],[CUSTOMNO],[CUSTNO] ");
|
|
|
strSql.Append(" ,[GOODSSTANDARD],[GOODSPACKACTUAL],[GOODSRKSLACTUAL],[ARCLIENT],[FREESTORAGEPERIODAP] ");
|
|
|
strSql.Append(" ,dbo.trimdate([STARTBILLINGDATEAP]) STARTBILLINGDATEAP,ISCHANGE ");
|
|
|
strSql.Append(" ,[AREANAME],[MARKETVALUE],[BANKVALUE],[BZTCHNO],[CREATEUSER],[CREATETIME],[CLIENTBSNO],[CARGO_GID],[REMARK] ");
|
|
|
strSql.Append(" FROM [wms] ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where ISDELETE=0 and " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where ISDELETE=0 ");
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by WMSDATE ");
|
|
|
}
|
|
|
return SetData(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSmb GetData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetDataList(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSmb> SetData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSmb data = new WMSmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.WMSNO = Convert.ToString(reader["WMSNO"]);
|
|
|
data.WMSDATE = Convert.ToString(reader["WMSDATE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.WMSOP = Convert.ToString(reader["WMSOP"]);
|
|
|
data.STOREMAN = Convert.ToString(reader["STOREMAN"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.ISDELETE = Convert.ToString(reader["ISDELETE"]);
|
|
|
data.DELETEUSER = Convert.ToString(reader["DELETEUSER"]);
|
|
|
data.DELETETIME = Convert.ToString(reader["DELETETIME"]);
|
|
|
data.ARCLIENT = Convert.ToString(reader["ARCLIENT"]);
|
|
|
data.TRUCKNAME = Convert.ToString(reader["TRUCKNAME"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.GOODSPACKSTOCK = Convert.ToString(reader["GOODSPACKSTOCK"]);
|
|
|
data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
data.CLIENTCODEOLD = Convert.ToString(reader["CLIENTCODEOLD"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.STARTBILLINGDATE = Convert.ToString(reader["STARTBILLINGDATE"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACKACTUAL = Convert.ToString(reader["GOODSPACKACTUAL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
data.FREESTORAGEPERIODAP = Convert.ToString(reader["FREESTORAGEPERIODAP"]);
|
|
|
data.STARTBILLINGDATEAP = Convert.ToString(reader["STARTBILLINGDATEAP"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.MARKETVALUE = Convert.ToString(reader["MARKETVALUE"]);
|
|
|
data.BANKVALUE = Convert.ToString(reader["BANKVALUE"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
data.CLIENTBSNO = Convert.ToString(reader["CLIENTBSNO"]);
|
|
|
data.CARGO_GID = Convert.ToString(reader["CARGO_GID"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 仓储信息列表_进口贸易版
|
|
|
|
|
|
static public List<WMSmb_ImportTrade> GetDataList_Import ( string strCondition, string sort )
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT w.[GID],[WMSNO],dbo.trimdate(w.WMSDATE) WMSDATE,[CUSTOMERNAME],[WMSOP],[STOREMAN] ");
|
|
|
strSql.Append(" ,w.[MODIFIEDUSER],w.[MODIFIEDTIME],w.[ISDELETE],w.[DELETEUSER],w.[DELETETIME],[TRUCKNAME] ");
|
|
|
strSql.Append(" ,[ISLOCK],[LOCKUSER],dbo.trimtime([LOCKTIME]) LOCKTIME,isnull(GOODSPACK,0) GOODSPACK,isnull(GOODSPACKSTOCK,0) GOODSPACKSTOCK ");
|
|
|
strSql.Append(" ,isnull(GOODSRKSL,0) GOODSRKSL,isnull(GOODSSTOCK,0) GOODSSTOCK,isnull(ARFEE,0) ARFEE ");
|
|
|
strSql.Append(" ,isnull(APFEE,0) APFEE,[ASSOCIATEDNO],[BLNO],[FREESTORAGEPERIOD],w.[CONTRACTNO] ");
|
|
|
strSql.Append(" ,c.name [GOODSNAME],[GOODSMODEL],[CLIENTCODEOLD],[CLIENTNAMEOLD],[STORAGENAME],[CHARGEUNIT] ");
|
|
|
strSql.Append(" ,w.[CORPID],dbo.trimdate(STARTBILLINGDATE) [STARTBILLINGDATE],[CUSTOMNO],[CUSTNO] ");
|
|
|
strSql.Append(" ,c.SPECIFICATIONS as GOODSSTANDARD,[GOODSPACKACTUAL],[GOODSRKSLACTUAL],[ARCLIENT],[FREESTORAGEPERIODAP] ");
|
|
|
strSql.Append(" ,dbo.trimdate([STARTBILLINGDATEAP]) STARTBILLINGDATEAP,ISCHANGE ");
|
|
|
strSql.Append(" ,[AREANAME],[MARKETVALUE],[BANKVALUE],w.[BZTCHNO],[CREATEUSER],dbo.trimdate([CREATETIME]) CREATETIME,[CLIENTBSNO],[CARGO_GID],w.[REMARK] ");
|
|
|
strSql.Append(" ,M.Inspection_Storage,dbo.trimdate(M.inspection_date) inspection_date,dbo.trimdate(M.Unsealdate) Unsealdate ");
|
|
|
strSql.Append(" ,dbo.trimdate(c.Productiondate_min) Productiondate_min,dbo.trimdate(c.Productiondate_max) Productiondate_max,Overfilled ");
|
|
|
strSql.Append(" ,dbo.F_ImportTrade_SealInfo(w.Cargo_gid) SALEINFO ");
|
|
|
strSql.Append(" ,m.Agent+m.AGENT2+m.Agent3 Agent,substring(cc.country,0,(charindex('(',cc.country)) ) country ");
|
|
|
strSql.Append(" ,dbo.F_factoryno(m.ContractNo) factoryno ");
|
|
|
strSql.Append(" ,(select top 1 CNTRNO from wms_in where ASSOCIATEDNO=w.gid) CNTRNO ");
|
|
|
strSql.Append(" ,W.CUSTOMNO DECLARENUMBER,M.HTH ");//DECLARENUMBER 以前取的是M.DECLARENUMBER 20170213改为取wms.CUSTOMNO
|
|
|
strSql.Append(" ,dbo.[F_ImportTrade_Saler_Main](m.contractno) SALER ");
|
|
|
strSql.Append(" ,convert(numeric(20,6) , ( select top 1 costprice from ImportTrade_Cargo where GID=w.Cargo_gid ) )costprice ");
|
|
|
strSql.Append(" ,(select top 1 costCargo from ImportTrade_Cargo where gid=c.gid)*w.GOODSRKSL/(case (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) when 0 then 1 else (select sum(GOODSRKSL) from wms where cargo_gid=c.GID) end) WmsInCost ");
|
|
|
strSql.Append(" ,M.Mainstate,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) as MainStateRef ,w.putintype ");
|
|
|
//strSql.Append(" ,M.Inspection_Storage,dbo.trimdate(M.inspection_date) inspection_date ");
|
|
|
//strSql.Append(" ,dbo.trimdate(M.Unsealdate) Unsealdate, ");
|
|
|
|
|
|
strSql.Append(" FROM [wms] w left join import_main m on m.contractno=w.ASSOCIATEDNO ");
|
|
|
strSql.Append(" left join import_cargo c on c.gid=w.Cargo_gid ");
|
|
|
strSql.Append(" left join code_country cc on cc.countryid=m.countryid ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where w.ISDELETE=0 and " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where w.ISDELETE=0 ");
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by w.WMSDATE ");
|
|
|
}
|
|
|
return SetData_Import(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSmb GetData_Import ( string condition )
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetDataList_Import(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSmb_ImportTrade> SetData_Import ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<WMSmb_ImportTrade>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSmb_ImportTrade data = new WMSmb_ImportTrade();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.WMSNO = Convert.ToString(reader["WMSNO"]);
|
|
|
data.WMSDATE = Convert.ToString(reader["WMSDATE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.WMSOP = Convert.ToString(reader["WMSOP"]);
|
|
|
data.STOREMAN = Convert.ToString(reader["STOREMAN"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.ISDELETE = Convert.ToString(reader["ISDELETE"]);
|
|
|
data.DELETEUSER = Convert.ToString(reader["DELETEUSER"]);
|
|
|
data.DELETETIME = Convert.ToString(reader["DELETETIME"]);
|
|
|
data.ARCLIENT = Convert.ToString(reader["ARCLIENT"]);
|
|
|
data.TRUCKNAME = Convert.ToString(reader["TRUCKNAME"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.GOODSPACKSTOCK = Convert.ToString(reader["GOODSPACKSTOCK"]);
|
|
|
data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
data.CLIENTCODEOLD = Convert.ToString(reader["CLIENTCODEOLD"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.STARTBILLINGDATE = Convert.ToString(reader["STARTBILLINGDATE"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACKACTUAL = Convert.ToString(reader["GOODSPACKACTUAL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
data.FREESTORAGEPERIODAP = Convert.ToString(reader["FREESTORAGEPERIODAP"]);
|
|
|
data.STARTBILLINGDATEAP = Convert.ToString(reader["STARTBILLINGDATEAP"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.MARKETVALUE = Convert.ToString(reader["MARKETVALUE"]);
|
|
|
data.BANKVALUE = Convert.ToString(reader["BANKVALUE"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
data.CLIENTBSNO = Convert.ToString(reader["CLIENTBSNO"]);
|
|
|
data.CARGO_GID = Convert.ToString(reader["CARGO_GID"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
|
|
|
data.Inspection_Storage = Convert.ToString(reader["Inspection_Storage"]);
|
|
|
data.inspection_date = Convert.ToString(reader["inspection_date"]);
|
|
|
data.Unsealdate = Convert.ToString(reader["Unsealdate"]);
|
|
|
data.Productiondate_min = Convert.ToString(reader["Productiondate_min"]);
|
|
|
data.Productiondate_max = Convert.ToString(reader["Productiondate_max"]);
|
|
|
data.Overfilled = Convert.ToString(reader["Overfilled"]);
|
|
|
data.SALEINFO = Convert.ToString(reader["SALEINFO"]);
|
|
|
|
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);
|
|
|
data.COUNTRY = Convert.ToString(reader["COUNTRY"]);
|
|
|
data.FACTORYNO = Convert.ToString(reader["FACTORYNO"]);
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);
|
|
|
data.DECLARENUMBER = Convert.ToString(reader["DECLARENUMBER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.SALER = Convert.ToString(reader["SALER"]);
|
|
|
data.COSTPRICE = Convert.ToString(reader["COSTPRICE"]);
|
|
|
data.WMSINCOST = Convert.ToString(reader["WMSINCOST"]);
|
|
|
data.HTH = Convert.ToString(reader["HTH"]);
|
|
|
|
|
|
data.PUTINTYPE = Convert.ToString(reader["putintype"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 入库信息列表
|
|
|
|
|
|
static public List<WMSINmb> GetWMSINList(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT * ");
|
|
|
strSql.Append(" FROM [wms_in] wi ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by wi.LINENUM ");
|
|
|
}
|
|
|
return SetWMSINData(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSINmb GetWMSINData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSINList(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSINmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSINmb> SetWMSINData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSINmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSINmb data = new WMSINmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);
|
|
|
data.SEALNO = Convert.ToString(reader["SEALNO"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.CLIENTCODE = Convert.ToString(reader["CLIENTCODE"]);
|
|
|
data.CLIENTNAME = Convert.ToString(reader["CLIENTNAME"]);
|
|
|
data.DODATE = Convert.ToString(reader["DODATE"]);
|
|
|
data.STORAGECODE = Convert.ToString(reader["STORAGECODE"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.GOODSCODE = Convert.ToString(reader["GOODSCODE"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSTYPE = Convert.ToString(reader["GOODSTYPE"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.ISDELETE = Convert.ToString(reader["ISDELETE"]);
|
|
|
data.DELETETIME = Convert.ToString(reader["DELETETIME"]);
|
|
|
data.DELETEUSER = Convert.ToString(reader["DELETEUSER"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.GOODSPACKSTOCK = Convert.ToString(reader["GOODSPACKSTOCK"]);
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);
|
|
|
data.GOODSKGS = Convert.ToString(reader["GOODSKGS"]);
|
|
|
data.CLIENTCODEOLD = Convert.ToString(reader["CLIENTCODEOLD"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);
|
|
|
data.GOODSTHICKNESS = Convert.ToString(reader["GOODSTHICKNESS"]);
|
|
|
data.GOODSWIDTH = Convert.ToString(reader["GOODSWIDTH"]);
|
|
|
data.GOODSLENGTH = Convert.ToString(reader["GOODSLENGTH"]);
|
|
|
data.GOODSSLICE = Convert.ToString(reader["GOODSSLICE"]);
|
|
|
data.GOODSGRADE = Convert.ToString(reader["GOODSGRADE"]);
|
|
|
data.STACKLOCATION = Convert.ToString(reader["STACKLOCATION"]);
|
|
|
data.GOODSPACKACTUAL = Convert.ToString(reader["GOODSPACKACTUAL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.MARKETVALUE = Convert.ToString(reader["MARKETVALUE"]);
|
|
|
data.BANKVALUE = Convert.ToString(reader["BANKVALUE"]);
|
|
|
data.LINENUM = Convert.ToString(reader["LINENUM"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 费率区间列表
|
|
|
|
|
|
static public List<WMSRATEmb> GetWMSRATE(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT *,case feetype when 1 then '收' when 2 then '付' end as FEETYPEREF ");
|
|
|
strSql.Append(" FROM [wms_Rate] ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by FEETYPE,FEEGRADE ");
|
|
|
}
|
|
|
return SetWMSRATEData(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSRATEmb GetWMSRATEData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSRATE(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSRATEmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSRATEmb> SetWMSRATEData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSRATEmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSRATEmb data = new WMSRATEmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.FEETYPE = Convert.ToString(reader["FEETYPE"]);
|
|
|
data.FEETYPEREF = Convert.ToString(reader["FEETYPEREF"]);
|
|
|
data.FEEGRADE = Convert.ToString(reader["FEEGRADE"]);
|
|
|
data.FEESCALE = Convert.ToString(reader["FEESCALE"]);
|
|
|
data.FEEPRICE = Convert.ToString(reader["FEEPRICE"]);
|
|
|
data.FEEUNIT = Convert.ToString(reader["FEEUNIT"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.ADDPRICE = Convert.ToString(reader["ADDPRICE"]);
|
|
|
data.ENDBILLINGDATE = Convert.ToString(reader["ENDBILLINGDATE"]);
|
|
|
data.RATETYPE = Convert.ToString(reader["RATETYPE"]);
|
|
|
data.FEENAME = Convert.ToString(reader["FEENAME"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.CAPPRICE = Convert.ToString(reader["CAPPRICE"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 通过WMS的GID获取业务的BSNO
|
|
|
static public string GetBSNOByWMSGID(string WMSGID) {
|
|
|
var BSNO="";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
try
|
|
|
{
|
|
|
var _BSNO = db.ExecuteScalar(CommandType.Text, "select ASSOCIATEDNO from wms where GID='" + WMSGID + "'");
|
|
|
BSNO = Convert.ToString(BSNO);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
return BSNO;
|
|
|
}
|
|
|
|
|
|
#region 费用入账(锁定WMS)
|
|
|
static public Resultmb Lock(string WMSGID, string LOCK,string USERID)
|
|
|
{
|
|
|
|
|
|
var BSNO = GetBSNOByWMSGID(WMSGID);
|
|
|
|
|
|
if (LOCK == "0")
|
|
|
{
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var _sql = "select count(*) from WMS_OUT_Detail where inbsno in('" + WMSGID + "')";
|
|
|
var objcount = db.ExecuteScalar(CommandType.Text, _sql);
|
|
|
var _count = Convert.ToString(objcount);
|
|
|
if (_count != "0")
|
|
|
{
|
|
|
var result = new Resultmb();
|
|
|
result.Success = false;
|
|
|
result.Message = "存在已经出库的入库记录,无法取消入账";
|
|
|
return result;
|
|
|
}
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" update wms set islock=" + LOCK + " where gid in(" + WMSGID + ")");
|
|
|
return setUnlock(strSql);//ExecuteNonQuery
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" update wms set islock=" + LOCK + " where gid in(" + WMSGID + ")");
|
|
|
return setLock(strSql);//ExecuteNonQuery
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
private static Resultmb setLock(StringBuilder strSql)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
var result = new Resultmb();
|
|
|
result.Success = true;
|
|
|
result.Message = "已经费用入账";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
private static Resultmb setUnlock(StringBuilder strSql)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
var result = new Resultmb();
|
|
|
result.Success = true;
|
|
|
result.Message = "已经取消费用入账";
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 出库信息列表
|
|
|
|
|
|
static public List<WMSOUTmb> GetWMSOUTList(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT [GID],[ASSOCIATEDNO],[BSNO],[CLIENTGID],[CLIENTCODE],[CUSTOMERNAME],dbo.trimdate([DODATE]) DODATE,[STORAGECODE] ");
|
|
|
strSql.Append(" ,[STORAGENAME],[AREACODE],[AREANAME],[GOODSCODE],[GOODSNAME],[GOODSTYPE],[GOODSMODEL],[GOODSSTANDARD] ");
|
|
|
strSql.Append(" ,[GOODSPACK],[GOODSPFSL],[GOODSOUTFEE],[TRUCKNO],[REMARK],[ISDELETE],dbo.trimdate([DELETETIME]) DELETETIME,[DELETEUSER] ");
|
|
|
strSql.Append(" ,[CREATEUSER],dbo.trimdate([CREATETIME]) createtime,[MODIFIEDUSER],dbo.trimdate([MODIFIEDTIME]) MODIFIEDTIME,[GOODSPACKPFSL],[TRUCKNAME] ");
|
|
|
strSql.Append(" ,[WMSOP],[STOREMAN],[ISLOCK],[LOCKUSER],dbo.trimdate([LOCKTIME]) LOCKTIME,[GOODSOUTFEEAP],[ARFEE],[APFEE],[INSPECTIONNO] ");
|
|
|
strSql.Append(" ,[CUSTOMNO],[CORPID],[CLIENTNAMEOLD],dbo.trimdate([OLDCUSTFEEDATE]) OLDCUSTFEEDATE,[CLIENTBSNO],[ARCLIENT],[INGIDNEW],[TOTALNO] ");
|
|
|
strSql.Append(" ,[REMARK2],dbo.trimdate([VALIDDATE]) VALIDDATE,[CHARGEUNIT],[MBLNONEW],[ISCHANGE],[MARKETVALUE],[ARCLIENTWMSOUT] ");
|
|
|
strSql.Append(" ,[BZTCHNO],[ISCOLLECTING], ");
|
|
|
strSql.Append(" (select MBLNO from vw_settlement where bsno=ASSOCIATEDNO) MBLNO ");
|
|
|
strSql.Append(" FROM [wms_out] ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where (ISDELETE=0 or ISDELETE is null) and " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where (ISDELETE=0 or ISDELETE is null) ");
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by DODATE ");
|
|
|
}
|
|
|
return SetWMSOUT(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSOUTmb GetWMSOUTData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSOUTList(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSOUTmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSOUTmb> SetWMSOUT(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSOUTmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSOUTmb data = new WMSOUTmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.CLIENTGID = Convert.ToString(reader["CLIENTGID"]);
|
|
|
data.CLIENTCODE = Convert.ToString(reader["CLIENTCODE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.DODATE = Convert.ToString(reader["DODATE"]);
|
|
|
data.STORAGECODE = Convert.ToString(reader["STORAGECODE"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.GOODSCODE = Convert.ToString(reader["GOODSCODE"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSTYPE = Convert.ToString(reader["GOODSTYPE"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
|
|
|
data.GOODSPFSL = Convert.ToString(reader["GOODSPFSL"]);
|
|
|
data.GOODSOUTFEE = Convert.ToString(reader["GOODSOUTFEE"]);
|
|
|
data.GOODSOUTFEEAP = Convert.ToString(reader["GOODSOUTFEEAP"]);
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.ISDELETE = Convert.ToString(reader["ISDELETE"]);
|
|
|
data.DELETETIME = Convert.ToString(reader["DELETETIME"]);
|
|
|
data.DELETEUSER = Convert.ToString(reader["DELETEUSER"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.GOODSPACKPFSL = Convert.ToString(reader["GOODSPACKPFSL"]);
|
|
|
data.TRUCKNAME = Convert.ToString(reader["TRUCKNAME"]);
|
|
|
data.WMSOP = Convert.ToString(reader["WMSOP"]);
|
|
|
data.STOREMAN = Convert.ToString(reader["STOREMAN"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.INSPECTIONNO = Convert.ToString(reader["INSPECTIONNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.OLDCUSTFEEDATE = Convert.ToString(reader["OLDCUSTFEEDATE"]);
|
|
|
data.CLIENTBSNO = Convert.ToString(reader["CLIENTBSNO"]);
|
|
|
data.ARCLIENT = Convert.ToString(reader["ARCLIENT"]);
|
|
|
data.INGIDNEW = Convert.ToString(reader["INGIDNEW"]);
|
|
|
data.VALIDDATE = Convert.ToString(reader["VALIDDATE"]);
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);
|
|
|
data.REMARK2 = Convert.ToString(reader["REMARK2"]);
|
|
|
data.MBLNONEW = Convert.ToString(reader["MBLNONEW"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.ARCLIENTWMSOUT = Convert.ToString(reader["ARCLIENTWMSOUT"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
data.ISCOLLECTING = Convert.ToString(reader["ISCOLLECTING"]);
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 出库信息列表_进口贸易用
|
|
|
|
|
|
static public List<WMSOUTImportmb> GetWMSOUTList_Import ( string strCondition, string sort )
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT wo.[GID],wo.[ASSOCIATEDNO],wo.[BSNO],wo.[CLIENTGID],wo.[CLIENTCODE],wo.[CUSTOMERNAME],dbo.trimdate(wo.[DODATE]) DODATE,wo.[STORAGECODE] ");
|
|
|
strSql.Append(" ,wo.[STORAGENAME],wo.[AREACODE],wo.[AREANAME],wod.[GOODSCODE],wod.[GOODSNAME],wod.[GOODSMODEL],wod.[GOODSSTANDARD],wod.[GOODSTYPE] ");//
|
|
|
strSql.Append(" ,wod.[GOODSPACK],wod.[GOODSPFSL],wo.[GOODSOUTFEE],wo.[TRUCKNO],wo.[REMARK],wo.[ISDELETE],dbo.trimdate(wo.[DELETETIME]) DELETETIME,wo.[DELETEUSER] ");
|
|
|
strSql.Append(" ,wo.[CREATEUSER],dbo.trimdate(wo.[CREATETIME]) createtime,wo.[MODIFIEDUSER],dbo.trimdate(wo.[MODIFIEDTIME]) MODIFIEDTIME,wod.[GOODSPACKPFSL],[TRUCKNAME] ");
|
|
|
strSql.Append(" ,[WMSOP],[STOREMAN],wo.[ISLOCK],wo.[LOCKUSER],dbo.trimdate(wo.[LOCKTIME]) LOCKTIME,wo.[GOODSOUTFEEAP],wo.[ARFEE],wo.[APFEE],[INSPECTIONNO] ");
|
|
|
strSql.Append(" ,[CUSTOMNO],wo.[CORPID],wo.[CLIENTNAMEOLD],dbo.trimdate(wo.[OLDCUSTFEEDATE]) OLDCUSTFEEDATE,[CLIENTBSNO],[ARCLIENT],[INGIDNEW],[TOTALNO] ");
|
|
|
strSql.Append(" ,[REMARK2],dbo.trimdate([VALIDDATE]) VALIDDATE,wo.[CHARGEUNIT],[MBLNONEW],wo.[ISCHANGE],wo.[MARKETVALUE],[ARCLIENTWMSOUT] ");
|
|
|
strSql.Append(" ,wod.[BZTCHNO],[ISCOLLECTING], ");
|
|
|
strSql.Append(" (select MBLNO from vw_settlement where bsno=wo.ASSOCIATEDNO) MBLNO ");
|
|
|
strSql.Append(" ,(select BSSTATUS from Import_Delivery where DELIVERYNO=wo.BSNO) BSSTATUS ");
|
|
|
strSql.Append(" ,m.HTH,m.Supplier_Billno,m.ContainerNo ");
|
|
|
strSql.Append(" ,dbo.[F_factoryno_WMSOUT](WO.BSNO) factoryno ");
|
|
|
strSql.Append(" ,substring(cc.country,0,(charindex('(',cc.country)) ) country ");
|
|
|
strSql.Append(" ,(select cargotype from Import_cargo where gid= sd.Cargo_GID) cargotype ");//商品类型
|
|
|
strSql.Append(" , dbo.F_ImportTrade_Saler_Main(wo.ASSOCIATEDNO) SALER ");
|
|
|
strSql.Append(" ,d.op,dd.WEIGHT_EX,dd.BOXCOUNT_EX,wod.GOODSPFSL GOODSPFSL_ACT,wod.GOODSPACKPFSL GOODSPACKPFSL_ACT,d.SFCM,D.OUTRECEIPT ");//, wo.CUSTOMERNAME
|
|
|
strSql.Append(" , convert(numeric(20,6) , ( select top 1 costprice from ImportTrade_Cargo where GID=sd.Cargo_gid ) ) costprice ");
|
|
|
strSql.Append(" ,sd.PRICERMB,(select OP from import_sales where salesno=sd.salesno) Sales_OP,D.op Delivery_OP,D.CONTACT,D.TEL");
|
|
|
strSql.Append(" ,(select sum(amount) from ch_fee where deliveryno = dd.gid ) PAYMONEY ");
|
|
|
strSql.Append(" FROM [wms_out] wo ");
|
|
|
strSql.Append(" left join import_main m on m.ContractNo=wo.associatedno ");
|
|
|
strSql.Append(" left join wms_out_detail wod on wod.OUTBSNO=wo.bsno ");
|
|
|
strSql.Append(" left join code_country cc on cc.countryid=m.countryid ");
|
|
|
strSql.Append(" left join Import_DeliveryDetail Dd on Dd.gid=wod.BSNO ");
|
|
|
strSql.Append(" left join Import_Saledetail sd on sd.gid=dd.SALEDETAIL_GID ");
|
|
|
strSql.Append(" left join Import_Delivery D on D.DELIVERYNO=dd.DELIVERYNO ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where isnull(wo.ISDELETE,0)=0 and " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where isnull(wo.ISDELETE,0)=0 ");
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by wo.DODATE ");
|
|
|
}
|
|
|
return SetWMSOUT_Import(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSOUTImportmb GetWMSOUTData_Import ( string condition )
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSOUTList_Import(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSOUTImportmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSOUTImportmb> SetWMSOUT_Import ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<WMSOUTImportmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSOUTImportmb data = new WMSOUTImportmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.CLIENTGID = Convert.ToString(reader["CLIENTGID"]);
|
|
|
data.CLIENTCODE = Convert.ToString(reader["CLIENTCODE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.DODATE = Convert.ToString(reader["DODATE"]);
|
|
|
data.STORAGECODE = Convert.ToString(reader["STORAGECODE"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.GOODSCODE = Convert.ToString(reader["GOODSCODE"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSTYPE = Convert.ToString(reader["GOODSTYPE"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
|
|
|
data.GOODSPFSL = Convert.ToString(reader["GOODSPFSL"]);
|
|
|
data.GOODSOUTFEE = Convert.ToString(reader["GOODSOUTFEE"]);
|
|
|
data.GOODSOUTFEEAP = Convert.ToString(reader["GOODSOUTFEEAP"]);
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.ISDELETE = Convert.ToString(reader["ISDELETE"]);
|
|
|
data.DELETETIME = Convert.ToString(reader["DELETETIME"]);
|
|
|
data.DELETEUSER = Convert.ToString(reader["DELETEUSER"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.GOODSPACKPFSL = Convert.ToString(reader["GOODSPACKPFSL"]);
|
|
|
data.TRUCKNAME = Convert.ToString(reader["TRUCKNAME"]);
|
|
|
data.WMSOP = Convert.ToString(reader["WMSOP"]);
|
|
|
data.STOREMAN = Convert.ToString(reader["STOREMAN"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.INSPECTIONNO = Convert.ToString(reader["INSPECTIONNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.OLDCUSTFEEDATE = Convert.ToString(reader["OLDCUSTFEEDATE"]);
|
|
|
data.CLIENTBSNO = Convert.ToString(reader["CLIENTBSNO"]);
|
|
|
data.ARCLIENT = Convert.ToString(reader["ARCLIENT"]);
|
|
|
data.INGIDNEW = Convert.ToString(reader["INGIDNEW"]);
|
|
|
data.VALIDDATE = Convert.ToString(reader["VALIDDATE"]);
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);
|
|
|
data.REMARK2 = Convert.ToString(reader["REMARK2"]);
|
|
|
data.MBLNONEW = Convert.ToString(reader["MBLNONEW"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.ARCLIENTWMSOUT = Convert.ToString(reader["ARCLIENTWMSOUT"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
data.ISCOLLECTING = Convert.ToString(reader["ISCOLLECTING"]);
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);
|
|
|
|
|
|
data.BSSTATUS = Convert.ToString(reader["BSSTATUS"]);
|
|
|
|
|
|
data.HTH = Convert.ToString(reader["HTH"]);
|
|
|
data.SUPPLIER_BILLNO = Convert.ToString(reader["SUPPLIER_BILLNO"]);
|
|
|
data.CONTAINERNO = Convert.ToString(reader["CONTAINERNO"]);
|
|
|
data.FACTORYNO = Convert.ToString(reader["FACTORYNO"]);
|
|
|
data.COUNTRY = Convert.ToString(reader["COUNTRY"]);
|
|
|
data.CARGOTYPE = Convert.ToString(reader["CARGOTYPE"]);
|
|
|
data.SALER = Convert.ToString(reader["SALER"]);
|
|
|
//data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.OP = Convert.ToString(reader["OP"]);
|
|
|
data.WEIGHT_EX = Convert.ToString(reader["WEIGHT_EX"]);
|
|
|
data.BOXCOUNT_EX = Convert.ToString(reader["BOXCOUNT_EX"]);
|
|
|
|
|
|
if (reader["COSTPRICE"] != DBNull.Value)
|
|
|
data.GOODSPFSL_ACT = Convert.ToString(reader["GOODSPFSL_ACT"]);
|
|
|
else
|
|
|
data.GOODSPFSL_ACT = "0";
|
|
|
data.GOODSPACKPFSL_ACT = Convert.ToString(reader["GOODSPACKPFSL_ACT"]);
|
|
|
data.SFCM = Convert.ToString(reader["SFCM"]);
|
|
|
if (reader["COSTPRICE"] != DBNull.Value)
|
|
|
data.COSTPRICE = Convert.ToString(reader["COSTPRICE"]);
|
|
|
else
|
|
|
data.COSTPRICE = "0";
|
|
|
|
|
|
if (reader["PRICERMB"] != DBNull.Value)
|
|
|
data.PRICERMB = Convert.ToString(reader["PRICERMB"]);
|
|
|
else
|
|
|
data.PRICERMB = "0";
|
|
|
|
|
|
//
|
|
|
data.TOTALCOST = Convert.ToString(Convert.ToDecimal(data.COSTPRICE) * Convert.ToDecimal(data.GOODSPFSL_ACT) * 1000);
|
|
|
//data.PAYMONEY = Convert.ToString(Convert.ToDecimal(data.PRICERMB) * Convert.ToDecimal(data.GOODSPFSL_ACT) * 1000);
|
|
|
|
|
|
if (reader["PAYMONEY"] != DBNull.Value){
|
|
|
|
|
|
data.PAYMONEY = Convert.ToString(reader["PAYMONEY"]);
|
|
|
|
|
|
data.ML = Convert.ToString(Convert.ToDecimal(data.PAYMONEY) - Convert.ToDecimal(data.TOTALCOST));
|
|
|
|
|
|
if (Convert.ToDecimal(data.PAYMONEY) == 0) {
|
|
|
data.MLRATE = "0";
|
|
|
}else
|
|
|
data.MLRATE = Convert.ToString(Convert.ToDecimal(data.ML) / Convert.ToDecimal(data.PAYMONEY));
|
|
|
}else{
|
|
|
data.PAYMONEY = "0";
|
|
|
data.ML = "0";
|
|
|
data.MLRATE = "0";
|
|
|
}
|
|
|
|
|
|
data.OUTRECEIPT = Convert.ToString(reader["OUTRECEIPT"]);
|
|
|
data.Sales_OP = Convert.ToString(reader["Sales_OP"]);
|
|
|
data.Delivery_OP = Convert.ToString(reader["Delivery_OP"]);
|
|
|
data.CONTACT = Convert.ToString(reader["CONTACT"]);
|
|
|
data.TEL = Convert.ToString(reader["TEL"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 出库信息明细列表
|
|
|
|
|
|
static public List<WMSOUTDetailmb> GetWMSOUTDetailList ( string USERID, string WMSOUTBSNO, string ASSOCIATEDNO, string condition, string sort,string ONLYINWMSOUT )
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select * from ( ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ONLYINWMSOUT))
|
|
|
{
|
|
|
//只看出库单内的信息
|
|
|
strSql.Append(" select * from (SELECT dbo.trimdate(i.wmsdate) i_wmsdate,i.customername i_customername ");
|
|
|
strSql.Append(" ,i.goodsname i_goodsname,i.goodsmodel i_goodsmodel,i.goodspackstock i_goodspackstock ");
|
|
|
strSql.Append(" ,i.goodsstock i_goodsstock,i.blno i_blno,dbo.trimdate(i.startbillingdate) i_startbillingdate ");
|
|
|
strSql.Append(" ,dbo.trimdate(i.STARTBILLINGDATEAP) i_STARTBILLINGDATEAP,i.gid i_INBSNO ");
|
|
|
strSql.Append(" ,i.MARKETVALUE i_MARKETVALUE,i.BANKVALUE i_bankvalue,i.ISDELETE i_isdelete,i.[BZTCHNO] i_BZTCHNO ");
|
|
|
|
|
|
strSql.Append(" ,od.[GID],od.[INBSNO],od.[OUTBSNO],od.[BSNO],od.[CLIENTGID],od.[CLIENTCODE],od.[CUSTOMERNAME],od.[DODATE],od.[STORAGECODE] ");
|
|
|
strSql.Append(" ,od.[STORAGENAME],od.[AREACODE],od.[AREANAME],od.[GOODSCODE],od.[GOODSNAME],od.[GOODSTYPE],od.[GOODSMODEL],od.[GOODSSTANDARD] ");
|
|
|
strSql.Append(" ,od.[GOODSPACK],od.[CHARGEUNIT],od.[GOODSPFSL],od.[GOODSOUTFEE],od.[TRUCKNO],od.[CREATEUSER],od.[CREATETIME],od.[REMARK] ");
|
|
|
strSql.Append(" ,od.[ASSOCIATEDNO],od.[GOODSPACKPFSL],od.[ARFEE],od.[APFEE],od.[ISLOCK],od.[LOCKUSER],od.[LOCKTIME],od.[GOODSOUTFEEAP],od.[CORPID] ");
|
|
|
strSql.Append(" ,od.[CLIENTNAMEOLD],od.[OLDCUSTFEEDATE],od.[STARTBILLINGDATE],od.[ENDBILLINGDATE],od.[FEEDAYS],od.[GOODSSLICE],od.[GOODSGRADE] ");
|
|
|
strSql.Append(" ,od.[STARTBILLINGDATEAP],od.[ENDBILLINGDATEAP],od.[FEEDAYSAP],od.[ISCHANGE],od.[MARKETVALUE],od.[BZTCHNO] ");
|
|
|
strSql.Append(" FROM [wms] i left join wms_out_detail od on od.INBSNO=i.gid )tt");
|
|
|
|
|
|
strSql.Append(" where OUTBSNO='" + WMSOUTBSNO.Trim() + "'");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//点击执行查询,看出库单内,和符合条件的其他入库单信息。
|
|
|
strSql.Append(" select * from (SELECT dbo.trimdate(i.wmsdate) i_wmsdate,i.customername i_customername ");
|
|
|
strSql.Append(" ,i.goodsname i_goodsname,i.goodsmodel i_goodsmodel,i.goodspackstock i_goodspackstock ");
|
|
|
strSql.Append(" ,i.goodsstock i_goodsstock,i.blno i_blno,dbo.trimdate(i.startbillingdate) i_startbillingdate ");
|
|
|
strSql.Append(" ,dbo.trimdate(i.STARTBILLINGDATEAP) i_STARTBILLINGDATEAP,i.gid i_INBSNO ");
|
|
|
strSql.Append(" ,i.MARKETVALUE i_MARKETVALUE,i.BANKVALUE i_bankvalue,i.ISDELETE i_isdelete,i.[BZTCHNO] i_BZTCHNO ");
|
|
|
|
|
|
strSql.Append(" ,od.[GID],od.[INBSNO],od.[OUTBSNO],od.[BSNO],od.[CLIENTGID],od.[CLIENTCODE],od.[CUSTOMERNAME],od.[DODATE],od.[STORAGECODE] ");
|
|
|
strSql.Append(" ,od.[STORAGENAME],od.[AREACODE],od.[AREANAME],od.[GOODSCODE],od.[GOODSNAME],od.[GOODSTYPE],od.[GOODSMODEL],od.[GOODSSTANDARD] ");
|
|
|
strSql.Append(" ,od.[GOODSPACK],od.[CHARGEUNIT],od.[GOODSPFSL],od.[GOODSOUTFEE],od.[TRUCKNO],od.[CREATEUSER],od.[CREATETIME],od.[REMARK] ");
|
|
|
strSql.Append(" ,od.[ASSOCIATEDNO],od.[GOODSPACKPFSL],od.[ARFEE],od.[APFEE],od.[ISLOCK],od.[LOCKUSER],od.[LOCKTIME],od.[GOODSOUTFEEAP],od.[CORPID] ");
|
|
|
strSql.Append(" ,od.[CLIENTNAMEOLD],od.[OLDCUSTFEEDATE],od.[STARTBILLINGDATE],od.[ENDBILLINGDATE],od.[FEEDAYS],od.[GOODSSLICE],od.[GOODSGRADE] ");
|
|
|
strSql.Append(" ,od.[STARTBILLINGDATEAP],od.[ENDBILLINGDATEAP],od.[FEEDAYSAP],od.[ISCHANGE],od.[MARKETVALUE],od.[BZTCHNO] ");
|
|
|
strSql.Append(" FROM [wms] i left join wms_out_detail od on od.INBSNO=i.gid )tt");
|
|
|
|
|
|
strSql.Append(" where OUTBSNO='" + WMSOUTBSNO.Trim() + "' ");
|
|
|
|
|
|
strSql.Append(" UNION ALL SELECT dbo.trimdate(i.wmsdate) i_wmsdate,i.customername i_customername ");
|
|
|
strSql.Append(" ,i.goodsname i_goodsname,i.goodsmodel i_goodsmodel,i.goodspackstock i_goodspackstock ");
|
|
|
strSql.Append(" ,i.goodsstock i_goodsstock,i.blno i_blno,dbo.trimdate(i.startbillingdate) i_startbillingdate ");
|
|
|
strSql.Append(" ,dbo.trimdate(i.STARTBILLINGDATEAP) i_STARTBILLINGDATEAP,i.gid i_INBSNO ");
|
|
|
strSql.Append(" ,i.MARKETVALUE i_MARKETVALUE,i.BANKVALUE i_bankvalue,i.ISDELETE i_isdelete,i.[BZTCHNO] i_BZTCHNO ");
|
|
|
|
|
|
strSql.Append(" ,'' [GID],i.gid [INBSNO],'' [OUTBSNO],'' [BSNO],'' [CLIENTGID],'' [CLIENTCODE],i.customername [CUSTOMERNAME],getdate() [DODATE],'' [STORAGECODE] ");
|
|
|
strSql.Append(" ,i.STORAGENAME [STORAGENAME],'' [AREACODE],i.AREANAME [AREANAME],'' [GOODSCODE],i.goodsname [GOODSNAME],''[GOODSTYPE],i.goodsmodel [GOODSMODEL],'' [GOODSSTANDARD] ");
|
|
|
strSql.Append(" ,'' [GOODSPACK],i.CHARGEUNIT [CHARGEUNIT],0 [GOODSPFSL],0 [GOODSOUTFEE],'' [TRUCKNO],'" + USERID.Trim() + "' [CREATEUSER],getdate() [CREATETIME],'' [REMARK] ");
|
|
|
strSql.Append(" ,i.ASSOCIATEDNO [ASSOCIATEDNO],0 [GOODSPACKPFSL],0 [ARFEE],0 [APFEE],0 [ISLOCK],'' [LOCKUSER],'' [LOCKTIME],0 [GOODSOUTFEEAP],i.CORPID [CORPID] ");
|
|
|
strSql.Append(" ,'' [CLIENTNAMEOLD],'' [OLDCUSTFEEDATE],i.STARTBILLINGDATE [STARTBILLINGDATE],'' [ENDBILLINGDATE],0 [FEEDAYS],0 [GOODSSLICE],'' [GOODSGRADE] ");
|
|
|
strSql.Append(" ,i.STARTBILLINGDATEAP [STARTBILLINGDATEAP],'' [ENDBILLINGDATEAP],0 [FEEDAYSAP],0 [ISCHANGE],0 [MARKETVALUE],i.[BZTCHNO] [BZTCHNO] ");
|
|
|
strSql.Append(" FROM [wms] i where isdelete=0 and goodspackstock>0 and goodsstock>0 and islock=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ASSOCIATEDNO))
|
|
|
{
|
|
|
strSql.Append(" and ASSOCIATEDNO='" + ASSOCIATEDNO.Trim() + "' ");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(WMSOUTBSNO))
|
|
|
{
|
|
|
strSql.Append(" and i.GID not in (select inbsno from wms_out_detail where outbsno='" + WMSOUTBSNO + "') ");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" and " + condition + " ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
strSql.Append(" )tt1 ");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by DODATE ");
|
|
|
}
|
|
|
return SetWMSOUTDetail(strSql);
|
|
|
}
|
|
|
|
|
|
static public List<WMSOUTDetailmb> GetWMSOUTDetailList_0(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(" SELECT [GID],[INBSNO],[OUTBSNO],[BSNO],[CLIENTGID],[CLIENTCODE],[CUSTOMERNAME],[DODATE],[STORAGECODE] ");
|
|
|
strSql.Append(" ,[STORAGENAME],[AREACODE],[AREANAME],[GOODSCODE],[GOODSNAME],[GOODSTYPE],[GOODSMODEL],[GOODSSTANDARD] ");
|
|
|
strSql.Append(" ,[GOODSPACK],[CHARGEUNIT],[GOODSPFSL],[GOODSOUTFEE],[TRUCKNO],[CREATEUSER],[CREATETIME],[REMARK] ");
|
|
|
strSql.Append(" ,[ASSOCIATEDNO],[GOODSPACKPFSL],[ARFEE],[APFEE],[ISLOCK],[LOCKUSER],[LOCKTIME],[GOODSOUTFEEAP],[CORPID] ");
|
|
|
strSql.Append(" ,[CLIENTNAMEOLD],[OLDCUSTFEEDATE],[STARTBILLINGDATE],[ENDBILLINGDATE],[FEEDAYS],[GOODSSLICE],[GOODSGRADE] ");
|
|
|
strSql.Append(" ,[STARTBILLINGDATEAP],[ENDBILLINGDATEAP],[FEEDAYSAP],[ISCHANGE],[MARKETVALUE],[BZTCHNO] ");
|
|
|
strSql.Append(" FROM [wms_out_detail] ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//strSql.Append(" where (ISDELETE=0 or ISDELETE is null) ");
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by DODATE ");
|
|
|
}
|
|
|
return SetWMSOUTDetail_0(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSOUTDetailmb GetWMSOUTDetailData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSOUTDetailList_0(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSOUTDetailmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSOUTDetailmb> SetWMSOUTDetail(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSOUTDetailmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSOUTDetailmb data = new WMSOUTDetailmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.INBSNO = Convert.ToString(reader["INBSNO"]);
|
|
|
data.OUTBSNO = Convert.ToString(reader["OUTBSNO"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.CLIENTGID = Convert.ToString(reader["CLIENTGID"]);
|
|
|
data.CLIENTCODE = Convert.ToString(reader["CLIENTCODE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.DODATE = Convert.ToString(reader["DODATE"]);
|
|
|
data.STORAGECODE = Convert.ToString(reader["STORAGECODE"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.GOODSCODE = Convert.ToString(reader["GOODSCODE"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSTYPE = Convert.ToString(reader["GOODSTYPE"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSPFSL = Convert.ToString(reader["GOODSPFSL"]);
|
|
|
data.GOODSPACKPFSL = Convert.ToString(reader["GOODSPACKPFSL"]);
|
|
|
data.GOODSOUTFEE = Convert.ToString(reader["GOODSOUTFEE"]);
|
|
|
data.GOODSOUTFEEAP = Convert.ToString(reader["GOODSOUTFEEAP"]);
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.OLDCUSTFEEDATE = Convert.ToString(reader["OLDCUSTFEEDATE"]);
|
|
|
data.STARTBILLINGDATE = Convert.ToString(reader["STARTBILLINGDATE"]);
|
|
|
data.ENDBILLINGDATE = Convert.ToString(reader["ENDBILLINGDATE"]);
|
|
|
data.FEEDAYS = Convert.ToString(reader["FEEDAYS"]);
|
|
|
data.GOODSSLICE = Convert.ToString(reader["GOODSSLICE"]);
|
|
|
data.GOODSGRADE = Convert.ToString(reader["GOODSGRADE"]);
|
|
|
data.STARTBILLINGDATEAP = Convert.ToString(reader["STARTBILLINGDATEAP"]);
|
|
|
data.ENDBILLINGDATEAP = Convert.ToString(reader["ENDBILLINGDATEAP"]);
|
|
|
data.FEEDAYSAP = Convert.ToString(reader["FEEDAYSAP"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.MARKETVALUE = Convert.ToString(reader["MARKETVALUE"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
|
|
|
data.i_WMSDATE = Convert.ToString(reader["i_WMSDATE"]);
|
|
|
data.i_CUSTOMERNAME = Convert.ToString(reader["i_CUSTOMERNAME"]);
|
|
|
data.i_GOODSNAME = Convert.ToString(reader["i_GOODSNAME"]);
|
|
|
data.i_GOODSMODEL = Convert.ToString(reader["i_GOODSMODEL"]);
|
|
|
data.i_GOODSPACKSTOCK = Convert.ToString(reader["i_GOODSPACKSTOCK"]);
|
|
|
data.i_GOODSSTOCK = Convert.ToString(reader["i_GOODSSTOCK"]);
|
|
|
data.i_BLNO = Convert.ToString(reader["i_BLNO"]);
|
|
|
data.i_STARTBILLINGDATE = Convert.ToString(reader["i_STARTBILLINGDATE"]);
|
|
|
data.i_STARTBILLINGDATEAP = Convert.ToString(reader["i_STARTBILLINGDATEAP"]);
|
|
|
data.i_MARKETVALUE = Convert.ToString(reader["i_MARKETVALUE"]);
|
|
|
data.i_BANKVALUE = Convert.ToString(reader["i_BANKVALUE"]);
|
|
|
data.i_ISDELETE = Convert.ToString(reader["i_ISDELETE"]);
|
|
|
data.i_BZTCHNO = Convert.ToString(reader["i_BZTCHNO"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
private static List<WMSOUTDetailmb> SetWMSOUTDetail_0(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSOUTDetailmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSOUTDetailmb data = new WMSOUTDetailmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.INBSNO = Convert.ToString(reader["INBSNO"]);
|
|
|
data.OUTBSNO = Convert.ToString(reader["OUTBSNO"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.CLIENTGID = Convert.ToString(reader["CLIENTGID"]);
|
|
|
data.CLIENTCODE = Convert.ToString(reader["CLIENTCODE"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.DODATE = Convert.ToString(reader["DODATE"]);
|
|
|
data.STORAGECODE = Convert.ToString(reader["STORAGECODE"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
data.GOODSCODE = Convert.ToString(reader["GOODSCODE"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSTYPE = Convert.ToString(reader["GOODSTYPE"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSPFSL = Convert.ToString(reader["GOODSPFSL"]);
|
|
|
data.GOODSPACKPFSL = Convert.ToString(reader["GOODSPACKPFSL"]);
|
|
|
data.GOODSOUTFEE = Convert.ToString(reader["GOODSOUTFEE"]);
|
|
|
data.GOODSOUTFEEAP = Convert.ToString(reader["GOODSOUTFEEAP"]);
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.CLIENTNAMEOLD = Convert.ToString(reader["CLIENTNAMEOLD"]);
|
|
|
data.OLDCUSTFEEDATE = Convert.ToString(reader["OLDCUSTFEEDATE"]);
|
|
|
data.STARTBILLINGDATE = Convert.ToString(reader["STARTBILLINGDATE"]);
|
|
|
data.ENDBILLINGDATE = Convert.ToString(reader["ENDBILLINGDATE"]);
|
|
|
data.FEEDAYS = Convert.ToString(reader["FEEDAYS"]);
|
|
|
data.GOODSSLICE = Convert.ToString(reader["GOODSSLICE"]);
|
|
|
data.GOODSGRADE = Convert.ToString(reader["GOODSGRADE"]);
|
|
|
data.STARTBILLINGDATEAP = Convert.ToString(reader["STARTBILLINGDATEAP"]);
|
|
|
data.ENDBILLINGDATEAP = Convert.ToString(reader["ENDBILLINGDATEAP"]);
|
|
|
data.FEEDAYSAP = Convert.ToString(reader["FEEDAYSAP"]);
|
|
|
data.ISCHANGE = Convert.ToString(reader["ISCHANGE"]);
|
|
|
data.MARKETVALUE = Convert.ToString(reader["MARKETVALUE"]);
|
|
|
data.BZTCHNO = Convert.ToString(reader["BZTCHNO"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 出库时费用明细列表
|
|
|
|
|
|
static public List<WMSRATEDetailmb> GetWMSRATEDetailList(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT *,case feetype when 1 then '收' when 2 then '付' end as FEETYPEREF ");
|
|
|
strSql.Append(" FROM [wms_Rate_detail] ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by FEETYPE,FEEGRADE ");
|
|
|
}
|
|
|
return SetWMSRATEDetailData(strSql);
|
|
|
}
|
|
|
|
|
|
static public WMSRATEDetailmb GetWMSRATEDetailData(string condition)
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetWMSRATEDetailList(condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new WMSRATEDetailmb();
|
|
|
}
|
|
|
|
|
|
private static List<WMSRATEDetailmb> SetWMSRATEDetailData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSRATEDetailmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSRATEDetailmb data = new WMSRATEDetailmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.ASSOCIATEDNO = Convert.ToString(reader["ASSOCIATEDNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.FEETYPE = Convert.ToString(reader["FEETYPE"]);
|
|
|
data.FEEGRADE = Convert.ToString(reader["FEEGRADE"]);
|
|
|
data.STARTBILLINGDATE = Convert.ToString(reader["STARTBILLINGDATE"]);
|
|
|
data.ENDBILLINGDATE = Convert.ToString(reader["ENDBILLINGDATE"]);
|
|
|
data.FEESCALE = Convert.ToString(reader["FEESCALE"]);
|
|
|
data.FEEUNIT = Convert.ToString(reader["FEEUNIT"]);
|
|
|
data.FEEPRICE = Convert.ToString(reader["FEEPRICE"]);
|
|
|
data.GOODSPFSL = Convert.ToString(reader["GOODSPFSL"]);
|
|
|
data.OUTFEE = Convert.ToString(reader["OUTFEE"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.WMSOUTGID = Convert.ToString(reader["WMSOUTGID"]);
|
|
|
data.FEETYPEREF = Convert.ToString(reader["FEETYPEREF"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 删除出库信息
|
|
|
static public int DeleteOut(string BSNO)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" delete from wms_rate_detail where ASSOCIATEDNO in( select gid from wms_out_detail where bsno='" + BSNO + "')");
|
|
|
strSql.Append(" delete from wms_out_detail where outbsno='" + BSNO + "'");
|
|
|
return SetDeleteOut(strSql);//ExecuteNonQuery
|
|
|
}
|
|
|
private static int SetDeleteOut(StringBuilder strSql)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
return _count;
|
|
|
}
|
|
|
private static int GetCount(StringBuilder strSql)
|
|
|
{
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = Convert.ToInt32(db.ExecuteScalar(CommandType.Text, strSql.ToString()));
|
|
|
return _count;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 获取来源于货转的已锁定入库信息数量
|
|
|
static public int GetHZWMSLockCount(string INNEWGID)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select count(*) from wms where GID='" + INNEWGID + "' and islock=1");
|
|
|
return GetCount(strSql);//ExecuteNonQuery
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 删除来源于货转的入库信息
|
|
|
static public int DelHZWMS(string GID)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" delete from wms where gid='" + GID + "'");
|
|
|
strSql.Append(" delete from wms_in where associatedno='" + GID + "'");
|
|
|
//strSql.Append(" delete from wms_rate where BSNO='" + GID + "'");
|
|
|
return SetDeleteOut(strSql);//ExecuteNonQuery
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 插入来源于货转的入库信息
|
|
|
static public Resultmb InsertHZWMS(WMSOUTmb head,string WMSGID,string WMSNO,string USERID)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" insert into WMS ");
|
|
|
strSql.Append(" ([GID],[WMSNO],[WMSDATE],[CUSTOMERNAME],[WMSOP],[STOREMAN] ");
|
|
|
strSql.Append(" ,[MODIFIEDUSER],[MODIFIEDTIME],[ISDELETE],[DELETEUSER], [DELETETIME],[TRUCKNAME],[ISLOCK],[LOCKUSER],[LOCKTIME] ");
|
|
|
strSql.Append(" ,[GOODSPACK],[GOODSPACKSTOCK],[GOODSRKSL],[GOODSSTOCK],[ARFEE],[APFEE],[ASSOCIATEDNO] ");
|
|
|
strSql.Append(" ,[BLNO],[FREESTORAGEPERIOD],[CONTRACTNO],[GOODSNAME],[GOODSMODEL],[CLIENTCODEOLD] ");
|
|
|
strSql.Append(" ,[CLIENTNAMEOLD],[STORAGENAME],[CHARGEUNIT],[CORPID],[STARTBILLINGDATE],[CUSTOMNO],[CUSTNO] ");
|
|
|
strSql.Append(" ,[GOODSSTANDARD],[GOODSPACKACTUAL] ");
|
|
|
strSql.Append(" ,[GOODSRKSLACTUAL],[ARCLIENT],[FREESTORAGEPERIODAP],[STARTBILLINGDATEAP],[ISCHANGE] ");
|
|
|
strSql.Append(" ,[AREANAME],[MARKETVALUE],[BANKVALUE],[BZTCHNO],[CREATEUSER],[CREATETIME],[CLIENTBSNO]) ");
|
|
|
strSql.Append(" SELECT TOP 1 '" + WMSGID + "' [GID],'" + WMSNO + "'[WMSNO],DODATE [WMSDATE],CLIENTNAMEOLD [CUSTOMERNAME],(select showname from [user] where gid=wms_out.createuser) [WMSOP],[STOREMAN] ");
|
|
|
strSql.Append(" ,'" + USERID + "'[MODIFIEDUSER],getdate() [MODIFIEDTIME] ");
|
|
|
strSql.Append(" ,0 [ISDELETE],'' [DELETEUSER],'' [DELETETIME],[TRUCKNAME],0 [ISLOCK],'' [LOCKUSER],'' [LOCKTIME] ");
|
|
|
strSql.Append(" ,GOODSPACKPFSL [GOODSPACK],GOODSPACKPFSL [GOODSPACKSTOCK] "); //wms_out的出库件数 计入wms的入库量和剩余件数
|
|
|
strSql.Append(" ,GOODSPFSL [GOODSRKSL],GOODSPFSL [GOODSSTOCK] ");//wms_out的出库量 计入wms的入库量和剩余量
|
|
|
strSql.Append(" ,0 [ARFEE],0 [APFEE],[ASSOCIATEDNO] ");
|
|
|
strSql.Append(" ,(select mblno from vw_settlement where bsno=[ASSOCIATEDNO])[BLNO] ");
|
|
|
strSql.Append(" ,0 [FREESTORAGEPERIOD] ");
|
|
|
strSql.Append(" ,(select contractno from VW_Settlement where bsno=ASSOCIATEDNO) [CONTRACTNO] ");
|
|
|
strSql.Append(" ,[GOODSNAME],[GOODSMODEL] ");
|
|
|
strSql.Append(" ,'' [CLIENTCODEOLD],'' [CLIENTNAMEOLD],[STORAGENAME],[CHARGEUNIT] ");
|
|
|
strSql.Append(" ,[CORPID],OLDCUSTFEEDATE [STARTBILLINGDATE],[CUSTOMNO] ");
|
|
|
strSql.Append(" ,(select custno from vw_settlement where bsno=ASSOCIATEDNO) [CUSTNO] ");
|
|
|
strSql.Append(" ,[GOODSSTANDARD],GOODSPACKPFSL [GOODSPACKACTUAL] ");
|
|
|
strSql.Append(" ,GOODSPFSL [GOODSRKSLACTUAL],CLIENTNAMEOLD [ARCLIENT],0 [FREESTORAGEPERIODAP],OLDCUSTFEEDATE [STARTBILLINGDATEAP],1 [ISCHANGE] ");
|
|
|
strSql.Append(" ,'' [AREANAME],0 [MARKETVALUE],0 [BANKVALUE],[BZTCHNO],[CREATEUSER],[CREATETIME],'' [CLIENTBSNO] ");
|
|
|
strSql.Append(" FROM [wms_out] where GID='"+head.GID+"'");
|
|
|
strSql.Append(" update wms_out set INGIDNEW='" + WMSGID + "' where GID='" + head.GID + "'");
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
if (_count > 0) {
|
|
|
var strSqlWI = new StringBuilder();
|
|
|
strSqlWI.Append(" insert into WMS_IN ");
|
|
|
strSqlWI.Append(" ([GID],[ASSOCIATEDNO],[BLNO],[CONTRACTNO],[CNTRNO] ");
|
|
|
strSqlWI.Append(" ,[SEALNO],[BSNO],[CLIENTCODE],[CLIENTNAME],[DODATE],[STORAGECODE] ");
|
|
|
strSqlWI.Append(" ,[STORAGENAME]");
|
|
|
strSqlWI.Append(" ,[AREACODE],[AREANAME],[GOODSCODE],[GOODSNAME],[GOODSTYPE] ");
|
|
|
strSqlWI.Append(" ,[GOODSMODEL],[GOODSSTANDARD] ");
|
|
|
strSqlWI.Append(" ,[GOODSPACK],[CHARGEUNIT],[GOODSRKSL] ");
|
|
|
strSqlWI.Append(" ,[GOODSSTOCK],[FREESTORAGEPERIOD],[ISLOCK],[LOCKTIME] ");
|
|
|
strSqlWI.Append(" ,[LOCKUSER],[ISDELETE],[DELETETIME],[DELETEUSER],[CREATEUSER],[CREATETIME],[MODIFIEDUSER] ");
|
|
|
strSqlWI.Append(" ,[MODIFIEDTIME],[REMARK],[GOODSPACKSTOCK],[KINDPKGS],[GOODSKGS],[CLIENTCODEOLD] ");
|
|
|
strSqlWI.Append(" ,[CLIENTNAMEOLD],[ARFEE],[APFEE],[CORPID],[CTNALL],[GOODSTHICKNESS],[GOODSWIDTH] ");
|
|
|
strSqlWI.Append(" ,[GOODSLENGTH],[GOODSSLICE],[GOODSGRADE],[STACKLOCATION] ");
|
|
|
strSqlWI.Append(" ,[GOODSPACKACTUAL],[GOODSRKSLACTUAL],[ISCHANGE] ");
|
|
|
strSqlWI.Append(" ,[MARKETVALUE],[BANKVALUE],[LINENUM])");
|
|
|
|
|
|
strSqlWI.Append(" SELECT TOP 1 newid() [GID],'"+WMSGID+"'[ASSOCIATEDNO],[BLNO],[CONTRACTNO],''[CNTRNO] ");
|
|
|
strSqlWI.Append(" ,''[SEALNO],'WMSNO'[BSNO],''[CLIENTCODE],CUSTOMERNAME[CLIENTNAME],getdate()[DODATE],''[STORAGECODE] ");
|
|
|
strSqlWI.Append(" ,[STORAGENAME] ");
|
|
|
strSqlWI.Append(" ,'' [AREACODE],[AREANAME],''[GOODSCODE],GOODSname [GOODSNAME],''[GOODSTYPE] ");
|
|
|
strSqlWI.Append(" ,[GOODSMODEL],[GOODSSTANDARD] ");
|
|
|
strSqlWI.Append(" ,"+head.GOODSPACKPFSL+" [GOODSPACK],[CHARGEUNIT],"+head.GOODSPFSL+" [GOODSRKSL] ");
|
|
|
strSqlWI.Append(" ,"+head.GOODSPFSL+" [GOODSSTOCK],[FREESTORAGEPERIOD],[ISLOCK],[LOCKTIME] ");
|
|
|
strSqlWI.Append(" ,[LOCKUSER],[ISDELETE],[DELETETIME],[DELETEUSER],[CREATEUSER],[CREATETIME],[MODIFIEDUSER] ");
|
|
|
strSqlWI.Append(" ,[MODIFIEDTIME],'货权转移'[REMARK],"+head.GOODSPACKPFSL+"[GOODSPACKSTOCK],''[KINDPKGS],0 [GOODSKGS],'' [CLIENTCODEOLD] ");
|
|
|
strSqlWI.Append(" ,'"+head.CUSTOMERNAME+"' [CLIENTNAMEOLD],0 [ARFEE],0 [APFEE],[CORPID],'' [CTNALL],0[GOODSTHICKNESS],0[GOODSWIDTH] ");
|
|
|
strSqlWI.Append(" ,0[GOODSLENGTH],0[GOODSSLICE],''[GOODSGRADE],''[STACKLOCATION] ");
|
|
|
strSqlWI.Append(" ,"+head.GOODSPACKPFSL+" [GOODSPACKACTUAL],"+head.GOODSPFSL+" [GOODSRKSLACTUAL],[ISCHANGE] ");
|
|
|
strSqlWI.Append(" ,0 [MARKETVALUE],0 [BANKVALUE],0[LINENUM] FROM [wms] where gid='"+WMSGID+"'");
|
|
|
|
|
|
Database db2 = DatabaseFactory.CreateDatabase();
|
|
|
_count = db2.ExecuteNonQuery(CommandType.Text, strSqlWI.ToString());
|
|
|
}
|
|
|
|
|
|
var result = new Resultmb();
|
|
|
result.Success = true;
|
|
|
result.Message = "生成WMS成功";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 给一个入库单修改开始计费日期
|
|
|
static public int SetNewWMSBillingDate(string WMSGID, string WMSDATE, string STARTBILLINGDATE, string STARTBILLINGDATEAP, string USERID, string USERNAME)
|
|
|
{
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var _r = 0;
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"UPDATE WMS SET WMSDATE='" + WMSDATE
|
|
|
+ "',STARTBILLINGDATE='" + STARTBILLINGDATE
|
|
|
+ "',STARTBILLINGDATEAP='" + STARTBILLINGDATEAP + "' WHERE GID=@GID ");
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdUpdate, "@GID", DbType.String, WMSGID);
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
catch {
|
|
|
_r++;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
conn.Close();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//将其下属的出库单明细内的开始计费日期也修改掉
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"UPDATE WMS_OUT_DETAIL SET OLDCUSTFEEDATE='" + STARTBILLINGDATE
|
|
|
+ "',STARTBILLINGDATE='" + STARTBILLINGDATE
|
|
|
+ "',STARTBILLINGDATEAP='" + STARTBILLINGDATEAP + "' WHERE INBSNO=@INBSNO ");
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdUpdate, "@INBSNO", DbType.String, WMSGID);
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
catch {
|
|
|
_r++;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
conn.Close();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return _r;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
static public SetFeeresult SetFee(SqlTransaction sqlTran, string strSTARTBILLINGDATE, string strOLDCUSTFEEDATE, string strINBSNO
|
|
|
, string strCUSTOMERNAME, Decimal outnums, string strASSOCIATEDNO, int strFEETYPE
|
|
|
, string strUserID, string strShowName, string sBillno, bool ck_jsfee, bool isKuCun)
|
|
|
{
|
|
|
|
|
|
string getstr = getWmsRate(sqlTran, strSTARTBILLINGDATE, strOLDCUSTFEEDATE, strINBSNO
|
|
|
, strCUSTOMERNAME, outnums, strASSOCIATEDNO, strFEETYPE
|
|
|
, strUserID, strShowName, sBillno, ck_jsfee, isKuCun);
|
|
|
string[] strls = getstr.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
//sqlTran.Commit();
|
|
|
SetFeeresult sf = new SetFeeresult();
|
|
|
sf.sumfee = strls[0].ToString();
|
|
|
sf.feedays = strls[1].ToString();
|
|
|
return sf;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 计算仓储费
|
|
|
/// <summary>
|
|
|
/// 计算仓储费
|
|
|
/// </summary>
|
|
|
/// <param name="sqlTran">事务</param>
|
|
|
/// <param name="strSTARTBILLINGDATE">开始计费日期</param>
|
|
|
/// <param name="strOLDCUSTFEEDATE">上家承担仓储期限</param>
|
|
|
/// <param name="strINBSNO">出库明细关联的入库单wms或wms_in的BSNO</param>
|
|
|
/// <param name="strCUSTOMERNAME">出库主表的客户名称</param>
|
|
|
/// <param name="outnums">出库量</param>
|
|
|
/// <param name="strASSOCIATEDNO">关联wms_out_detail的GID</param>
|
|
|
/// <param name="strFEETYPE">区别费用收、付类型</param>
|
|
|
/// <param name="strUserID">登陆用户GID</param>
|
|
|
/// <param name="strShowName">登陆用户名</param>
|
|
|
/// <param name="sBillno">出库单号或其他单据号</param>
|
|
|
/// <param name="ck_jsfee">是否计算仓储费</param>
|
|
|
/// <returns></returns>
|
|
|
static public String getWmsRate(SqlTransaction sqlTran, string strSTARTBILLINGDATE, string strOLDCUSTFEEDATE, string strINBSNO, string strCUSTOMERNAME,
|
|
|
Decimal outnums, string strASSOCIATEDNO, int strFEETYPE, string strUserID, string strShowName, string sBillno, bool ck_jsfee, bool isKuCun)
|
|
|
{
|
|
|
string sR = "";
|
|
|
int iState = 0;
|
|
|
int result = 0;
|
|
|
string Sqlstr = "";
|
|
|
|
|
|
#region 计算仓储费
|
|
|
WmsOutDetailDA WmsOutDetailDA = new EntityDA.WmsOutDetailDA();
|
|
|
IList<WmsRateDetailEntity> tempWmsRateDetailEntities = new List<WmsRateDetailEntity>();
|
|
|
int totalfeedays = 0;//总计费区间仓储天数
|
|
|
int feedays = 0;//区间仓储数
|
|
|
int prescale = 0;//总计费区间仓储数
|
|
|
int feeMonth = 0;//区间仓储月数
|
|
|
Decimal sumfee = 0;//总仓储费
|
|
|
string strSTARTBILLINGDATE2 = strSTARTBILLINGDATE;//按区间计费的开始计费日期
|
|
|
|
|
|
#region 删除费率出库明细表的区间仓储费
|
|
|
Sqlstr = "delete from wms_rate_detail where ASSOCIATEDNO = '" + strASSOCIATEDNO.Trim() + "' and FEETYPE=" + strFEETYPE;
|
|
|
iState = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (iState < 0)
|
|
|
{
|
|
|
sqlTran.Rollback();
|
|
|
result = -9;
|
|
|
//Clearh();
|
|
|
return result.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
if (ck_jsfee)//是否计算仓储费
|
|
|
{
|
|
|
#region 如果入库有免仓储期,则出库时插入费率出库明细表
|
|
|
//按仓储费率计算仓储费
|
|
|
Sqlstr = "SELECT top 1 * FROM wms where GID='" + strINBSNO + "' or gid in (select ASSOCIATEDNO from wms_in where gid='" + strINBSNO + "')";
|
|
|
DataSet dsrate = SqlHelper.ExecuteQueryDataset(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
if (dsrate.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
string sAP = dsrate.Tables[0].Rows[0]["FREESTORAGEPERIOD"].ToString().Trim();
|
|
|
if (strFEETYPE == 2)
|
|
|
{
|
|
|
sAP = dsrate.Tables[0].Rows[0]["FREESTORAGEPERIODAP"].ToString().Trim();
|
|
|
}
|
|
|
if (sAP != "0")
|
|
|
{
|
|
|
WmsRateDetailEntity model3 = new WmsRateDetailEntity();
|
|
|
model3.FEEPRICE = 0;
|
|
|
model3.GOODSPFSL = outnums;
|
|
|
model3.OUTFEE = 0;
|
|
|
model3.FEEUNIT = dsrate.Tables[0].Rows[0]["CHARGEUNIT"].ToString().Trim() + "天";
|
|
|
model3.STARTBILLINGDATE = DateTime.Parse(dsrate.Tables[0].Rows[0]["WMSDATE"].ToString().Trim());
|
|
|
DateTime dt = DateTime.Parse(dsrate.Tables[0].Rows[0]["STARTBILLINGDATE"].ToString().Trim()).AddDays(-1);
|
|
|
if (DateTime.Parse(strOLDCUSTFEEDATE) < dt)
|
|
|
{
|
|
|
dt = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
}
|
|
|
model3.ENDBILLINGDATE = dt;
|
|
|
model3.FEESCALE = int.Parse(WmsOutDetailDA.GetDaysCount("day", model3.STARTBILLINGDATE.ToString().Trim(), dt.ToString().Trim()).ToString());
|
|
|
model3.FEEGRADE = 0;
|
|
|
model3.REMARK = "";
|
|
|
model3.CREATEUSER = strUserID;
|
|
|
model3.MODIFIEDUSER = strUserID;
|
|
|
model3.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model3.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model3.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model3);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
feedays = WmsOutDetailDA.GetDaysCount("day", strSTARTBILLINGDATE, strOLDCUSTFEEDATE.Trim());//WmsOutEntity.DODATE.ToString() 出库-开始计费日期+1
|
|
|
if (feedays > 0)
|
|
|
{
|
|
|
totalfeedays = feedays;
|
|
|
//按仓储费率计算仓储费
|
|
|
Sqlstr = "SELECT GID,FEEGRADE,FEETYPE,FEESCALE,FEEPRICE,ADDPRICE,FEEUNIT,convert(char(10),ENDBILLINGDATE,20) AS ENDBILLINGDATE,REMARK,CREATEUSER,CREATETIME,BSNO,CAPPRICE FROM wms_rate where (BSNO='" + strINBSNO + "' or BSNO in (select ASSOCIATEDNO from wms_in where gid='" + strINBSNO + "')) and FEETYPE=" + strFEETYPE + " order by FEEGRADE ";
|
|
|
dsrate = SqlHelper.ExecuteQueryDataset(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
if (dsrate.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
int nowscale = 0;//区间计费区间(仓储月数/天数)
|
|
|
Decimal price = 0;//计费单价
|
|
|
Decimal gradefee = 0;//区间仓储费
|
|
|
int nowgrade = 1;
|
|
|
|
|
|
for (int i = 0; i < dsrate.Tables[0].Rows.Count; i++)
|
|
|
{
|
|
|
if (isKuCun)
|
|
|
{
|
|
|
if (DateTime.Parse(strSTARTBILLINGDATE) > DateTime.Parse(dsrate.Tables[0].Rows[i]["ENDBILLINGDATE"].ToString()))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
WmsRateDetailEntity model = new WmsRateDetailEntity();
|
|
|
//nowgrade = int.Parse(dsrate.Tables[0].Rows[i]["FEEGRADE"].ToString());//计费等级
|
|
|
nowscale = int.Parse(dsrate.Tables[0].Rows[i]["FEESCALE"].ToString());//计费区间
|
|
|
price = Decimal.Parse(dsrate.Tables[0].Rows[i]["FEEPRICE"].ToString());//计费单价
|
|
|
Decimal ADDPRICE = Decimal.Parse(dsrate.Tables[0].Rows[i]["ADDPRICE"].ToString());//增值价
|
|
|
Decimal CAPPRICE = Decimal.Parse(dsrate.Tables[0].Rows[i]["CAPPRICE"].ToString());//
|
|
|
string FEEUNIT = dsrate.Tables[0].Rows[i]["FEEUNIT"].ToString();//计费单位
|
|
|
string ENDBILLINGDATE = dsrate.Tables[0].Rows[i]["ENDBILLINGDATE"].ToString();//结束计费日期
|
|
|
//计算区间是按天或按月
|
|
|
string DorM = "day";
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
DorM = "month";
|
|
|
}
|
|
|
#region 按区间计算仓储费
|
|
|
feedays = WmsOutDetailDA.GetDaysCount(DorM, strSTARTBILLINGDATE2, strOLDCUSTFEEDATE.Trim());//总仓储月数
|
|
|
if (feedays > nowscale) //总仓储月数/天数 > 计费区间
|
|
|
{
|
|
|
feeMonth = WmsOutDetailDA.GetDaysCount(DorM, strSTARTBILLINGDATE2, ENDBILLINGDATE.Trim());//i区间仓储月数
|
|
|
if (feeMonth > nowscale)//i区间仓储月数 > 区间计费区间(仓储月数/天数)
|
|
|
{
|
|
|
int sjMonth = 0;//实际仓储月数
|
|
|
int sjMonth2 = 0;//实际仓储月数,如果是最后一条的判断数
|
|
|
if (feedays > feeMonth)//总仓储月数 > i区间仓储月数
|
|
|
{
|
|
|
sjMonth = nowscale;// feeMonth;// (feeMonth - nowscale);//实际仓储月数
|
|
|
sjMonth2 = feeMonth;//实际仓储月数,如果是最后一条的判断数
|
|
|
if ((i + 1) == dsrate.Tables[0].Rows.Count)//即最后一条时,以后的时间都按最后一条取值
|
|
|
{
|
|
|
if (ADDPRICE <= 0)//增值价>0,则求增值费率
|
|
|
{
|
|
|
sjMonth = feedays;//(feedays - nowscale);//实际仓储月数
|
|
|
ENDBILLINGDATE = strOLDCUSTFEEDATE;
|
|
|
}
|
|
|
sjMonth2 = feedays;// (feedays - nowscale);//实际仓储月数
|
|
|
}
|
|
|
}
|
|
|
else//总仓储月数 <= i区间仓储月数
|
|
|
{
|
|
|
sjMonth = feedays;//(feedays - nowscale);//实际仓储月数
|
|
|
sjMonth2 = nowscale;//(feedays - nowscale);//实际仓储月数
|
|
|
ENDBILLINGDATE = strOLDCUSTFEEDATE;
|
|
|
}
|
|
|
//
|
|
|
#region 增值价>0,则求增值费率
|
|
|
if (ADDPRICE > 0)//增值价>0,则求增值费率
|
|
|
{
|
|
|
//int idiv = (int)(sjMonth / nowscale);
|
|
|
//int imod = (int)(sjMonth % nowscale);
|
|
|
int idiv = (int)(sjMonth / nowscale);
|
|
|
int imod = (int)(sjMonth % nowscale);
|
|
|
Decimal dprice = price;//计费单价
|
|
|
for (int j = 0; j < idiv; j++)//循环求增值费率
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddDays(nowscale - 1);
|
|
|
int dtDays = sjMonth2;// nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddMonths(nowscale).AddDays(-1);
|
|
|
if (dtENDBILLINGDATE > DateTime.Parse(ENDBILLINGDATE))//strOLDCUSTFEEDATE
|
|
|
{
|
|
|
if ((i + 1) == dsrate.Tables[0].Rows.Count && dtENDBILLINGDATE > DateTime.Parse(strOLDCUSTFEEDATE))//即最后一条时,以后的时间都按最后一条取值
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);//strOLDCUSTFEEDATE
|
|
|
}
|
|
|
}
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
gradefee = outnums * dprice * dtDays;// nowscale;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//nowscale;//累计天数
|
|
|
//
|
|
|
WmsRateDetailEntity model1 = new WmsRateDetailEntity();
|
|
|
model1.FEEPRICE = dprice;
|
|
|
model1.GOODSPFSL = outnums;
|
|
|
model1.FEESCALE = dtDays;// nowscale;
|
|
|
model1.OUTFEE = gradefee;
|
|
|
model1.FEEUNIT = FEEUNIT2;
|
|
|
model1.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model1.ENDBILLINGDATE = dtENDBILLINGDATE;
|
|
|
//model1.ENDBILLINGDATE = model1.STARTBILLINGDATE.AddDays(nowscale - 1);
|
|
|
//if (FEEUNIT.IndexOf("月") > -1)
|
|
|
//{
|
|
|
// DateTime dt = model1.STARTBILLINGDATE.AddMonths(nowscale).AddDays(-1);
|
|
|
// model1.ENDBILLINGDATE = dt;
|
|
|
// if (dt > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
// {
|
|
|
// model1.ENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
// }
|
|
|
//}
|
|
|
model1.FEEGRADE = nowgrade;
|
|
|
model1.REMARK = "";
|
|
|
model1.CREATEUSER = strUserID;
|
|
|
model1.MODIFIEDUSER = strUserID;
|
|
|
model1.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model1.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model1.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model1);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
BasicDataRefDAL.获取仓储费递增后价格(ref dprice, ADDPRICE, CAPPRICE);
|
|
|
strSTARTBILLINGDATE2 = (model1.ENDBILLINGDATE.AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
//
|
|
|
if (imod > 0)//增值费率余数大于0,则实际仓储月份等于imod
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddDays(imod - 1);
|
|
|
int dtDays = imod;// nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddMonths(imod).AddDays(-1);
|
|
|
if (dtENDBILLINGDATE > DateTime.Parse(ENDBILLINGDATE))//strOLDCUSTFEEDATE
|
|
|
{
|
|
|
if ((i + 1) == dsrate.Tables[0].Rows.Count && dtENDBILLINGDATE > DateTime.Parse(strOLDCUSTFEEDATE))//即最后一条时,以后的时间都按最后一条取值
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);//strOLDCUSTFEEDATE
|
|
|
}
|
|
|
}
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
//dprice += ADDPRICE;
|
|
|
gradefee = outnums * dprice * dtDays;// imod;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//imod;//累计天数
|
|
|
//
|
|
|
model.FEEPRICE = dprice;
|
|
|
model.GOODSPFSL = outnums;
|
|
|
model.FEESCALE = dtDays;//imod;
|
|
|
model.OUTFEE = gradefee;
|
|
|
model.FEEUNIT = FEEUNIT2;
|
|
|
model.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model.ENDBILLINGDATE = dtENDBILLINGDATE;
|
|
|
//model.ENDBILLINGDATE = model.STARTBILLINGDATE.AddDays(imod - 1);
|
|
|
//if (FEEUNIT.IndexOf("月") > -1)
|
|
|
//{
|
|
|
// DateTime dt = model.STARTBILLINGDATE.AddMonths(imod).AddDays(-1);
|
|
|
// model.ENDBILLINGDATE = dt;
|
|
|
// if (dt > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
// {
|
|
|
// model.ENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
// }
|
|
|
//}
|
|
|
model.FEEGRADE = nowgrade;
|
|
|
model.REMARK = "";
|
|
|
model.CREATEUSER = strUserID;
|
|
|
model.MODIFIEDUSER = strUserID;
|
|
|
model.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
strSTARTBILLINGDATE2 = (model.ENDBILLINGDATE.AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);
|
|
|
int dtDays = sjMonth;// nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
gradefee = outnums * price * dtDays;// sjMonth;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//sjMonth;//累计天数
|
|
|
//
|
|
|
model.FEEPRICE = price;
|
|
|
model.GOODSPFSL = outnums;
|
|
|
model.FEESCALE = dtDays;//sjMonth;
|
|
|
model.OUTFEE = gradefee;
|
|
|
model.FEEUNIT = FEEUNIT2;
|
|
|
model.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model.ENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);
|
|
|
model.FEEGRADE = nowgrade;
|
|
|
model.REMARK = "";
|
|
|
model.CREATEUSER = strUserID;
|
|
|
model.MODIFIEDUSER = strUserID;
|
|
|
model.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
strSTARTBILLINGDATE2 = (DateTime.Parse(ENDBILLINGDATE).AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
#endregion
|
|
|
//结束费率区间的循环
|
|
|
if (feedays <= feeMonth)//总仓储月数 <= i区间仓储月数
|
|
|
{
|
|
|
break;//结束费率区间的循环
|
|
|
}
|
|
|
}
|
|
|
else//i区间仓储月数 <= 区间计费区间(仓储月数/天数)
|
|
|
{
|
|
|
int sjMonth = 0;//实际仓储月数
|
|
|
int sjMonth2 = 0;//实际仓储月数,如果是最后一条的判断数
|
|
|
if (feedays > feeMonth)//总仓储月数 > i区间仓储月数
|
|
|
{
|
|
|
sjMonth = feeMonth;//实际仓储月数
|
|
|
sjMonth2 = feeMonth;//实际仓储月数,如果是最后一条的判断数
|
|
|
if ((i + 1) == dsrate.Tables[0].Rows.Count)//即最后一条时,以后的时间都按最后一条取值
|
|
|
{
|
|
|
if (ADDPRICE <= 0)//增值价>0,则求增值费率
|
|
|
{
|
|
|
sjMonth = feedays;// (feedays - nowscale);//实际仓储月数
|
|
|
ENDBILLINGDATE = strOLDCUSTFEEDATE;
|
|
|
}
|
|
|
sjMonth2 = feedays;// (feedays - nowscale);//实际仓储月数,如果是最后一条的判断数
|
|
|
}
|
|
|
}
|
|
|
else//总仓储月数 <= i区间仓储月数
|
|
|
{
|
|
|
sjMonth = feedays;//(feedays - nowscale);//实际仓储月数
|
|
|
ENDBILLINGDATE = strOLDCUSTFEEDATE;
|
|
|
}
|
|
|
//
|
|
|
#region 增值价>0,则求增值费率
|
|
|
if (ADDPRICE > 0)//增值价>0,则求增值费率
|
|
|
{
|
|
|
//int idiv = (int)(sjMonth / nowscale);
|
|
|
//int imod = (int)(sjMonth % nowscale);
|
|
|
int idiv = (int)(sjMonth2 / nowscale);
|
|
|
int imod = (int)(sjMonth2 % nowscale);
|
|
|
Decimal dprice = price;//计费单价
|
|
|
for (int j = 0; j < idiv; j++)//循环求增值费率
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddDays(nowscale - 1);
|
|
|
int dtDays = sjMonth;// nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddMonths(nowscale).AddDays(-1);
|
|
|
if (dtENDBILLINGDATE > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
}
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
gradefee = outnums * dprice * dtDays;// nowscale;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//nowscale;//累计天数
|
|
|
//
|
|
|
WmsRateDetailEntity model1 = new WmsRateDetailEntity();
|
|
|
model1.FEEPRICE = dprice;
|
|
|
model1.GOODSPFSL = outnums;
|
|
|
model1.FEESCALE = dtDays;//nowscale;
|
|
|
model1.OUTFEE = gradefee;
|
|
|
model1.FEEUNIT = FEEUNIT2;
|
|
|
model1.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model1.ENDBILLINGDATE = dtENDBILLINGDATE;
|
|
|
//model1.ENDBILLINGDATE = model1.STARTBILLINGDATE.AddDays(nowscale - 1);
|
|
|
//if (FEEUNIT.IndexOf("月") > -1)
|
|
|
//{
|
|
|
// DateTime dt = model1.STARTBILLINGDATE.AddMonths(nowscale).AddDays(-1);
|
|
|
// model1.ENDBILLINGDATE = dt;
|
|
|
// if (dt > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
// {
|
|
|
// model1.ENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
// }
|
|
|
//}
|
|
|
model1.FEEGRADE = nowgrade;
|
|
|
model1.REMARK = "";
|
|
|
model1.CREATEUSER = strUserID;
|
|
|
model1.MODIFIEDUSER = strUserID;
|
|
|
model1.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model1.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model1.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model1);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
BasicDataRefDAL.获取仓储费递增后价格(ref dprice, ADDPRICE, CAPPRICE);
|
|
|
strSTARTBILLINGDATE2 = (model1.ENDBILLINGDATE.AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
//
|
|
|
if (imod > 0)//增值费率余数大于0,则实际仓储月份等于imod
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddDays(imod - 1);
|
|
|
int dtDays = imod;// nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
dtENDBILLINGDATE = dtSTARTBILLINGDATE.AddMonths(imod).AddDays(-1);
|
|
|
if (dtENDBILLINGDATE > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
{
|
|
|
dtENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
}
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
//dprice += ADDPRICE;
|
|
|
gradefee = outnums * dprice * dtDays;// imod;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//imod;//累计天数
|
|
|
//
|
|
|
model.FEEPRICE = dprice;
|
|
|
model.GOODSPFSL = outnums;
|
|
|
model.FEESCALE = dtDays;//imod;
|
|
|
model.OUTFEE = gradefee;
|
|
|
model.FEEUNIT = FEEUNIT2;
|
|
|
model.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model.ENDBILLINGDATE = dtENDBILLINGDATE;
|
|
|
//model.ENDBILLINGDATE = model.STARTBILLINGDATE.AddDays(imod - 1);
|
|
|
//if (FEEUNIT.IndexOf("月") > -1)
|
|
|
//{
|
|
|
// DateTime dt = model.STARTBILLINGDATE.AddMonths(imod).AddDays(-1);
|
|
|
// model.ENDBILLINGDATE = dt;
|
|
|
// if (dt > DateTime.Parse(strOLDCUSTFEEDATE))
|
|
|
// {
|
|
|
// model.ENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
// }
|
|
|
//}
|
|
|
model.FEEGRADE = nowgrade;
|
|
|
model.REMARK = "";
|
|
|
model.CREATEUSER = strUserID;
|
|
|
model.MODIFIEDUSER = strUserID;
|
|
|
model.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
strSTARTBILLINGDATE2 = (model.ENDBILLINGDATE.AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);
|
|
|
int dtDays = sjMonth;//nowscale;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
gradefee = outnums * price * dtDays;//sjMonth;//出库量*计费单价*实际仓储月数
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//sjMonth;//累计天数
|
|
|
//
|
|
|
model.FEEPRICE = price;
|
|
|
model.GOODSPFSL = outnums;
|
|
|
model.FEESCALE = dtDays;//sjMonth;
|
|
|
model.OUTFEE = gradefee;
|
|
|
model.FEEUNIT = FEEUNIT2;
|
|
|
model.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model.ENDBILLINGDATE = DateTime.Parse(ENDBILLINGDATE);
|
|
|
model.FEEGRADE = nowgrade;
|
|
|
model.REMARK = "";
|
|
|
model.CREATEUSER = strUserID;
|
|
|
model.MODIFIEDUSER = strUserID;
|
|
|
model.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
strSTARTBILLINGDATE2 = (DateTime.Parse(ENDBILLINGDATE).AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
}
|
|
|
#endregion
|
|
|
//结束费率区间的循环
|
|
|
if (feedays <= feeMonth)//总仓储月数 <= i区间仓储月数
|
|
|
{
|
|
|
break;//结束费率区间的循环
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else//总仓储天数 <= 计费区间天数
|
|
|
{
|
|
|
//--- BEGIN --- 如果是月则计算开始和结束日期之间的天数
|
|
|
DateTime dtSTARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
DateTime dtENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
int dtDays = feedays;
|
|
|
|
|
|
string FEEUNIT2 = FEEUNIT;
|
|
|
if (FEEUNIT.IndexOf("月") > -1)
|
|
|
{
|
|
|
FEEUNIT2 = FEEUNIT.Trim().Substring(0, 1) + "天";
|
|
|
dtDays = WmsOutDetailDA.GetDaysCount("day", dtSTARTBILLINGDATE.ToString().Trim(), dtENDBILLINGDATE.ToString().Trim());//按月的区间天数
|
|
|
}
|
|
|
//--- END ---
|
|
|
|
|
|
gradefee = outnums * price * dtDays;//feedays;//出库量*计费单价*仓储区间(//仓储天数-上一个计费区间(0))
|
|
|
sumfee += gradefee;
|
|
|
prescale += dtDays;//feedays;//累计天数
|
|
|
//
|
|
|
model.FEEPRICE = price;
|
|
|
model.GOODSPFSL = outnums;
|
|
|
model.FEESCALE = dtDays;//feedays;
|
|
|
model.OUTFEE = gradefee;
|
|
|
model.FEEUNIT = FEEUNIT2;
|
|
|
model.STARTBILLINGDATE = DateTime.Parse(strSTARTBILLINGDATE2);
|
|
|
model.ENDBILLINGDATE = DateTime.Parse(strOLDCUSTFEEDATE);
|
|
|
model.FEEGRADE = nowgrade;
|
|
|
model.REMARK = "";
|
|
|
model.CREATEUSER = strUserID;
|
|
|
model.MODIFIEDUSER = strUserID;
|
|
|
model.ASSOCIATEDNO = strASSOCIATEDNO;
|
|
|
model.CUSTOMERNAME = strCUSTOMERNAME;
|
|
|
model.FEETYPE = strFEETYPE;
|
|
|
tempWmsRateDetailEntities.Add(model);
|
|
|
//
|
|
|
nowgrade++;
|
|
|
strSTARTBILLINGDATE2 = (DateTime.Parse(strOLDCUSTFEEDATE).AddDays(1)).ToString();//按区间计费的开始计费日期
|
|
|
break;//结束费率区间的循环
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//仓储费率没有设定
|
|
|
//sqlTran.Rollback();
|
|
|
//result = -2;
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", "<script>alert('仓储费率没有设置');</script>");
|
|
|
//Clearh();
|
|
|
//return result;
|
|
|
|
|
|
totalfeedays = 0;
|
|
|
feedays = 0;
|
|
|
sumfee = 0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
totalfeedays = 0;
|
|
|
feedays = 0;
|
|
|
sumfee = 0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
totalfeedays = 0;
|
|
|
feedays = 0;
|
|
|
sumfee = 0;
|
|
|
}
|
|
|
//
|
|
|
#region 按区间计算仓储费,插入费率出库明细表
|
|
|
if (tempWmsRateDetailEntities != null)//是否有要入库的仓储费
|
|
|
{
|
|
|
if (tempWmsRateDetailEntities.Count > 0)
|
|
|
{
|
|
|
foreach (WmsRateDetailEntity model2 in tempWmsRateDetailEntities)
|
|
|
{
|
|
|
Sqlstr = String.Format("insert into wms_rate_detail(GID,FEEPRICE,GOODSPFSL,OUTFEE,REMARK,CREATEUSER,CREATETIME,ASSOCIATEDNO,CUSTOMERNAME,FEETYPE,FEEGRADE,STARTBILLINGDATE,ENDBILLINGDATE,FEESCALE,FEEUNIT,MODIFIEDUSER)"
|
|
|
+ " values(newid(),'{0}','{1}','{2}','{3}','{4}',getdate(),'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')"
|
|
|
, model2.FEEPRICE, model2.GOODSPFSL, model2.OUTFEE, model2.REMARK, model2.CREATEUSER, model2.ASSOCIATEDNO, model2.CUSTOMERNAME, model2.FEETYPE, model2.FEEGRADE, model2.STARTBILLINGDATE, model2.ENDBILLINGDATE, model2.FEESCALE, model2.FEEUNIT, model2.MODIFIEDUSER);
|
|
|
iState = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (iState != 1)
|
|
|
{
|
|
|
sqlTran.Rollback();
|
|
|
result = -1;
|
|
|
//Clearh();
|
|
|
return result.ToString();
|
|
|
}
|
|
|
//
|
|
|
string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('添加出库明细的费率明细信息','INSERT 插入操作','" + strShowName + " 添加 费率明细信息 出库单号:" + sBillno.Trim() + "','" + model2.MODIFIEDUSER.ToString() + "')";
|
|
|
iState = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, str0, null);
|
|
|
if (iState != 1)
|
|
|
{
|
|
|
sqlTran.Rollback();
|
|
|
result = -1;
|
|
|
//Clearh();
|
|
|
return result.ToString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
tempWmsRateDetailEntities = null;
|
|
|
totalfeedays = 0;
|
|
|
feedays = 0;
|
|
|
sumfee = 0;
|
|
|
}
|
|
|
#endregion
|
|
|
sR = sumfee.ToString() + "," + totalfeedays.ToString();
|
|
|
return sR;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 出入库明细表
|
|
|
|
|
|
static public List<WMSDetailmb> GetDetailList (int start, int limit, string strCondition, string sort,out int recordcount)
|
|
|
{ //库存信息
|
|
|
//var strSql = new StringBuilder();
|
|
|
//strSql.Append(" select v.* from VW_WMS_DETAIL V WITH(NOLOCK)");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
|
PagedQuaryParam pp = new PagedQuaryParam();
|
|
|
|
|
|
pp.strSql = $" select v.* from VW_WMS_DETAIL V WITH(NOLOCK) where 1=1 ";
|
|
|
pp.start = start;
|
|
|
pp.limit = limit;
|
|
|
pp.strCondition = strCondition;
|
|
|
pp.defaultsortstr = "CUSTNO";
|
|
|
pp.sortstring = sortstring;
|
|
|
|
|
|
var strSql = PagedQuaryStr(pp);
|
|
|
|
|
|
recordcount = PagedCount(pp);
|
|
|
//if (!string.IsNullOrEmpty(strCondition))
|
|
|
//{
|
|
|
// strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
//}
|
|
|
//var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
//if (!string.IsNullOrEmpty(sortstring))
|
|
|
//{
|
|
|
// strSql.Append(" order by " + sortstring);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql.Append(" order by v.MODIFIEDTIME ");
|
|
|
//}
|
|
|
return SetDetailData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<WMSDetailmb> SetDetailData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSDetailmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DataSet ds = db.ExecuteDataSet(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
var tb = ds.Tables[0];
|
|
|
|
|
|
foreach (DataRow row in tb.Rows) {
|
|
|
WMSDetailmb data = new WMSDetailmb();
|
|
|
|
|
|
data.NID = Convert.ToString(row["NID"]);
|
|
|
data.BLNO = Convert.ToString(row["BLNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(row["CUSTOMNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(row["CUSTOMERNAME"]);
|
|
|
data.STORAGENAME = Convert.ToString(row["STORAGENAME"]);
|
|
|
data.GOODSNAME = Convert.ToString(row["GOODSNAME"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(row["GOODSSTANDARD"]);
|
|
|
data.GOODSMODEL = Convert.ToString(row["GOODSMODEL"]);
|
|
|
data.WMSNO = Convert.ToString(row["WMSNO"]);
|
|
|
data.OUTBSNO_OUT = Convert.ToString(row["OUTBSNO_OUT"]);
|
|
|
data.BSNO_OUT = Convert.ToString(row["BSNO_OUT"]);
|
|
|
data.WMSDATE = Convert.ToString(row["WMSDATE"]);
|
|
|
|
|
|
if (row["DODATE_OUT"] != DBNull.Value)
|
|
|
data.DODATE_OUT = Convert.ToDateTime(row["DODATE_OUT"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
// data.DODATE_OUT = Convert.ToString(row["DODATE_OUT"]);
|
|
|
data.GOODSRKSL = Convert.ToString(row["GOODSRKSL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(row["GOODSRKSLACTUAL"]);
|
|
|
data.GOODSPFSL_OUT = Convert.ToString(row["GOODSPFSL_OUT"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(row["GOODSSTOCK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(row["CHARGEUNIT"]);
|
|
|
data.GOODSOUTFEE_OUT = Convert.ToString(row["GOODSOUTFEE_OUT"]);
|
|
|
data.GOODSOUTFEEAP_OUT = Convert.ToString(row["GOODSOUTFEEAP_OUT"]);
|
|
|
data.ARFEE = Convert.ToString(row["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(row["APFEE"]);
|
|
|
data.ARFEE_OUT = Convert.ToString(row["ARFEE_OUT"]);
|
|
|
data.APFEE_OUT = Convert.ToString(row["APFEE_OUT"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(row["FREESTORAGEPERIOD"]);
|
|
|
data.CONTRACTNO = Convert.ToString(row["CONTRACTNO"]);
|
|
|
data.GOODSPACK = Convert.ToString(row["GOODSPACK"]);
|
|
|
data.GOODSPACKSTOCK = Convert.ToString(row["GOODSPACKSTOCK"]);
|
|
|
data.GOODSPACKPFSL_OUT = Convert.ToString(row["GOODSPACKPFSL_OUT"]);
|
|
|
data.TRUCKNO_OUT = Convert.ToString(row["TRUCKNO_OUT"]);
|
|
|
data.REMARK_OUT = Convert.ToString(row["REMARK_OUT"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(row["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(row["MODIFIEDTIME"]);
|
|
|
data.CREATEUSER_OUT = Convert.ToString(row["CREATEUSER_OUT"]);
|
|
|
data.CREATETIME_OUT = Convert.ToString(row["CREATETIME_OUT"]);
|
|
|
data.CNTRNO = Convert.ToString(row["CNTRNO"]);
|
|
|
data.PICIHAO = Convert.ToString(row["PICIHAO"]);
|
|
|
|
|
|
|
|
|
//字段过滤器(判断是否存在该列)
|
|
|
if (tb.Columns.Contains("AREACODE_OUT")) data.AREACODE_OUT = row["AREACODE_OUT"].ToString();
|
|
|
|
|
|
if (tb.Columns.Contains("Productiondate")) data.PRODDATE = row["Productiondate"].ToString();
|
|
|
|
|
|
if (tb.Columns.Contains("FACTORYNO")) data.FACTORYNO = Convert.ToString(row["FACTORYNO"]);
|
|
|
if (tb.Columns.Contains("WMSINGID")) data.WMSINGID = Convert.ToString(row["WMSINGID"]);
|
|
|
data.WMSINREMARK = Convert.ToString(row["WMSINREMARK"]);
|
|
|
|
|
|
data.AREANAME = Convert.ToString(row["AREANAME"]);
|
|
|
data.TRAYNO = Convert.ToString(row["TRAYNO"]);
|
|
|
|
|
|
|
|
|
if (tb.Columns.Contains("COUNTRYOFORIGIN")) data.COUNTRYOFORIGIN = Convert.ToString(row["COUNTRYOFORIGIN"]);
|
|
|
if (tb.Columns.Contains("INVOICENO")) data.INVOICENO = Convert.ToString(row["INVOICENO"]);
|
|
|
if (tb.Columns.Contains("KINDPKGS")) data.KINDPKGS = Convert.ToString(row["KINDPKGS"]);
|
|
|
if (tb.Columns.Contains("BZTCHNO_WMSIN")) data.BZTCHNO_WMSIN = Convert.ToString(row["BZTCHNO_WMSIN"]);
|
|
|
if (tb.Columns.Contains("AREACODE")) data.AREACODE = Convert.ToString(row["AREACODE"]);
|
|
|
|
|
|
////20200326 星洲港 看明细重量 件数
|
|
|
if (tb.Columns.Contains("GOODSKGS")) data.GOODSKGS = Convert.ToString(row["GOODSKGS"]);
|
|
|
if (tb.Columns.Contains("GOODSPACK_INDETAIL")) data.GOODSPACK_INDETAIL = Convert.ToString(row["GOODSPACK_INDETAIL"]);
|
|
|
if (tb.Columns.Contains("GOODSRKSL_INDETAIL")) data.GOODSRKSL_INDETAIL = Convert.ToString(row["GOODSRKSL_INDETAIL"]);
|
|
|
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
//{
|
|
|
// while (reader.Read())
|
|
|
// {
|
|
|
// WMSDetailmb data = new WMSDetailmb();
|
|
|
// #region Set DB data to Object
|
|
|
// data.NID = Convert.ToString(reader["NID"]);
|
|
|
// data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
// data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
// data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
// data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
// data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
// data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
// data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
// data.WMSNO = Convert.ToString(reader["WMSNO"]);
|
|
|
// data.OUTBSNO_OUT = Convert.ToString(reader["OUTBSNO_OUT"]);
|
|
|
// data.BSNO_OUT = Convert.ToString(reader["BSNO_OUT"]);
|
|
|
// data.WMSDATE = Convert.ToString(reader["WMSDATE"]);
|
|
|
|
|
|
|
|
|
// if (reader["DODATE_OUT"] != DBNull.Value)
|
|
|
// data.DODATE_OUT = Convert.ToDateTime(reader["DODATE_OUT"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
// // data.DODATE_OUT = Convert.ToString(reader["DODATE_OUT"]);
|
|
|
// data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
// data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
// data.GOODSPFSL_OUT = Convert.ToString(reader["GOODSPFSL_OUT"]);
|
|
|
// data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
// data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
// data.GOODSOUTFEE_OUT = Convert.ToString(reader["GOODSOUTFEE_OUT"]);
|
|
|
// data.GOODSOUTFEEAP_OUT = Convert.ToString(reader["GOODSOUTFEEAP_OUT"]);
|
|
|
// data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
// data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
// data.ARFEE_OUT = Convert.ToString(reader["ARFEE_OUT"]);
|
|
|
// data.APFEE_OUT = Convert.ToString(reader["APFEE_OUT"]);
|
|
|
// data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
// data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
// data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
// data.GOODSPACKSTOCK = Convert.ToString(reader["GOODSPACKSTOCK"]);
|
|
|
// data.GOODSPACKPFSL_OUT = Convert.ToString(reader["GOODSPACKPFSL_OUT"]);
|
|
|
// data.TRUCKNO_OUT = Convert.ToString(reader["TRUCKNO_OUT"]);
|
|
|
// data.REMARK_OUT = Convert.ToString(reader["REMARK_OUT"]);
|
|
|
// data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
// data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
// data.CREATEUSER_OUT = Convert.ToString(reader["CREATEUSER_OUT"]);
|
|
|
// data.CREATETIME_OUT = Convert.ToString(reader["CREATETIME_OUT"]);
|
|
|
// data.CNTRNO = Convert.ToString(reader["CNTRNO"]);
|
|
|
// data.PICIHAO = Convert.ToString(reader["PICIHAO"]);
|
|
|
|
|
|
|
|
|
// //字段过滤器(判断是否存在该列)
|
|
|
// reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'AREACODE_OUT'";
|
|
|
// if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
// data.AREACODE_OUT = Convert.ToString(reader["AREACODE_OUT"]);
|
|
|
// reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'Productiondate'";
|
|
|
// if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
// data.PRODDATE = Convert.ToString(reader["Productiondate"]);
|
|
|
// reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'FACTORYNO'";
|
|
|
// if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
// data.FACTORYNO = Convert.ToString(reader["FACTORYNO"]);
|
|
|
// reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'WMSINGID'";
|
|
|
// if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
// data.WMSINGID = Convert.ToString(reader["WMSINGID"]);
|
|
|
// data.WMSINREMARK = Convert.ToString(reader["WMSINREMARK"]);
|
|
|
// //data.BUZTYPEREF = Convert.ToString(reader["BUZTYPEREF"]);
|
|
|
// //data.PORTREF = Convert.ToString(reader["PORTREF"]);
|
|
|
// //data.IMPORTCOUNTRY = Convert.ToString(reader["IMPORTCOUNTRY"]);
|
|
|
// //data.COMPANYNAME = Convert.ToString(reader["COMPANYNAME"]);
|
|
|
// data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
// data.TRAYNO = Convert.ToString(reader["TRAYNO"]);
|
|
|
|
|
|
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "COUNTRYOFORIGIN"))
|
|
|
// data.COUNTRYOFORIGIN = Convert.ToString(reader["COUNTRYOFORIGIN"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "INVOICENO"))
|
|
|
// data.INVOICENO = Convert.ToString(reader["INVOICENO"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "KINDPKGS"))
|
|
|
// data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "BZTCHNO_WMSIN"))
|
|
|
// data.BZTCHNO_WMSIN = Convert.ToString(reader["BZTCHNO_WMSIN"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "AREACODE"))
|
|
|
// data.AREACODE = Convert.ToString(reader["AREACODE"]);
|
|
|
|
|
|
// ////20200326 星洲港 看明细重量 件数
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "GOODSKGS"))
|
|
|
// data.GOODSKGS = Convert.ToString(reader["GOODSKGS"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "GOODSPACK_INDETAIL"))
|
|
|
// data.GOODSPACK_INDETAIL = Convert.ToString(reader["GOODSPACK_INDETAIL"]);
|
|
|
// if (BasicDataRefDAL.ReadFieldExist(reader, "GOODSRKSL_INDETAIL"))
|
|
|
// data.GOODSRKSL_INDETAIL = Convert.ToString(reader["GOODSRKSL_INDETAIL"]);
|
|
|
|
|
|
// #endregion
|
|
|
// headList.Add(data);
|
|
|
// }
|
|
|
// reader.Close();
|
|
|
//}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
private static List<WMSDetaillmb_XPW> SetXPWDetailData ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<WMSDetaillmb_XPW>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSDetaillmb_XPW data = new WMSDetaillmb_XPW();
|
|
|
#region Set DB data to Object
|
|
|
data.NID = Convert.ToString(reader["NID"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.WMSNO = Convert.ToString(reader["WMSNO"]);
|
|
|
data.OUTBSNO_OUT = Convert.ToString(reader["OUTBSNO_OUT"]);
|
|
|
data.BSNO_OUT = Convert.ToString(reader["BSNO_OUT"]);
|
|
|
data.WMSDATE = Convert.ToString(reader["WMSDATE"]);
|
|
|
if (reader["DODATE_OUT"] != DBNull.Value)
|
|
|
data.DODATE_OUT = Convert.ToDateTime(reader["DODATE_OUT"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
// data.DODATE_OUT = Convert.ToString(reader["DODATE_OUT"]);
|
|
|
data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
data.GOODSPFSL_OUT = Convert.ToString(reader["GOODSPFSL_OUT"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSOUTFEE_OUT = Convert.ToString(reader["GOODSOUTFEE_OUT"]);
|
|
|
data.GOODSOUTFEEAP_OUT = Convert.ToString(reader["GOODSOUTFEEAP_OUT"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.ARFEE_OUT = Convert.ToString(reader["ARFEE_OUT"]);
|
|
|
data.APFEE_OUT = Convert.ToString(reader["APFEE_OUT"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.GOODSPACKSTOCK = Convert.ToString(reader["GOODSPACKSTOCK"]);
|
|
|
data.GOODSPACKPFSL_OUT = Convert.ToString(reader["GOODSPACKPFSL_OUT"]);
|
|
|
data.TRUCKNO_OUT = Convert.ToString(reader["TRUCKNO_OUT"]);
|
|
|
data.REMARK_OUT = Convert.ToString(reader["REMARK_OUT"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.CREATEUSER_OUT = Convert.ToString(reader["CREATEUSER_OUT"]);
|
|
|
data.CREATETIME_OUT = Convert.ToString(reader["CREATETIME_OUT"]);
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);
|
|
|
data.PICIHAO = Convert.ToString(reader["PICIHAO"]);
|
|
|
//data.AREACODE = Convert.ToString(reader["AREACODE_OUT"]);
|
|
|
data.PRODDATE = Convert.ToString(reader["Productiondate"]);
|
|
|
data.FACTORYNO = Convert.ToString(reader["FACTORYNO"]);
|
|
|
data.WMSINREMARK = Convert.ToString(reader["WMSINREMARK"]);
|
|
|
data.BUZTYPEREF = Convert.ToString(reader["BUZTYPEREF"]);
|
|
|
data.PORTREF = Convert.ToString(reader["PORTREF"]);
|
|
|
data.IMPORTCOUNTRY = Convert.ToString(reader["IMPORTCOUNTRY"]);
|
|
|
data.COMPANYNAME = Convert.ToString(reader["COMPANYNAME"]);
|
|
|
//data.AREANAME = Convert.ToString(reader["AREANAME"]);
|
|
|
//data.TRAYNO = Convert.ToString(reader["TRAYNO"]);
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
//出入库明细查询---新版,先在华腾试用
|
|
|
static public List<WMSDetailmb> GetDetailListNew(int start, int limit,string strCondition, string detail,string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
if (detail == "true")
|
|
|
strSql.Append(" select v.* from VW_WMSINOUT_DETAIL V WITH(NOLOCK)");
|
|
|
else if (detail == "false")
|
|
|
strSql.Append(" select v.* from VW_WMSINOUT_DETAIL_OVERALL V WITH(NOLOCK)");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
//if (!string.IsNullOrEmpty(sortstring))
|
|
|
//{
|
|
|
// strSql.Append(" order by " + sortstring);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql.Append(" order by v.MODIFIEDTIME ");
|
|
|
//}
|
|
|
|
|
|
var param = new BasicDataRefDAL.PagedQuaryParam();
|
|
|
param.strSql = strSql.ToString();
|
|
|
param.strCondition = strCondition;
|
|
|
param.rangestr = "";
|
|
|
//if (!string.IsNullOrWhiteSpace(sort))
|
|
|
//{
|
|
|
// sortstring = DatasetSort.Getsortstring(sort);
|
|
|
//}
|
|
|
param.sortstring = sortstring;
|
|
|
param.defaultsortstr = "MODIFIEDTIME";
|
|
|
param.start = start;
|
|
|
param.limit = limit;
|
|
|
|
|
|
return SetDetailData(BasicDataRefDAL.PagedQuaryStr(param));
|
|
|
}
|
|
|
|
|
|
|
|
|
//出入库明细查询肉类--鑫鹏威
|
|
|
static public List<WMSDetaillmb_XPW> GetDetailListXPW(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select v.* from VW_WMSINOUT_DETAIL_XPW V WITH(NOLOCK)");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by v.MODIFIEDTIME ");
|
|
|
}
|
|
|
return SetXPWDetailData(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 出入库明细表_进口贸易
|
|
|
|
|
|
static public List<WMSImportDetailmb> GetDetailList_Import(string strCondition, string sort)
|
|
|
{ //库存信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select dbo.F_WMS_CNTRNO(v.gid) CNTRNO, v.* ");
|
|
|
strSql.Append(" ,M.Inspection_Storage,dbo.trimdate(M.inspection_date) inspection_date,dbo.trimdate(M.Unsealdate) Unsealdate ,M.Agent,dbo.F_ImportTrade_SealInfo(v.Cargo_gid) SALEINFO");
|
|
|
strSql.Append(" ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=28 and EnumValueID=M.MainState) as MainStateRef ");
|
|
|
strSql.Append(" ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) Country_Ref ");
|
|
|
strSql.Append(" ,(select CargoType from import_cargo where gid=v.cargo_gid) CargoType ");
|
|
|
strSql.Append(" ,dbo.F_PAYCOMPANY(M.contractno) PAYCOMPANY ,c.MOREORLESS,c.boxcount-c.boxcount_act MOREORLESSCOUNT ");
|
|
|
strSql.Append(" from VW_WMS_DETAIL_Import V ");
|
|
|
strSql.Append(" left join import_main M on M.contractno=V.ASSOCIATEDNO ");
|
|
|
strSql.Append(" left join import_cargo c on c.gid=V.cargo_gid ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by v.MODIFIEDTIME ");
|
|
|
}
|
|
|
return SetImportDetailData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<WMSImportDetailmb> SetImportDetailData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<WMSImportDetailmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
WMSImportDetailmb data = new WMSImportDetailmb();
|
|
|
#region Set DB data to Object
|
|
|
data.NID = Convert.ToString(reader["NID"]);
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.STORAGENAME = Convert.ToString(reader["STORAGENAME"]);
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
|
|
|
data.GOODSSTANDARD = Convert.ToString(reader["GOODSSTANDARD"]);
|
|
|
data.GOODSMODEL = Convert.ToString(reader["GOODSMODEL"]);
|
|
|
data.WMSNO = Convert.ToString(reader["WMSNO"]);
|
|
|
data.OUTBSNO_OUT = Convert.ToString(reader["OUTBSNO_OUT"]);
|
|
|
data.BSNO_OUT = Convert.ToString(reader["BSNO_OUT"]);
|
|
|
data.WMSDATE = Convert.ToString(reader["WMSDATE"]);
|
|
|
data.DODATE_OUT = Convert.ToString(reader["DODATE_OUT"]);
|
|
|
data.GOODSRKSL = Convert.ToString(reader["GOODSRKSL"]);
|
|
|
data.GOODSRKSLACTUAL = Convert.ToString(reader["GOODSRKSLACTUAL"]);
|
|
|
data.GOODSPFSL_OUT = Convert.ToString(reader["GOODSPFSL_OUT"]);
|
|
|
data.GOODSSTOCK = Convert.ToString(reader["GOODSSTOCK"]);
|
|
|
data.CHARGEUNIT = Convert.ToString(reader["CHARGEUNIT"]);
|
|
|
data.GOODSOUTFEE_OUT = Convert.ToString(reader["GOODSOUTFEE_OUT"]);
|
|
|
data.GOODSOUTFEEAP_OUT = Convert.ToString(reader["GOODSOUTFEEAP_OUT"]);
|
|
|
data.ARFEE = Convert.ToString(reader["ARFEE"]);
|
|
|
data.APFEE = Convert.ToString(reader["APFEE"]);
|
|
|
data.ARFEE_OUT = Convert.ToString(reader["ARFEE_OUT"]);
|
|
|
data.APFEE_OUT = Convert.ToString(reader["APFEE_OUT"]);
|
|
|
data.FREESTORAGEPERIOD = Convert.ToString(reader["FREESTORAGEPERIOD"]);
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
data.GOODSPACK = Convert.ToString(reader["GOODSPACK"]);
|
|
|
data.TRUCKNO_OUT = Convert.ToString(reader["TRUCKNO_OUT"]);
|
|
|
data.REMARK_OUT = Convert.ToString(reader["REMARK_OUT"]);
|
|
|
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
|
|
|
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
|
|
|
data.CREATEUSER_OUT = Convert.ToString(reader["CREATEUSER_OUT"]);
|
|
|
data.CREATETIME_OUT = Convert.ToString(reader["CREATETIME_OUT"]);
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);
|
|
|
|
|
|
data.ISLOCK = Convert.ToString(reader["ISLOCK"]);
|
|
|
data.COSTPRICE = Convert.ToString(reader["COSTPRICE"]);
|
|
|
data.COSTPRICE_EX = Convert.ToString(reader["COSTPRICE_EX"]);
|
|
|
|
|
|
data.LOCKTIME = Convert.ToString(reader["LOCKTIME"]);
|
|
|
data.LOCKUSER = Convert.ToString(reader["LOCKUSER"]);
|
|
|
|
|
|
data.Inspection_Storage = Convert.ToString(reader["Inspection_Storage"]);
|
|
|
data.inspection_date = Convert.ToString(reader["inspection_date"]);
|
|
|
data.Unsealdate = Convert.ToString(reader["Unsealdate"]);
|
|
|
data.Agent = Convert.ToString(reader["Agent"]);
|
|
|
data.SALEINFO = Convert.ToString(reader["SALEINFO"]);
|
|
|
data.COSTCARGO = Convert.ToString(reader["COSTCARGO"]);
|
|
|
data.MainStateRef = Convert.ToString(reader["MainStateRef"]);
|
|
|
data.Country_Ref = Convert.ToString(reader["Country_Ref"]);
|
|
|
|
|
|
data.CargoType = Convert.ToString(reader["CargoType"]);
|
|
|
data.PAYCOMPANY = Convert.ToString(reader["PAYCOMPANY"]);
|
|
|
data.MOREORLESS = Convert.ToString(reader["MOREORLESS"]);
|
|
|
data.MOREORLESSCOUNT = Convert.ToString(reader["MOREORLESSCOUNT"]);
|
|
|
|
|
|
data.PUTINTYPE = Convert.ToString(reader["PUTINTYPE"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 查询是否有出库记录
|
|
|
|
|
|
public static int GetCargoOut(string WMSGID)
|
|
|
{ //合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select count(*) [Count] from wms_out_detail where inbsno ='" + WMSGID + "' ");
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
_count = Convert.ToInt16(reader["Count"]);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return _count;
|
|
|
}
|
|
|
|
|
|
public static int GetLocked(string CARGO_GID)
|
|
|
{ //合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select count(*) from wms where islock=1 where cargo_gid='" + CARGO_GID + "'");
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
_count = Convert.ToInt16(reader["Count"]);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return _count;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 入库锁定状态的提交审核驳回撤回
|
|
|
|
|
|
public static DBResult SubmitAudit ( String optype, String USERID, List<WMSmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var billno in billList)
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, billno.GID, USERID,billno.WMSNO,billno.GID,"");
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var _Comm = "";
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
_Comm = "update WMS set islock=1 where GID=@GID";//islock=1 锁定
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_Comm = "update WMS set islock=2 where GID=@GID";//islock=2 提交审核
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误! " + WorkResult.Message;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交审核成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误,请联系系统管理员 "+e.Message;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult CancelAudit ( String optype, String USERID, List<WMSmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
//var billList = bill.Split(',');
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var wms in billList)
|
|
|
{
|
|
|
var billno = wms.GID;
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, billno, USERID);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS set ISLOCK=0 where GID=@GID");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "撤销提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "撤销提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "撤销提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult Audit ( String USERID, List<WMSmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _w in billList)
|
|
|
{
|
|
|
var billno = _w.GID;
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo(WorkFlowName, billno, USERID,billno);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS set ISLOCK=1,LOCKUSER='" + USERID + "',LOCKTIME=getdate() where GID=@GID");
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "审核错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "审核成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "审核错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult AuditBack ( String USERID, List<WMSmb> billList, string reasean )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
|
|
|
//var billList = bill.Split(',');
|
|
|
var i = 0;
|
|
|
|
|
|
result.Success = true;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
/*
|
|
|
var cmdInsert =
|
|
|
db.GetSqlStringCommand(
|
|
|
@"insert into ch_fee_modify (GID,TYPE,APPLYTYPE,REASON,FEEID,BSNO,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,
|
|
|
AMOUNT,CURRENCY,FRT,COMMISSIONRATE,EXCHANGERATE,ISADVANCEDPAY,APPLYUSER,APPLYTIME,
|
|
|
APPLYSTATUS,REMARK,GROUPID,TAXRATE,NOTAXAMOUNT,ACCTAXRATE,TAXUNITPRICE)
|
|
|
values (@GID,@TYPE,@APPLYTYPE,@REASON,@FEEID,@BSNO,@FEENAME,@CUSTOMERNAME,@UNIT,@UNITPRICE,@QUANTITY,
|
|
|
@AMOUNT,@CURRENCY,@FRT,@COMMISSIONRATE,@EXCHANGERATE,@ISADVANCEDPAY,@APPLYUSER,@APPLYTIME,
|
|
|
@APPLYSTATUS,@REMARK,@GROUPID,@TAXRATE,@NOTAXAMOUNT,@ACCTAXRATE,@TAXUNITPRICE) ");
|
|
|
*/
|
|
|
|
|
|
foreach (var bill in billList)
|
|
|
{
|
|
|
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo(WorkFlowName, bill.GID, USERID, "");
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS set ISLOCK=6,LOCKUSER='',LOCKTIME='' where GID=@GID");
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
//var GROUPID = Guid.NewGuid().ToString();
|
|
|
|
|
|
//cmdInsert.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdInsert, "@GID", DbType.String, GROUPID);
|
|
|
|
|
|
|
|
|
//db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
i = i + 1;
|
|
|
result.Success = WorkResult.Success;
|
|
|
result.Message = WorkResult.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "驳回提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "驳回完成,其中" + i.ToString() + "票驳回错误,错误信息" + result.Message;
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "驳回提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 出库锁定状态的提交审核驳回撤回
|
|
|
|
|
|
public static DBResult SubmitAudit_OUT ( String optype, String USERID, List<WMSOUTmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var billno in billList)
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, billno.GID, USERID,billno.BSNO,billno.GID,"");
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var _Comm = "";
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
_Comm = "update WMS_Out set islock=1 where GID=@GID";//islock=1 锁定
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_Comm = "update WMS_Out set islock=2 where GID=@GID";//islock=2 提交审核
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误! " + WorkResult.Message;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交审核成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误,请联系系统管理员 " + e.Message;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult CancelAudit_OUT ( String optype, String USERID, List<WMSOUTmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
//var billList = bill.Split(',');
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var wms in billList)
|
|
|
{
|
|
|
var billno = wms.GID;
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, billno, USERID);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS_OUT set ISLOCK=0 where GID=@GID");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "撤销提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "撤销提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "撤销提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult Audit_OUT ( String USERID, List<WMSOUTmb> billList )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _w in billList)
|
|
|
{
|
|
|
var billno = _w.GID;
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo(WorkFlowName, billno, USERID,billno);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS_OUT set ISLOCK=1,LOCKUSER='" + USERID + "',LOCKTIME=getdate() where GID=@GID");
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, billno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "审核错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "审核成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "审核错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult AuditBack_OUT ( String USERID, List<WMSOUTmb> billList, string reasean )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var WorkFlowName = "WMSLOCKAudit";
|
|
|
|
|
|
|
|
|
//var billList = bill.Split(',');
|
|
|
var i = 0;
|
|
|
|
|
|
result.Success = true;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
/*
|
|
|
var cmdInsert =
|
|
|
db.GetSqlStringCommand(
|
|
|
@"insert into ch_fee_modify (GID,TYPE,APPLYTYPE,REASON,FEEID,BSNO,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,
|
|
|
AMOUNT,CURRENCY,FRT,COMMISSIONRATE,EXCHANGERATE,ISADVANCEDPAY,APPLYUSER,APPLYTIME,
|
|
|
APPLYSTATUS,REMARK,GROUPID,TAXRATE,NOTAXAMOUNT,ACCTAXRATE,TAXUNITPRICE)
|
|
|
values (@GID,@TYPE,@APPLYTYPE,@REASON,@FEEID,@BSNO,@FEENAME,@CUSTOMERNAME,@UNIT,@UNITPRICE,@QUANTITY,
|
|
|
@AMOUNT,@CURRENCY,@FRT,@COMMISSIONRATE,@EXCHANGERATE,@ISADVANCEDPAY,@APPLYUSER,@APPLYTIME,
|
|
|
@APPLYSTATUS,@REMARK,@GROUPID,@TAXRATE,@NOTAXAMOUNT,@ACCTAXRATE,@TAXUNITPRICE) ");
|
|
|
*/
|
|
|
|
|
|
foreach (var bill in billList)
|
|
|
{
|
|
|
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo(WorkFlowName, bill.GID, USERID, "");
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
|
|
|
var cmdupdate = db.GetSqlStringCommand("update WMS_OUT set ISLOCK=6,LOCKUSER='',LOCKTIME='' where GID=@GID");
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
//var GROUPID = Guid.NewGuid().ToString();
|
|
|
|
|
|
//cmdInsert.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdInsert, "@GID", DbType.String, GROUPID);
|
|
|
|
|
|
|
|
|
//db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
i = i + 1;
|
|
|
result.Success = WorkResult.Success;
|
|
|
result.Message = WorkResult.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "驳回提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "驳回完成,其中" + i.ToString() + "票驳回错误,错误信息" + result.Message;
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "驳回提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 进口贸易出库取消锁定时,删除费用;
|
|
|
static public int DelFee_ImportDelivery ( string DELIVERYNO )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(" delete from ch_fee where DELIVERYNO in(select gid from import_deliveryDetail where DELIVERYNO='" + DELIVERYNO + "') ");
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var _count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
return _count;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|