|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using DSWeb.Models;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Text;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using System.Xml;
|
|
|
|
|
|
using WebSqlHelper;
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
|
|
|
namespace DSWeb.SeaiFee
|
|
|
{
|
|
|
public partial class WmsRateGridSource : System.Web.UI.Page
|
|
|
{
|
|
|
private string strRateGid;//费率GID
|
|
|
private string strHandle;//费用操作说明
|
|
|
private const int iResult = -99;//参数错误
|
|
|
private string strUserID;//用户GID
|
|
|
private string strCompanyID;//公司GID
|
|
|
private string strShowName;//用户显示名
|
|
|
private string strDeptName;//部门名称
|
|
|
private int iCurrentPage;//当前页数
|
|
|
private int iShowPage;//显示最大页数
|
|
|
private string strSearch;//委托信息查询条件
|
|
|
private string strCacheName;//Session 缓存名称
|
|
|
|
|
|
private string strbsno;
|
|
|
private string strwmsoutgid;
|
|
|
private string strcustomer;
|
|
|
private string strcustid;//客户gid
|
|
|
////private string strgidlist;//费率列表
|
|
|
private string stropseaibsno;
|
|
|
private string strwmsoutbsno;
|
|
|
private string strsum;
|
|
|
private string strnum;
|
|
|
private string strmode;
|
|
|
|
|
|
private decimal outnums = 0;
|
|
|
private int feedays = 0;
|
|
|
//附件信息
|
|
|
private string strtb = "";//
|
|
|
private string linkgid = "";//
|
|
|
//
|
|
|
public string strgids = "";
|
|
|
public string strmblnonew = "";
|
|
|
public string strClient = "";
|
|
|
public string strRange = "";
|
|
|
public string strRange2 = "";
|
|
|
|
|
|
private const string PARM_FEE_GID = "@gid";
|
|
|
private const string PARM_FEEPROFIT_BSNO = "@bsno";//委托编号
|
|
|
|
|
|
private const string SQL_UPDATE_FEE_PROFIT_PRECENT = " UPDATE fee_gain SET PROFITRATE = A.PROFITRATE FROM ("
|
|
|
+ " SELECT BSNO,(CAST(CAST(CASE WHEN CRTTL = 0 THEN 0 ELSE (ROUND(TTLPROFIT/CRTTL,4))*100 END as decimal(18,2)) as varchar(20))+'%') as PROFITRATE FROM fee_gain WHERE BSNO = @bsno"
|
|
|
+ " )as A WHERE fee_gain.BSNO = A.BSNO";
|
|
|
|
|
|
private const string SQL_DELETE_FEE_BY_GID = "DELETE FROM ch_fee WHERE GID = @gid";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
#region 参数处理
|
|
|
if (Session["USERID"] != null)
|
|
|
{
|
|
|
strUserID = Session["USERID"].ToString();
|
|
|
}
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
{
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
}
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
{
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
}
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
{
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
}
|
|
|
//
|
|
|
if (Request.QueryString["handle"] != null)
|
|
|
{
|
|
|
strHandle = Request.QueryString["handle"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["bsno"] != null)
|
|
|
{
|
|
|
strbsno = Request.QueryString["bsno"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["tb"] != null)
|
|
|
{
|
|
|
strtb = Request.QueryString["tb"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["linkgid"] != null)
|
|
|
{
|
|
|
linkgid = Request.QueryString["linkgid"].ToString();
|
|
|
}
|
|
|
|
|
|
if (Request.QueryString["outnums"] != null)
|
|
|
{
|
|
|
outnums =decimal.Parse( Request.QueryString["outnums"].ToString());
|
|
|
}
|
|
|
if (Request.QueryString["feedays"] != null)
|
|
|
{
|
|
|
feedays =int.Parse( Request.QueryString["feedays"].ToString());
|
|
|
}
|
|
|
if (Request.QueryString["wmsoutgid"] != null)
|
|
|
{
|
|
|
strwmsoutgid = Request.QueryString["wmsoutgid"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["wmsoutbsno"] != null)
|
|
|
{
|
|
|
strwmsoutbsno = Request.QueryString["wmsoutbsno"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["opseaibsno"] != null)
|
|
|
{
|
|
|
stropseaibsno = Request.QueryString["opseaibsno"].ToString();
|
|
|
}
|
|
|
|
|
|
if (Request.QueryString["custid"] != null)
|
|
|
{
|
|
|
strcustid = Request.QueryString["custid"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["gid"] != null)
|
|
|
{
|
|
|
strRateGid = Request.QueryString["gid"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["cus"] != null)
|
|
|
{
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
strcustomer = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["cus"].ToString())));
|
|
|
}
|
|
|
if (Request.QueryString["search"] != null)
|
|
|
{
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
|
|
|
}
|
|
|
if (Request.QueryString["client"] != null)
|
|
|
{
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
strClient = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["client"].ToString())));
|
|
|
}
|
|
|
if (Request.QueryString["cur_page"] != null)
|
|
|
{
|
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iCurrentPage = 0;
|
|
|
}
|
|
|
if (Request.QueryString["show_page"] != null)
|
|
|
{
|
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iShowPage = 0;
|
|
|
}
|
|
|
if (Request.QueryString["sum"] != null)
|
|
|
{
|
|
|
strsum = Request.QueryString["sum"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["num"] != null)
|
|
|
{
|
|
|
strnum = Request.QueryString["num"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["mode"] != null)
|
|
|
{
|
|
|
strmode = Request.QueryString["mode"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["gids"] != null && Request.QueryString["gids"].ToString().Trim() != "")
|
|
|
{
|
|
|
strgids = Request.QueryString["gids"].ToString().Trim();
|
|
|
}
|
|
|
if (Request.QueryString["mblnonew"] != null && Request.QueryString["mblnonew"].ToString().Trim() != "")
|
|
|
{
|
|
|
strmblnonew = Request.QueryString["mblnonew"].ToString().Trim();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 权限可视范围
|
|
|
RangeDA RangeDA = new EntityDA.RangeDA();
|
|
|
//wms_out
|
|
|
strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modWmsOutList");//仓储入库列表
|
|
|
if (strRange.Trim().Equals("0"))//全部
|
|
|
{
|
|
|
strRange = "";
|
|
|
}
|
|
|
else if (strRange.Trim().Equals("1"))//分公司
|
|
|
{
|
|
|
strRange = " and GID in(" + RangeDA.GetWmsOutListCompany(strCompanyID.Trim()) + ")";
|
|
|
}
|
|
|
else if (strRange.Trim().Equals("2"))//部门
|
|
|
{
|
|
|
strRange = " and GID in(" + RangeDA.GetWmsOutListDEPT(strDeptName, strCompanyID, strUserID) + ")";
|
|
|
}
|
|
|
else if (strRange.Trim().Equals("3"))//个人
|
|
|
{
|
|
|
strRange = " and GID in(" + RangeDA.GetWmsOutListPerson(strUserID, strCompanyID) + ")";
|
|
|
}
|
|
|
else if (strRange.Trim().Equals("4"))//无
|
|
|
{
|
|
|
strRange = " and 1<0";
|
|
|
}
|
|
|
else//空
|
|
|
{
|
|
|
strRange = " and 1<0";
|
|
|
}
|
|
|
|
|
|
//wms
|
|
|
strRange2 = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modWmsList");//仓储入库列表
|
|
|
if (strRange2.Trim().Equals("0"))//全部
|
|
|
{
|
|
|
strRange2 = "";
|
|
|
}
|
|
|
else if (strRange2.Trim().Equals("1"))//分公司
|
|
|
{
|
|
|
strRange2 = " and GID in(" + RangeDA.GetWmsListCompany(strCompanyID.Trim()) + ")";
|
|
|
}
|
|
|
else if (strRange2.Trim().Equals("2"))//部门
|
|
|
{
|
|
|
strRange2 = " and GID in(" + RangeDA.GetWmsListDEPT(strDeptName, strCompanyID, strShowName) + ")";
|
|
|
}
|
|
|
else if (strRange2.Trim().Equals("3"))//个人
|
|
|
{
|
|
|
strRange2 = " and GID in(" + RangeDA.GetWmsListPerson(strShowName, strCompanyID) + ")";
|
|
|
}
|
|
|
else if (strRange2.Trim().Equals("4"))//无
|
|
|
{
|
|
|
strRange2 = " and 1<0";
|
|
|
}
|
|
|
else//空
|
|
|
{
|
|
|
strRange2 = " and 1<0";
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region strHandle解析
|
|
|
if (strHandle != null)
|
|
|
{
|
|
|
if (strHandle == "getratelist" && strcustid != null && strcustid != "")
|
|
|
{ //根据INFO_CLIENT.GID返回VW_WmsRateList仓储费率列表信息JSON字符串
|
|
|
Response.Write(GetRateListJsonByCusID(strcustid));
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "goodslist")
|
|
|
{ //获得货物信息
|
|
|
XmlDocument docs = GetDoc();
|
|
|
Response.ContentType = "text/xml";
|
|
|
Response.Write(docs.OuterXml.ToString());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "mblnonew")
|
|
|
{ //获得分单的主提单号
|
|
|
XmlDocument docsMblnoNew = GetMblnoNew();
|
|
|
Response.ContentType = "text/xml";
|
|
|
Response.Write(docsMblnoNew.OuterXml.ToString());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "getratebycus" && strcustomer !=null && strcustomer != "")
|
|
|
{ //获得符合条件的费率信息
|
|
|
Response.Write(GetRateList("cus"));
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "getratebysearch" && strSearch != null && strSearch != "")
|
|
|
{ //获得符合条件的费率信息
|
|
|
Response.Write(GetRateList("search"));
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "deleterate" && strSearch !=null && strSearch != "")
|
|
|
{//DeleteWmsRateDtj
|
|
|
Response.Write(DeleteWmsRateDtj());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "deleterate" && strRateGid !=null && strRateGid != "")
|
|
|
{//DeleteWmsRateDtj
|
|
|
Response.Write(DeleteWmsRate(strRateGid));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (strHandle == "getrate" )
|
|
|
{//DeleteWmsRateDtj && strSearch !=null && strSearch != ""
|
|
|
Response.Write(GetRateBySearch(strbsno));
|
|
|
//string tmpjson = "{rows:[]}";
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (strHandle == "wmsoutlist")
|
|
|
{
|
|
|
//出库单列表 WmsOutList.aspx
|
|
|
Response.Write(GetWmsOutListBySearch());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "wmsoutlistpage")
|
|
|
{//出库单列表
|
|
|
Response.Write(GetWmsOutLispagetBySearch());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "wmsinlist")
|
|
|
{//指定条件的入库单剩余库存信息
|
|
|
//if (strSearch == null || strSearch == "")
|
|
|
//{
|
|
|
// string tmpjson = "{rows:[]}";
|
|
|
// Response.Write(tmpjson);
|
|
|
// return;
|
|
|
//}
|
|
|
Response.Write(GetWmsInList());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "wmsinlistedit")
|
|
|
{
|
|
|
Response.Write(GetWmsInListEdit());
|
|
|
return;
|
|
|
}
|
|
|
if (strHandle == "wmsoutdetaillist")
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
Response.Write(Getwmsoutdetaillist());
|
|
|
}
|
|
|
//wmsfeecodelist
|
|
|
if (strHandle == "wmsfeecodelist")
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
Response.Write(GetWmsFeeCodeList());
|
|
|
}
|
|
|
//deleteWmsFeeCode
|
|
|
if (strHandle == "deleteWmsFeeCode")
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
Response.Write(DeleteWmsFeeCode(strRateGid));
|
|
|
}
|
|
|
if (strHandle == "deletewmsout")
|
|
|
{//
|
|
|
Response.Write(DeleteWmsOutByGid(strwmsoutgid));
|
|
|
}
|
|
|
if (strHandle == "WmsFeeQuery")
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
Response.Write(GetWmsFeeQuery());
|
|
|
}
|
|
|
if (strHandle == "getWmsFeeAndFeeDays")
|
|
|
{ //返回计费天数和仓储费
|
|
|
Response.Write(getWmsFeeAndFeeDays(strbsno, outnums, feedays));
|
|
|
}
|
|
|
if (strHandle == "wmsoutexcel")
|
|
|
{ //返回导出excel的Sql语句
|
|
|
Response.Write(GetwmsoutexcelSql());
|
|
|
}
|
|
|
//
|
|
|
if (strHandle == "wmsoutlistexcel")
|
|
|
{ //返回导出excel的Sql语句
|
|
|
Response.Write(GetwmsoutlistexcelSql());
|
|
|
}
|
|
|
if (strHandle == "setexcel")
|
|
|
{
|
|
|
Response.Write(GetSetExcel());
|
|
|
}
|
|
|
if (strHandle == "opseaifujian")
|
|
|
{ //获取附件信息
|
|
|
Response.Write(GetLogContent(iShowPage, iCurrentPage));
|
|
|
}
|
|
|
//
|
|
|
if (strHandle == "page")
|
|
|
{ //获取附件信息
|
|
|
Response.Write(GetPageInfo());
|
|
|
}
|
|
|
//
|
|
|
if (strHandle == "getfpk")
|
|
|
{ //获取附件信息
|
|
|
Response.Write(getfpk());
|
|
|
}
|
|
|
//
|
|
|
if (strHandle == "islock")
|
|
|
{ //入账信息
|
|
|
Response.Write(setislock());
|
|
|
}
|
|
|
if (strHandle == "notlock")
|
|
|
{ //取消入账信息
|
|
|
Response.Write(setnotlock());
|
|
|
}
|
|
|
if (strHandle == "getislock")
|
|
|
{ //判断是否入账信息
|
|
|
Response.Write(getislock());
|
|
|
}
|
|
|
if (strHandle == "getiswmsin")
|
|
|
{ //判断是否入账信息
|
|
|
Response.Write(getiswmsin());
|
|
|
}
|
|
|
if (strHandle == "getCustomno")
|
|
|
{
|
|
|
string id = Request.QueryString["id"].ToString();
|
|
|
Response.Write(getCustomno(id));
|
|
|
}
|
|
|
if (strHandle == "getBztchno")
|
|
|
{
|
|
|
string id = Request.QueryString["id"].ToString();
|
|
|
Response.Write(getBztchno(id));
|
|
|
}
|
|
|
if (strHandle == "getoutcustomer")
|
|
|
{
|
|
|
Response.Write(getoutcustomer());
|
|
|
}
|
|
|
if (strHandle == "getinspectionno")
|
|
|
{
|
|
|
Response.Write(getinspectionno());
|
|
|
}
|
|
|
if (strHandle == "setaddclient")
|
|
|
{
|
|
|
Response.Write(SetAddClient());
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
private string SetAddClient()
|
|
|
{
|
|
|
string value = T_ALL_DA.SetAddClient(strClient,strUserID,strShowName,strCompanyID);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
private string getinspectionno()
|
|
|
{
|
|
|
string strSQL = "select top 1 APPROVENO from op_seai where mblno='" + strmblnonew.Trim() + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string value = T_ALL_DA.GetStrSQL("APPROVENO", strSQL);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
private string getoutcustomer()
|
|
|
{
|
|
|
string strSQL = "select top 1 CUSTOMERNAME from op_seai where mblno='" + strmblnonew.Trim() + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string value = T_ALL_DA.GetStrSQL("CUSTOMERNAME", strSQL);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
private string getCustomno(string id)
|
|
|
{
|
|
|
string strSQL = "select top 1 CUSTOMNO from wms where gid='" + id.Trim() + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string value = T_ALL_DA.GetStrSQL("CUSTOMNO", strSQL);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
private string getBztchno(string id)
|
|
|
{
|
|
|
string strSQL = "select top 1 BZTCHNO from wms where gid='" + id.Trim() + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string value = T_ALL_DA.GetStrSQL("BZTCHNO", strSQL);
|
|
|
return value;
|
|
|
}
|
|
|
|
|
|
private string getiswmsin()
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string sGids = "'" + strgids.Replace(",", "','") + "'";
|
|
|
|
|
|
//string strSQL = "select count(gid) nums from (SELECT o.GID,o.REMARK,o.bsno FROM wms AS i INNER JOIN wms_out AS o ON i.ASSOCIATEDNO = o.ASSOCIATEDNO AND o.GOODSPFSL = i.GOODSRKSL AND o.GOODSPACKPFSL = i.GOODSPACK AND o.REMARK = '货权转移' and o.ASSOCIATEDNO not like 'topseailcl%') as a where gid in (" + sGids + ") or bsno in (" + sGids + ") ";
|
|
|
|
|
|
string strSQL = "select count(gid) nums from (SELECT o.GID,o.REMARK,o.bsno FROM wms AS i INNER JOIN wms_out AS o ON i.ASSOCIATEDNO = o.ASSOCIATEDNO AND o.ingidnew = i.gid AND o.ISCHANGE = 1 and o.ASSOCIATEDNO not like 'topseailcl%' and i.ISLOCK=1) as a where gid in (" + sGids + ") or bsno in (" + sGids + ") ";//o.REMARK = '货权转移'
|
|
|
string ls = T_ALL_DA.GetStrSQL("nums", strSQL);
|
|
|
return ls;
|
|
|
}
|
|
|
|
|
|
private string getislock()
|
|
|
{
|
|
|
string sGids = "'" + strgids.Replace(",", "','") + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string ls = T_ALL_DA.GetStrSQL("nums", "select count(gid) nums from wms_out where ISLOCK=1 and (gid in (" + sGids + ") or bsno in (" + sGids + "))");
|
|
|
return ls;
|
|
|
}
|
|
|
|
|
|
private string setnotlock()
|
|
|
{
|
|
|
string sGids = "'" + strgids.Replace(",", "','") + "'";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string ls = "select count(gid) nums from ch_fee where (bsno in (" + sGids + ") or WMSOUTBSNO in (" + sGids + ")) and (ISINVOICE=1 or AUDITSTATUS=1 or ORDERINVOICE<>0.00 or DEBITNO is not null or (FEESTATUS<>0 and FEESTATUS<>1))";
|
|
|
ls = T_ALL_DA.GetStrSQL("nums", ls);
|
|
|
if (ls.Trim() == "0")
|
|
|
{
|
|
|
ls = T_ALL_DA.GetStrSQL("nums", "select count(gid) nums from ch_fee_do where feeid in (select gid nums from ch_fee where (bsno in (" + sGids + ") or WMSOUTBSNO in (" + sGids + ")))");
|
|
|
if (ls.Trim() == "0")
|
|
|
{
|
|
|
WmsOutDA WmsOutDA = new WmsOutDA();
|
|
|
int iResult = WmsOutDA.setnotlock2(strgids, strUserID);
|
|
|
if (iResult < 0)
|
|
|
{
|
|
|
return "操作有误,请重新操作!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return "有“已申请开票、已开发票或已对帐”的入账数据,不允许取消入账,请重新操作!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return "有“已申请开票、已开发票、已对帐”的入账数据,不允许取消入账,请重新操作!";
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
private string setislock()
|
|
|
{
|
|
|
//string sGids = strgids.Replace(",", "','");
|
|
|
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
//string sSQL = "select isnull(count(*),0) as lsnum from wms_out where CUSTOMERNAME is not null and CUSTOMERNAME<>'' and gid in ('" + sGids + "')";// and TRUCKNAME is not null and TRUCKNAME<>''
|
|
|
//string lsnum = T_ALL_DA.GetStrSQL("lsnum", sSQL);
|
|
|
//if (lsnum.Trim() == "0")
|
|
|
//{
|
|
|
// return "应收客户有为空数据,不允许操作!";//应付
|
|
|
//}
|
|
|
//
|
|
|
WmsOutDA WmsOutDA = new WmsOutDA();
|
|
|
int iResult = WmsOutDA.setislock2(strgids, strUserID);
|
|
|
if (iResult < 0)
|
|
|
{
|
|
|
return "操作有误,请重新操作!";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return "操作成功!(注意:已做仓储对账的出库数据,仓储费不入账)";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 获取所有列表合计信息
|
|
|
/// <summary>
|
|
|
/// 获取费率信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string getfpk()
|
|
|
{
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
string strCondition = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "clientnameold"://
|
|
|
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://
|
|
|
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "ischange"://
|
|
|
string ls = strArg[1].Replace("\"", "");
|
|
|
if (ls.Trim() != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
|
|
|
}
|
|
|
break;
|
|
|
case "bsno"://NO
|
|
|
strCondition += String.Format(" AND (a.bsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.bsno like '%{0}%') or a.bsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "associatedno"://NO
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsstandard":
|
|
|
strCondition += String.Format(" AND a.BSNO in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strbsno != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
}
|
|
|
}
|
|
|
strCondition += strRange;
|
|
|
//
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
strSql = String.Format("select isnull(sum(GOODSOUTFEE),0) as GOODSOUTFEE,isnull(sum(GOODSOUTFEEAP),0) as GOODSOUTFEEAP,isnull(sum(ARFEE),0) as ARFEE,isnull(sum(APFEE),0) as APFEE,isnull(sum(GOODSPACKPFSL),0) as GOODSPACKPFSL,isnull(sum(GOODSPFSL),0) as GOODSPFSL from (SELECT * from wms_out a where 1=1 {0} {1}) as z ", strAuthorityCondition, strCondition);
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
string strls = sourceTable.Rows[0][0].ToString().Trim() + "," + sourceTable.Rows[0][1].ToString().Trim() + "," + sourceTable.Rows[0][2].ToString().Trim() + "," + sourceTable.Rows[0][3].ToString().Trim() + "," + sourceTable.Rows[0][4].ToString().Trim() + "," + sourceTable.Rows[0][5].ToString().Trim();
|
|
|
return strls;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取附件信息
|
|
|
/// <summary>
|
|
|
/// 获取附件信息
|
|
|
/// </summary>
|
|
|
/// <param name="tempShowPage"></param>
|
|
|
/// <param name="tempCurPage"></param>
|
|
|
/// <returns></returns>
|
|
|
private string GetLogContent(int tempShowPage, int tempCurPage)
|
|
|
{
|
|
|
LogDA logDA = new LogDA();
|
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
|
|
|
|
string strSql = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
if (tempShowPage > 0 && tempCurPage > 0)
|
|
|
{
|
|
|
if (tempCurPage == 1)
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} GID,AFFIXNAME+'^'+AFFIXURL URL,AFFIXNAME,AFFIXURL,LINKGID,AFFIXSIZE,TABLENAME FROM op_sailingdateurl where TABLENAME='{1}' and LINKGID='{2}' ORDER BY AFFIXNAME", "top " + tempShowPage, strtb, linkgid);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (tempShowPage * (tempCurPage - 1));//RowCount*PageNum
|
|
|
strTopInclude = "top " + tempShowPage;//RowCount*PageNum
|
|
|
strSql = String.Format("SELECT GID,AFFIXNAME+'^'+AFFIXURL URL,AFFIXNAME,AFFIXURL,LINKGID,AFFIXSIZE,TABLENAME FROM (SELECT {1} GID,AFFIXNAME+'^'+AFFIXURL URL,AFFIXNAME,AFFIXURL,LINKGID,AFFIXSIZE,TABLENAME FROM op_sailingdateurl WHERE TABLENAME='{2}' and LINKGID='{3}' and GID NOT IN (SELECT {0} GID FROM op_sailingdateurl where TABLENAME='{2}' and LINKGID='{3}' ORDER BY AFFIXNAME ) ORDER BY AFFIXNAME) AS A ", strTopNotInclude, strTopInclude, strtb, linkgid);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format("SELECT GID,AFFIXNAME+'^'+AFFIXURL URL,AFFIXNAME,AFFIXURL,LINKGID,AFFIXSIZE,TABLENAME FROM op_sailingdateurl where TABLENAME='{0}' and LINKGID='{1}' ", strtb, linkgid);
|
|
|
}
|
|
|
|
|
|
|
|
|
DataTable logTable = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql).Tables[0];
|
|
|
|
|
|
logBuilder.Append("{");
|
|
|
logBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < logTable.Rows.Count; i++)
|
|
|
{
|
|
|
logBuilder.Append("{id:\"" + logTable.Rows[i][0].ToString() + "\",");
|
|
|
logBuilder.Append("data:[");
|
|
|
logBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < logTable.Columns.Count; j++)
|
|
|
{
|
|
|
if (j == logTable.Columns.Count - 1)
|
|
|
{
|
|
|
logBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
logBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == logTable.Rows.Count - 1)
|
|
|
{
|
|
|
logBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
logBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
logBuilder.Append("]");
|
|
|
logBuilder.Append("}");
|
|
|
|
|
|
return logBuilder.ToString();
|
|
|
|
|
|
}
|
|
|
private int GetPageInfo()
|
|
|
{
|
|
|
LogDA logDA = new LogDA();
|
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
|
string strSql = String.Format("SELECT COUNT(*) FROM op_sailingdateurl where TABLENAME='{0}' and LINKGID='{1}' ", strtb, linkgid);
|
|
|
int iTotal = logDA.GetPageTotal(strSql);
|
|
|
return iTotal;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 返回导出excel的Sql语句
|
|
|
/// <summary>
|
|
|
/// 返回导出excel的Sql语句
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string GetwmsoutexcelSql()
|
|
|
{
|
|
|
string strSql = "";
|
|
|
strSql = String.Format(" SELECT b.BLNO,a.INBSNO,a.OUTBSNO,a.CUSTOMERNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,convert(char(10),b.DODATE,20) INDATE,convert(char(10),a.DODATE,20) OUTDATE, "
|
|
|
+ " b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.GOODSOUTFEE, datediff(day,b.DODATE,a.DODATE)+1 days,a.FEEDAYS"
|
|
|
//+",feedays= case when (datediff(day,b.DODATE,a.DODATE)+1-isnull(c.FEESCALE,0)) <=0 then 0 else datediff(day,b.DODATE,a.DODATE)+1-isnull(c.FEESCALE,0) end"
|
|
|
+ ",a.TRUCKNO, CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER), a.CREATETIME, a.REMARK "
|
|
|
+ " FROM wms_out_detail a left outer join wms_in b on a.INBSNO=b.BSNO left outer join (select * from wms_rate where isnull(FEEGRADE,0)=1 and isnull(FEEPRICE,0)=0 ) as c on c.BSNO=a.ASSOCIATEDNO and c.customername=a.customername where b.ISDELETE=0 and a.ASSOCIATEDNO='{0}' and a.OUTBSNO='{1}' "
|
|
|
+ " ORDER BY a.bsno ", stropseaibsno, strwmsoutbsno);
|
|
|
|
|
|
//string sSQL = "";
|
|
|
//sSQL = String.Format(" SELECT GID,ASSOCIATEDNO,BSNO,CUSTOMERNAME,DODATE,STORAGENAME,AREANAME, "
|
|
|
// + " GOODSNAME,GOODSMODEL,GOODSPACKPFSL,GOODSPFSL,GOODSOUTFEE,TRUCKNO,REMARK, "
|
|
|
// + " CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME "
|
|
|
// + " FROM wms_out where BSNO='{0}' ", strwmsoutbsno);
|
|
|
return strSql;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 返回导出excel的Sql语句
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string GetwmsoutlistexcelSql()
|
|
|
{
|
|
|
string strCondition = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "bsno"://NO
|
|
|
//strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%'", strArg[1].Replace("\"", ""));
|
|
|
//strCondition += String.Format(" AND (a.ASSOCIATEDNO in ((select bsno from op_seai where mblno like '%{0}%') union all (select bsno from op_seae where mblno like '%{0}%')) or a.bsno like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
strCondition += String.Format(" AND (a.bsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.bsno like '%{0}%') or a.bsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strbsno != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
}
|
|
|
}
|
|
|
strCondition += strRange;
|
|
|
//
|
|
|
strSql = String.Format(" SELECT a.BSNO,a.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120) "//,a.ASSOCIATEDNO,isnull(c.CLIENTNAME,'') newcust "
|
|
|
+ " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO "
|
|
|
+ " where c.ISDELETE=0 {0} ORDER BY a.GOODSNAME DESC ", strCondition);
|
|
|
return strSql;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
protected string GetSetExcel()
|
|
|
{
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "clientnameold"://
|
|
|
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://
|
|
|
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "ischange"://
|
|
|
string ls = strArg[1].Replace("\"", "");
|
|
|
if (ls.Trim() != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
|
|
|
}
|
|
|
break;
|
|
|
case "bsno"://NO
|
|
|
strCondition += String.Format(" AND (a.bsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.bsno like '%{0}%') or a.bsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%' or a.BZTCHNO like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "associatedno"://NO
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsstandard":
|
|
|
strCondition += String.Format(" AND a.BSNO in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strbsno != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
}
|
|
|
}
|
|
|
strCondition += strRange;
|
|
|
if (strgids.Trim() != "")
|
|
|
{
|
|
|
string str = strgids.Replace(",", "','");
|
|
|
strCondition += " AND a.GID in ('" + str + "')";
|
|
|
}
|
|
|
//
|
|
|
//是否入账、货权转移、提单号、吨数、品名、牌号、备案清单号、货主、转移对象、入库日期、出库日期、计费日期、车号 ---以上字段提前(中物储青岛王晨坤)2014-04-22
|
|
|
strSql = String.Format(" SELECT (case a.ISLOCK when 1 then '是' else '否' end) as ISLOCK"
|
|
|
+ ",(case a.ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
|
+ ",blno=(case a.CHARGEUNIT when 'CBM' then (select top 1 BLNO from wms_in where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) else (select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) end)"
|
|
|
+ ",a.GOODSPFSL,a.GOODSPACKPFSL,a.GOODSNAME,a.GOODSMODEL,a.CUSTOMNO,a.CUSTOMERNAME,a.CLIENTNAMEOLD"
|
|
|
+ ",WMSDATE=(case a.CHARGEUNIT when 'CBM' then (select convert(char(10),DODATE,20) as DODATE from wms_in where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) else (select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) end)"
|
|
|
+ ",convert(char(10),a.DODATE,20) as DODATE"
|
|
|
+ ",STARTBILLINGDATE=(select top 1 convert(char(10),STARTBILLINGDATE,20) as STARTBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
+ ",ENDBILLINGDATE=(select top 1 convert(char(10),ENDBILLINGDATE,20) as ENDBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
+ ",a.TRUCKNO,a.MBLNONEW,a.BSNO,a.ARCLIENT,a.TRUCKNAME,a.CHARGEUNIT,a.GOODSOUTFEE,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120),a.BZTCHNO,isDLSF=(case when isnull(a.ARCLIENTWMSOUT,'')<>'' and isnull(a.ARCLIENTWMSOUT,'')<>a.CUSTOMERNAME then '是' else '' end) "
|
|
|
+ " from wms_out a "
|
|
|
+ " where 1=1 {0} ORDER BY a.BSNO desc,a.CREATETIME desc", strCondition);
|
|
|
return strSql.ToString();
|
|
|
}
|
|
|
|
|
|
#region 返回计费天数和仓储费
|
|
|
/// <summary>
|
|
|
/// 返回计费天数和仓储费
|
|
|
/// </summary>
|
|
|
/// <param name="bsno">委托单号</param>
|
|
|
/// <param name="outnums">出库数量</param>
|
|
|
/// <param name="feedays">仓储天数</param>
|
|
|
/// <returns></returns>
|
|
|
private string getWmsFeeAndFeeDays(string bsno, decimal outnums, int feedays)
|
|
|
{
|
|
|
int nofeedays=0;
|
|
|
string Sqlstr = "";
|
|
|
|
|
|
decimal totaloutfee = 0;//出库单的仓储费
|
|
|
int prescale = 0;
|
|
|
int nowscale = 0;
|
|
|
int nowgrade = 0;
|
|
|
decimal price = 0;
|
|
|
decimal gradefee = 0;
|
|
|
decimal sumfee = 0;
|
|
|
|
|
|
Sqlstr = String.Format("SELECT FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT FROM wms_rate where BSNO='{0}' order by BSNO,FEEGRADE ", bsno);
|
|
|
DataSet dsrate = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, Sqlstr.ToString());
|
|
|
DataTable dtrate = new DataTable();
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
dtrate = dsrate.Tables[0];
|
|
|
if (dtrate.Rows.Count > 0)
|
|
|
{
|
|
|
prescale = 0;
|
|
|
nowscale = 0;
|
|
|
nowgrade = 0;
|
|
|
price = 0;
|
|
|
|
|
|
gradefee = 0;
|
|
|
sumfee = 0;
|
|
|
foreach (DataRow drow in dtrate.Rows)
|
|
|
{
|
|
|
nowgrade = int.Parse(drow["FEEGRADE"].ToString());
|
|
|
nowscale = int.Parse(drow["FEESCALE"].ToString());
|
|
|
price = decimal.Parse(drow["FEEPRICE"].ToString());
|
|
|
if (nowgrade.Equals(1))
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * nowscale;
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = feedays - nowscale;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = 0;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (nowgrade > 1)
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (nowscale - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - nowscale);
|
|
|
sumfee += gradefee;
|
|
|
}
|
|
|
totaloutfee += sumfee;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("wmsfee:[");
|
|
|
|
|
|
sourceBuilder.Append("{bsno:\"" + bsno + "\",");
|
|
|
|
|
|
sourceBuilder.Append("\"jsdays\":\"" + nofeedays.ToString() + "\",");
|
|
|
sourceBuilder.Append("\"totaloutfee\":\"" + totaloutfee.ToString() + "\"");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region GetWmsFeeQuery
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string GetWmsFeeQuery()
|
|
|
{
|
|
|
WmsFeeCodeDA WmsFeeCodeDA = new WmsFeeCodeDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
string strAuthorityCondition = "";
|
|
|
string OutDate="";//= DateTime.Today.ToString("yyyy-MM-dd");//出库日期
|
|
|
bool isout=false;//是否包含已经出库的仓储费;
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" and CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "blno"://NO
|
|
|
strCondition += String.Format(" AND BLNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "customno"://NO
|
|
|
strCondition += String.Format(" AND CUSTOMNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "outdate":
|
|
|
OutDate = strArg[1].Replace("\"", "");
|
|
|
break;
|
|
|
case "isout":
|
|
|
isout = bool.Parse(strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition += " and 1<0 ";
|
|
|
}
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
|
|
|
//2013-04-10 之前的
|
|
|
/*
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// if (isout)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{3}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{3}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in where ISDELETE=0 and GOODSSTOCK>0 {1} {2} "
|
|
|
// + " union all "
|
|
|
// + " select {0} b.GID,b.CLIENTNAME,b.BLNO,b.BSNO,convert(char(10),b.DODATE,120) INDODATE,convert(char(10),a.DODATE,120) OUTDODATE,b.STORAGENAME,b.GOODSNAME,b.GOODSMODEL,0 GOODSSTOCK,0 GOODSPACKSTOCK,GOODSPFSL,GOODSPACKPFSL,(datediff(day,b.DODATE,a.DODATE)+1) days,GOODSOUTFEE,b.REMARK,CREATEUSER=(select SHOWNAME from [user] where gid=b.CREATEUSER),convert(char(19), b.CREATETIME,120),b.ASSOCIATEDNO,1 iswmsout "
|
|
|
// + " from wms_out_detail a inner join wms_in b on a.INBSNO=b.BSNO where b.ISDELETE=0 {1} {2} "
|
|
|
// + " ORDER BY CLIENTNAME,iswmsout,BLNO "
|
|
|
// , "top " + iShowPage.ToString(), strAuthorityCondition, strCondition, OutDate);
|
|
|
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{3}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{3}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in where ISDELETE=0 and GOODSSTOCK>0 {1} {2} ORDER BY CLIENTNAME,BLNO ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition, OutDate);
|
|
|
// }
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// if (isout)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{4}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{4}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in WHERE ISDELETE=0 and BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE ISDELETE=0 and GOODSSTOCK>0 {2} {3} ORDER BY CLIENTNAME,BLNO ) {2} {3} "
|
|
|
// + " union all "
|
|
|
// + " select {0} b.GID,b.CLIENTNAME,b.BLNO,b.BSNO,convert(char(10),b.DODATE,120) INDODATE,convert(char(10),a.DODATE,120) OUTDODATE,b.STORAGENAME,b.GOODSNAME,b.GOODSMODEL,0 GOODSSTOCK,0 GOODSPACKSTOCK,GOODSPFSL,GOODSPACKPFSL,(datediff(day,b.DODATE,a.DODATE)+1) days,GOODSOUTFEE,b.REMARK,CREATEUSER=(select SHOWNAME from [user] where gid=b.CREATEUSER),convert(char(19), b.CREATETIME,120),b.ASSOCIATEDNO,1 iswmsout "
|
|
|
// + " from wms_out_detail a inner join wms_in b on a.INBSNO=b.BSNO where b.ISDELETE=0 and b.BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE b.ISDELETE=0 and GOODSSTOCK>0 {2} {3} ORDER BY CLIENTNAME,BLNO ) {2} {3} "
|
|
|
// + " ORDER BY CLIENTNAME,iswmsout,BLNO ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition, OutDate);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{4}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{4}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in WHERE ISDELETE=0 and BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE ISDELETE=0 and GOODSSTOCK>0 {2} {3} ORDER BY CLIENTNAME,BLNO ) {2} {3} "
|
|
|
// + " ORDER BY CLIENTNAME,iswmsout,BLNO ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition, OutDate);
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// if (isout)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{2}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{2}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in where ISDELETE=0 and GOODSSTOCK>0 {0} {1} "
|
|
|
// + " union all "
|
|
|
// + " select b.GID,b.CLIENTNAME,b.BLNO,b.BSNO,convert(char(10),b.DODATE,120) INDODATE,convert(char(10),a.DODATE,120) OUTDODATE,b.STORAGENAME,b.GOODSNAME,b.GOODSMODEL,0 GOODSSTOCK,0 GOODSPACKSTOCK,GOODSPFSL,GOODSPACKPFSL,(datediff(day,b.DODATE,a.DODATE)+1) days,GOODSOUTFEE,b.REMARK,CREATEUSER=(select SHOWNAME from [user] where gid=b.CREATEUSER),convert(char(19), b.CREATETIME,120),b.ASSOCIATEDNO,1 iswmsout "
|
|
|
// + " from wms_out_detail a inner join wms_in b on a.INBSNO=b.BSNO where ISDELETE=0 {0} {1} "
|
|
|
// + " ORDER BY CLIENTNAME,iswmsout,BLNO ", strAuthorityCondition, strCondition, OutDate);
|
|
|
|
|
|
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT GID,CLIENTNAME, BLNO,BSNO,convert(char(10),DODATE,120) INDATE,'{2}' OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK, GOODSPACKSTOCK,0 GOODSPFSL,0 GOODSPACKPFSL,(datediff(day,DODATE,'{2}')+1) days,0 GOODSOUTFEE,REMARK, CREATEUSER=(select SHOWNAME from [user] where gid=CREATEUSER), CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
// + " FROM wms_in where ISDELETE=0 and GOODSSTOCK>0 {0} {1} "
|
|
|
// + " ORDER BY CLIENTNAME,BLNO ", strAuthorityCondition, strCondition, OutDate);
|
|
|
// }
|
|
|
//}
|
|
|
*/
|
|
|
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
#region 按计费日期计算仓储费用插入临时表
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
int iState = 0;
|
|
|
int result = 0;
|
|
|
string Sqlstr = "";
|
|
|
//
|
|
|
try
|
|
|
{
|
|
|
//Sqlstr = String.Format("SELECT *, ISNULL((SELECT CUSTOMNO FROM wms_out WHERE (BSNO=(SELECT TOP (1) OUTBSNO FROM wms_out_detail WHERE (INBSNO = a.GID)))), '') AS CUSTOMNO,0 ISWMSOUT,convert(char(10),WMSDATE,120) INDATE,'{2}' OUTDATE,(DATEDIFF(day, convert(char(10),WMSDATE,120), '{2}') + 1) as WMSDAYS,(case when (select ((DATEDIFF(day, convert(char(10),wms.WMSDATE,120), '{2}') + 1)-FEESCALE) as FEEDAYS from wms_rate where bsno=wms.gid and isnull(FEEPRICE,0)=0)<=0 then 0 else (select ((DATEDIFF(day, convert(char(10),wms.WMSDATE,120), '{2}') + 1)-FEESCALE) as FEEDAYS from wms_rate where bsno=wms.gid and isnull(FEEPRICE,0)=0) end) as FEEDAYS FROM wms where isnull(ISDELETE,0)=0 and isnull(GOODSSTOCK,0)>0 and convert(char(10),WMSDATE,120)<=convert(char(10),'{2}',120) {0} {1} ORDER BY CUSTOMERNAME,BLNO ", strAuthorityCondition, strCondition, OutDate);
|
|
|
|
|
|
Sqlstr = String.Format("select GID,CUSTOMERNAME,BLNO,GOODSSTOCK,WMSDAYS from (SELECT *"
|
|
|
//+ ", ISNULL((SELECT CUSTOMNO FROM wms_out WHERE (BSNO=(SELECT TOP (1) OUTBSNO FROM wms_out_detail WHERE (INBSNO = wms.GID)))), '') AS CUSTOMNO"
|
|
|
+ ",(DATEDIFF(day, convert(char(10),WMSDATE,120), '{2}') + 1) as WMSDAYS FROM wms where isnull(ISDELETE,0)=0 and isnull(GOODSSTOCK,0)>0 and convert(char(10),WMSDATE,120)<=convert(char(10),'{2}',120) {0} ) as a where 1=1 {1} ORDER BY CUSTOMERNAME,BLNO ", strAuthorityCondition, strCondition, OutDate);
|
|
|
DataSet ds = SqlHelper.ExecuteQueryDataset(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
//strUserID
|
|
|
Sqlstr = "delete from wms_wmsrate_test where CREATEUSER='" + strUserID + "' and CORPID2='" + strCompanyID + "'";
|
|
|
iState = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (iState < 0)
|
|
|
{
|
|
|
sqlTran.Rollback();
|
|
|
result = -3;
|
|
|
}
|
|
|
//
|
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
|
{
|
|
|
decimal totaloutfee = 0;//出库单的仓储费
|
|
|
int prescale = 0;
|
|
|
int nowscale = 0;
|
|
|
int nowgrade = 0;
|
|
|
decimal price = 0;
|
|
|
decimal gradefee = 0;
|
|
|
decimal sumfee = 0;
|
|
|
//
|
|
|
#region 按计费日期计算仓储费用
|
|
|
int iFEEDAYS = 0;//计费天数 FEEDAYS
|
|
|
decimal outnums = decimal.Parse(dr["GOODSSTOCK"].ToString().Trim());//库存量
|
|
|
int feedays = int.Parse(dr["WMSDAYS"].ToString().Trim());
|
|
|
if (feedays > 0)
|
|
|
{
|
|
|
Sqlstr = "SELECT FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT FROM wms_rate where BSNO='" + dr["GID"].ToString().Trim() + "' and CUSTOMERNAME like '%" + dr["CUSTOMERNAME"].ToString().Trim() + "%' order by BSNO,FEEGRADE ";
|
|
|
DataSet dsrate = SqlHelper.ExecuteQueryDataset(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
DataTable dtrate = new DataTable();
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
dtrate = dsrate.Tables[0];
|
|
|
if (dtrate.Rows.Count > 0)
|
|
|
{
|
|
|
prescale = 0;
|
|
|
nowscale = 0;
|
|
|
nowgrade = 0;
|
|
|
price = 0;
|
|
|
|
|
|
gradefee = 0;
|
|
|
sumfee = 0;
|
|
|
foreach (DataRow drow in dtrate.Rows)
|
|
|
{
|
|
|
nowgrade = int.Parse(drow["FEEGRADE"].ToString());//收费等级
|
|
|
nowscale = int.Parse(drow["FEESCALE"].ToString());//收费区间
|
|
|
price = decimal.Parse(drow["FEEPRICE"].ToString());//收费单价
|
|
|
if (nowgrade.Equals(1))//收费等级
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * nowscale;//出库量*收费单价*收费区间
|
|
|
sumfee += gradefee;
|
|
|
|
|
|
//计算 开始计费日期和计费天数
|
|
|
if (price > 0)
|
|
|
{
|
|
|
iFEEDAYS = nowscale;//计费天数 FEEDAYS
|
|
|
}
|
|
|
//
|
|
|
prescale = nowscale;//本次收费区间
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);//出库量*收费单价*(仓储天数-上一个收费区间(0))
|
|
|
sumfee += gradefee;
|
|
|
|
|
|
//计算 开始计费日期和计费天数
|
|
|
if (price > 0)
|
|
|
{
|
|
|
iFEEDAYS = feedays - prescale;//计费天数 FEEDAYS
|
|
|
}
|
|
|
//
|
|
|
prescale = nowscale;//本次收费区间
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
else if (nowgrade > 1)//收费等级
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (nowscale - prescale);//出库量*收费单价*(收费区间-上一个收费区间(0))
|
|
|
sumfee += gradefee;
|
|
|
|
|
|
//计算 开始计费日期和计费天数
|
|
|
if (price > 0)
|
|
|
{
|
|
|
iFEEDAYS += (nowscale - prescale);//计费天数 FEEDAYS
|
|
|
}
|
|
|
//
|
|
|
prescale = nowscale;//本次收费区间
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);//出库量*收费单价*(仓储天数-上一个收费区间(0))
|
|
|
sumfee += gradefee;
|
|
|
|
|
|
//计算 开始计费日期和计费天数
|
|
|
if (price > 0)
|
|
|
{
|
|
|
iFEEDAYS += (feedays - prescale);//计费天数 FEEDAYS
|
|
|
}
|
|
|
//
|
|
|
prescale = nowscale;//本次收费区间
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - nowscale);//出库量*收费单价*(仓储天数-收费区间(0))
|
|
|
sumfee += gradefee;
|
|
|
|
|
|
//计算 开始计费日期和计费天数
|
|
|
if (price > 0)
|
|
|
{
|
|
|
iFEEDAYS += (feedays - nowscale);//计费天数 FEEDAYS
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
totaloutfee += sumfee;
|
|
|
sumfee = T_ALL_DA.getDigit(sumfee, 2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
Sqlstr = String.Format("insert into wms_wmsrate_test(WMSNO,INDATE,OUTDATE,ASSOCIATEDNO,BLNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,CHARGEUNIT,GOODSPACK,GOODSPACKSTOCK,GOODSRKSL,GOODSSTOCK,ARFEE,APFEE,MODIFIEDUSER,MODIFIEDTIME,ISLOCK,CORPID,CUSTOMNO,WMSDAYS,FEEDAYS,GOODSOUTFEE,ISWMSOUT,CREATEUSER,CREATETIME,CORPID2) "
|
|
|
+ " select WMSNO,convert(char(10),WMSDATE,120) INDATE,'{2}' OUTDATE,ASSOCIATEDNO,BLNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,CHARGEUNIT,isnull(GOODSPACK,0) as GOODSPACK,isnull(GOODSPACKSTOCK,0) as GOODSPACKSTOCK,isnull(GOODSRKSL,0) as GOODSRKSL,isnull(GOODSSTOCK,0) as GOODSSTOCK,isnull(ARFEE,0) as ARFEE,isnull(APFEE,0) as APFEE,(SELECT SHOWNAME FROM [user] WHERE GID = wms.MODIFIEDUSER) AS MODIFIEDUSER,MODIFIEDTIME,ISLOCK,CORPID,ISNULL((SELECT CUSTOMNO FROM wms_out WHERE (BSNO=(SELECT TOP (1) OUTBSNO FROM wms_out_detail WHERE (INBSNO = wms.GID)))), '') AS CUSTOMNO,(DATEDIFF(day, convert(char(10),WMSDATE,120), '{2}') + 1) as WMSDAYS,'{4}' AS FEEDAYS"
|
|
|
//+",(case when (select ((DATEDIFF(day, convert(char(10),wms.WMSDATE,120), '{2}') + 1)-FEESCALE) as FEEDAYS from wms_rate where bsno=wms.gid and isnull(FEEPRICE,0)=0)<=0 then (select (DATEDIFF(day, convert(char(10),wms.WMSDATE,120), '{2}') + 1) as FEEDAYS from wms_rate where bsno=wms.gid and isnull(FEEPRICE,0)=0) else (select ((DATEDIFF(day, convert(char(10),wms.WMSDATE,120), '{2}') + 1)-FEESCALE) as FEEDAYS from wms_rate where bsno=wms.gid and isnull(FEEPRICE,0)=0) end) as FEEDAYS"
|
|
|
+ ",{3} as GOODSOUTFEE,0 ISWMSOUT,'" + strUserID + "' as CREATEUSER,getdate() as CREATETIME,'" + strCompanyID + "' as CORPID2 from wms where isnull(ISDELETE,0)=0 and isnull(GOODSSTOCK,0)>0 and convert(char(10),WMSDATE,120)<=convert(char(10),'{2}',120) and GID='" + dr["GID"].ToString().Trim() + "' {0} {1} ", strAuthorityCondition, strCondition, OutDate, sumfee, iFEEDAYS);
|
|
|
iState = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
if (iState != 1)
|
|
|
{
|
|
|
sqlTran.Rollback();
|
|
|
result = -4;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
result = 1;//状态为1表示删除成功
|
|
|
sqlTran.Commit();
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
result = -10;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
result = -11;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
|
|
//("", "货主", "提单号", "备案清单号", "入库单号", "入库日期", "出库日期", "仓库名称", "品名", "型号", "剩余库存", "剩余件数", "仓储天数", "计费天数", "仓储费", "开单人", "开单时间", "进口委托单号", "是否有出库单");
|
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
{
|
|
|
if (iCurrentPage == 1)
|
|
|
{
|
|
|
strSql = String.Format(" SELECT {0} GID,CUSTOMERNAME,BLNO,CUSTOMNO,WMSNO,convert(char(10),INDATE,120) INDATE,convert(char(10),OUTDATE,120) OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK,GOODSPACKSTOCK,WMSDAYS,FEEDAYS,GOODSOUTFEE,MODIFIEDUSER,MODIFIEDTIME,ASSOCIATEDNO,ISWMSOUT "
|
|
|
+ " FROM wms_wmsrate_test where CREATEUSER='" + strUserID + "' and CORPID2='" + strCompanyID + "' ORDER BY CUSTOMERNAME,BLNO ", "top " + iShowPage.ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
strSql = String.Format(" SELECT {0} GID,CUSTOMERNAME,BLNO,CUSTOMNO,WMSNO,convert(char(10),INDATE,120) INDATE,convert(char(10),OUTDATE,120) OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK,GOODSPACKSTOCK,WMSDAYS,FEEDAYS,GOODSOUTFEE,MODIFIEDUSER,MODIFIEDTIME,ASSOCIATEDNO,0 ISWMSOUT "
|
|
|
+ " FROM wms_wmsrate_test WHERE BSNO NOT IN "
|
|
|
+ " (SELECT {1} BSNO FROM wms_wmsrate_test where CREATEUSER='" + strUserID + "' and CORPID2='" + strCompanyID + "' ORDER BY CUSTOMERNAME,BLNO ) CREATEUSER='" + strUserID + "' and CORPID2='" + strCompanyID + "'"
|
|
|
+ " ORDER BY CUSTOMERNAME,iswmsout,BLNO ", strTopInclude, strTopNotInclude);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = "SELECT GID,CUSTOMERNAME,BLNO,CUSTOMNO,WMSNO,convert(char(10),INDATE,120) INDATE,convert(char(10),OUTDATE,120) OUTDATE,STORAGENAME,GOODSNAME,GOODSMODEL,GOODSSTOCK,GOODSPACKSTOCK,WMSDAYS,FEEDAYS,GOODSOUTFEE,MODIFIEDUSER,MODIFIEDTIME,ASSOCIATEDNO,0 ISWMSOUT FROM wms_wmsrate_test where 1<0 ";
|
|
|
}
|
|
|
sourceTable = WmsFeeCodeDA.GetRateListByCondition(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
/*
|
|
|
//string bsno = sourceTable.Rows[i]["ASSOCIATEDNO"].ToString();
|
|
|
//decimal outnums = 0;
|
|
|
//int days = 0;
|
|
|
//int nofeedays = 0;
|
|
|
//decimal wmsfee = 0;
|
|
|
//int iswmsout = int.Parse(sourceTable.Rows[i]["iswmsout"].ToString());
|
|
|
//if (iswmsout==0)
|
|
|
//{
|
|
|
// outnums = decimal.Parse(sourceTable.Rows[i]["GOODSSTOCK"].ToString());
|
|
|
// days = int.Parse(sourceTable.Rows[i]["days"].ToString());
|
|
|
// nofeedays = 0;
|
|
|
// wmsfee = 0;
|
|
|
// wmsfee = GetWmsFee(bsno, outnums, days, ref nofeedays);
|
|
|
//}
|
|
|
//else if (iswmsout==1)
|
|
|
//{
|
|
|
// days = int.Parse(sourceTable.Rows[i]["days"].ToString());
|
|
|
// nofeedays = GetWmsFeeDays(bsno, days);
|
|
|
//}
|
|
|
//for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
//{
|
|
|
// if (j == sourceTable.Columns.Count - 1)
|
|
|
// {
|
|
|
// sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// if (iswmsout==0)
|
|
|
// {
|
|
|
// if (sourceTable.Columns[j].ColumnName.ToString().Equals("GOODSOUTFEE"))
|
|
|
// {
|
|
|
// sourceBuilder.Append("\"" + nofeedays.ToString() + "\",");
|
|
|
// sourceBuilder.Append("\"" + wmsfee.ToString() + "\",");
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
// }
|
|
|
// }
|
|
|
// else if (iswmsout==1)
|
|
|
// {
|
|
|
// if (sourceTable.Columns[j].ColumnName.ToString().Equals("GOODSOUTFEE"))
|
|
|
// {
|
|
|
// sourceBuilder.Append("\"" + nofeedays.ToString() + "\",");
|
|
|
// }
|
|
|
// sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
*/
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
private int GetWmsFeeDays(string bsno, int feedays)
|
|
|
{
|
|
|
string Sqlstr = "";
|
|
|
int nowscale = 0;
|
|
|
int nowgrade = 0;
|
|
|
decimal price = 0;
|
|
|
int nofeedays = 0;//计费天数
|
|
|
Sqlstr = String.Format("SELECT FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT FROM wms_rate where BSNO='{0}' order by BSNO,FEEGRADE ", bsno);
|
|
|
DataSet dsrate = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, Sqlstr.ToString());
|
|
|
DataTable dtrate = new DataTable();
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
dtrate = dsrate.Tables[0];
|
|
|
if (dtrate.Rows.Count > 0)
|
|
|
{
|
|
|
nowscale = 0;
|
|
|
nowgrade = 0;
|
|
|
price = 0;
|
|
|
foreach (DataRow drow in dtrate.Rows)
|
|
|
{
|
|
|
nowgrade = int.Parse(drow["FEEGRADE"].ToString());
|
|
|
nowscale = int.Parse(drow["FEESCALE"].ToString());
|
|
|
price = decimal.Parse(drow["FEEPRICE"].ToString());
|
|
|
if (nowgrade.Equals(1))
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = feedays - nowscale;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = 0;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return nofeedays;
|
|
|
}
|
|
|
|
|
|
private decimal GetWmsFee(string bsno, decimal outnums, int feedays,ref int nofeedays)
|
|
|
{
|
|
|
string Sqlstr = "";
|
|
|
|
|
|
decimal totaloutfee = 0;//出库单的仓储费
|
|
|
int prescale = 0;
|
|
|
int nowscale = 0;
|
|
|
int nowgrade = 0;
|
|
|
decimal price = 0;
|
|
|
decimal gradefee = 0;
|
|
|
decimal sumfee = 0;
|
|
|
|
|
|
Sqlstr = String.Format("SELECT FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT FROM wms_rate where BSNO='{0}' order by BSNO,FEEGRADE ", bsno);
|
|
|
DataSet dsrate = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, Sqlstr.ToString());
|
|
|
DataTable dtrate = new DataTable();
|
|
|
if (dsrate != null)
|
|
|
{
|
|
|
dtrate = dsrate.Tables[0];
|
|
|
if (dtrate.Rows.Count > 0)
|
|
|
{
|
|
|
prescale = 0;
|
|
|
nowscale = 0;
|
|
|
nowgrade = 0;
|
|
|
price = 0;
|
|
|
|
|
|
gradefee = 0;
|
|
|
sumfee = 0;
|
|
|
foreach (DataRow drow in dtrate.Rows)
|
|
|
{
|
|
|
nowgrade = int.Parse(drow["FEEGRADE"].ToString());
|
|
|
nowscale = int.Parse(drow["FEESCALE"].ToString());
|
|
|
price = decimal.Parse(drow["FEEPRICE"].ToString());
|
|
|
if (nowgrade.Equals(1))
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * nowscale;
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = feedays - nowscale;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
if (price == 0)
|
|
|
{
|
|
|
nofeedays = 0;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (nowgrade > 1)
|
|
|
{
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (nowscale - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - prescale);
|
|
|
sumfee += gradefee;
|
|
|
prescale = nowscale;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (feedays > nowscale)
|
|
|
{
|
|
|
gradefee = outnums * price * (feedays - nowscale);
|
|
|
sumfee += gradefee;
|
|
|
}
|
|
|
totaloutfee += sumfee;
|
|
|
}
|
|
|
}
|
|
|
return totaloutfee;
|
|
|
}
|
|
|
|
|
|
private string GetWmsFeeCodeList()
|
|
|
{
|
|
|
WmsFeeCodeDA WmsFeeCodeDA = new WmsFeeCodeDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
//string strCondition = "";
|
|
|
//string strTopInclude = "";
|
|
|
//string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in where 1>0 {1} {2} ORDER BY BLNO,GOODSNAME,DODATE ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in WHERE BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE 1>0 {2} {3} ORDER BY BLNO,GOODSNAME,DODATE ) {2} {3} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql = String.Format(" SELECT BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK"
|
|
|
// + " FROM wms_in where 1>0 {0} {1} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strAuthorityCondition, strCondition);
|
|
|
//}
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT a.BSNO,a.BLNO,convert(char(10),a.DODATE,120) DODATE,a.GOODSNAME,a.GOODSMODEL,a.GOODSSTOCK,isnull(b.GOODSPFSL,0) GOODSPFSL,isnull(b.TRUCKNO,'') TRUCKNO,isnull(b.REMARK,'') REMARK,a.STORAGENAME "
|
|
|
// + " FROM wms_in a left outer join wms_out_detail b on a.bsno=b.INBSNO where 1>0 {0} {1} "
|
|
|
// + " ORDER BY a.BLNO,a.GOODSNAME,a.DODATE ", strAuthorityCondition, strCondition);
|
|
|
strSql = String.Format(" SELECT GID,UNITPRICE,REMARK,CREATEUSER,CREATETIME "
|
|
|
+ " FROM wms_feeCode where BSNO='{0}' {1} "
|
|
|
+ " ORDER BY FEETYPE,FEENAME ", strbsno, strAuthorityCondition);
|
|
|
sourceTable = WmsFeeCodeDA.GetRateListByCondition(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
#region Getwmsoutdetaillist`
|
|
|
/// <summary>
|
|
|
/// Getwmsoutdetaillist
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string Getwmsoutdetaillist()
|
|
|
{
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
//string strCondition = "";
|
|
|
//string strTopInclude = "";
|
|
|
//string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in where 1>0 {1} {2} ORDER BY BLNO,GOODSNAME,DODATE ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in WHERE BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE 1>0 {2} {3} ORDER BY BLNO,GOODSNAME,DODATE ) {2} {3} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql = String.Format(" SELECT BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK"
|
|
|
// + " FROM wms_in where 1>0 {0} {1} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strAuthorityCondition, strCondition);
|
|
|
//}
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT a.BSNO,a.BLNO,convert(char(10),a.DODATE,120) DODATE,a.GOODSNAME,a.GOODSMODEL,a.GOODSSTOCK,isnull(b.GOODSPFSL,0) GOODSPFSL,isnull(b.TRUCKNO,'') TRUCKNO,isnull(b.REMARK,'') REMARK,a.STORAGENAME "
|
|
|
// + " FROM wms_in a left outer join wms_out_detail b on a.bsno=b.INBSNO where 1>0 {0} {1} "
|
|
|
// + " ORDER BY a.BLNO,a.GOODSNAME,a.DODATE ", strAuthorityCondition, strCondition);
|
|
|
//"","提单号","入库单号","出库单号","转移对象","仓库名称","品名","型号","入库日期","出库日期"
|
|
|
//,"入库数量","剩余库存","剩余件数","本次出库","仓储费","仓储天数","车号","制单人","制单时间","备注"
|
|
|
|
|
|
//strSql = String.Format(" SELECT a.GID,b.BLNO,a.INBSNO,a.OUTBSNO,a.CUSTOMERNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,convert(char(10),b.DODATE,20) INDATE,convert(char(10),a.DODATE,20) OUTDATE, "
|
|
|
// + " b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.ARFEE,a.APFEE,a.GOODSOUTFEE,a.GOODSOUTFEEAP "
|
|
|
// + ",datediff(day,b.DODATE,a.DODATE)+1 days,feedays= case when (datediff(day,b.DODATE,a.DODATE)+1-isnull(c.FEESCALE,0)) <=0 then 0 else datediff(day,b.DODATE,a.DODATE)+1-isnull(c.FEESCALE,0) end,a.TRUCKNO, a.CREATEUSER, a.CREATETIME, a.REMARK "
|
|
|
// + " FROM wms_out_detail a left outer join wms_in b on a.INBSNO=b.BSNO left outer join (select * from wms_rate where isnull(FEEGRADE,0)=1 and isnull(FEEPRICE,0)=0 ) as c on c.BSNO=a.ASSOCIATEDNO and c.customername=a.customername where b.ISLOCK=1 and b.ISDELETE=0 and a.ASSOCIATEDNO='{0}' and a.OUTBSNO='{1}' {2} "
|
|
|
// + " ORDER BY a.bsno ", stropseaibsno, strwmsoutbsno, strAuthorityCondition);
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT a.GID,b.BLNO,b.WMSNO,a.OUTBSNO,a.CLIENTNAMEOLD,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,convert(char(10),b.WMSDATE,20) INDATE,convert(char(10),a.DODATE,20) OUTDATE, b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.ARFEE,a.APFEE,a.GOODSOUTFEE,a.GOODSOUTFEEAP,datediff(day,b.WMSDATE,a.DODATE)+1 days,feedays= case when (datediff(day,b.WMSDATE,a.DODATE)+1-isnull(c.FEESCALE,0)) <=0 then 0 else datediff(day,b.WMSDATE,a.DODATE)+1-isnull(c.FEESCALE,0) end,a.TRUCKNO, CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER), a.CREATETIME, a.REMARK "//,a.CUSTOMERNAME
|
|
|
// + " FROM wms_out_detail a left outer join wms b on a.INBSNO=b.GID left outer join (select * from wms_rate where isnull(FEEGRADE,0)=1 and isnull(FEEPRICE,0)=0 ) as c on c.BSNO=a.ASSOCIATEDNO and c.customername=a.customername where b.ISLOCK=1 and b.ISDELETE=0 and a.ASSOCIATEDNO='{0}' and a.OUTBSNO='{1}' {2} "
|
|
|
// + " ORDER BY a.bsno ", stropseaibsno, strwmsoutbsno, strAuthorityCondition);
|
|
|
|
|
|
|
|
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
|
|
//("", "提单号", "入库单号", "出库单号", "转移对象", "仓库名称", "品名", "型号", "入库日期", "出库日期", "入库数量", "剩余库存", "剩余件数",
|
|
|
// 13 14 15 16 17 18 19 20 21 22 23 24
|
|
|
//"出库件数", "出库数量", "应收出库费", "应付出库费", "应收仓储费", "应付仓储费", "仓储天数", "计费天数", "车号", "制单人", "制单时间", "备注");
|
|
|
|
|
|
strSql = String.Format(" SELECT a.GID,b.BLNO,b.WMSNO,a.OUTBSNO,a.CLIENTNAMEOLD,c.ARCLIENT,c.TRUCKNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,convert(char(10),b.WMSDATE,20) INDATE,convert(char(10),a.DODATE,20) OUTDATE,days=(datediff(day,b.WMSDATE,a.DODATE)+1),convert(char(10),a.STARTBILLINGDATE,20) STARTBILLINGDATE,convert(char(10),a.ENDBILLINGDATE,20) ENDBILLINGDATE,a.FEEDAYS,b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.ARFEE,a.APFEE,a.GOODSOUTFEE,a.GOODSOUTFEEAP"
|
|
|
+ ",a.TRUCKNO, CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER), a.CREATETIME, a.REMARK "//,a.CUSTOMERNAME
|
|
|
+ " FROM wms_out_detail a left outer join wms b on a.INBSNO=b.GID left outer join wms_out as c on a.OUTBSNO=c.BSNO where b.ISLOCK=1 and b.ISDELETE=0 and a.ASSOCIATEDNO='{0}' and a.OUTBSNO='{1}' {2} "
|
|
|
+ " ORDER BY a.bsno ", stropseaibsno, strwmsoutbsno, strAuthorityCondition);
|
|
|
sourceTable = WmsInDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 出库合计数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string SumJs()
|
|
|
{
|
|
|
decimal sum = 0;
|
|
|
decimal num = 0;
|
|
|
if (strsum.Trim().Equals("") || strsum.Equals(null))
|
|
|
{
|
|
|
sum = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sum = decimal.Parse(strsum);
|
|
|
}
|
|
|
num = decimal.Parse(strnum);
|
|
|
if (strmode == "check")
|
|
|
{
|
|
|
sum += num;
|
|
|
}
|
|
|
else if (strmode == "uncheck")
|
|
|
{
|
|
|
if (sum > num)
|
|
|
{
|
|
|
sum -= num;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sum = 0;
|
|
|
}
|
|
|
}
|
|
|
StringBuilder totalBuilder = new StringBuilder();
|
|
|
totalBuilder.Append("{");
|
|
|
totalBuilder.Append("\"totals\":");
|
|
|
totalBuilder.Append("[");
|
|
|
totalBuilder.Append("{");
|
|
|
|
|
|
totalBuilder.Append("\"sum\":" + sum.ToString());
|
|
|
|
|
|
totalBuilder.Append("}");
|
|
|
totalBuilder.Append("]");
|
|
|
totalBuilder.Append("}");
|
|
|
return totalBuilder.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 根据INFO_CLIENT.GID返回VW_WmsRateList仓储费率列表信息JSON字符串
|
|
|
/// <summary>
|
|
|
/// 根据INFO_CLIENT.GID返回VW_WmsRateList仓储费率列表信息JSON字符串
|
|
|
/// </summary>
|
|
|
/// <returns>返回VW_WmsRateList仓储费率列表信息JSON字符串</returns>
|
|
|
public string GetRateListJsonByCusID(string strcustid)
|
|
|
{
|
|
|
string strSql = "";
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
strSql =String.Format ( " SELECT (newid()) GID,CUSTOMERNAME, CONTRACTNO, STARTTIME, ENDTIME, GOODSNAME FROM VW_WmsRateList "
|
|
|
+ " where CUSTOMERNAME in (select SHORTNAME from info_client where gid='{0}')"
|
|
|
+" order by CUSTOMERNAME,CONTRACTNO",strcustid);
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
public string BuildXML()
|
|
|
{
|
|
|
string strMark="0";
|
|
|
int iPos = 0;
|
|
|
|
|
|
StringBuilder resultBuilder = new StringBuilder();
|
|
|
|
|
|
resultBuilder.Append("<?xml version=\"1.0\" ?>");
|
|
|
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
|
|
|
if (!string.IsNullOrEmpty(strMark))
|
|
|
{
|
|
|
string js = "";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
DataSet ds = T_ALL_DA.GetTCodeGoods();
|
|
|
if (ds != null)
|
|
|
{
|
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
|
{
|
|
|
if (dr["GOODCODE"].ToString().Trim() != "" || dr["GOODNAME"].ToString().Trim() != "")
|
|
|
{
|
|
|
js = dr["GOODCODE"].ToString().Trim() + " | " + dr["GOODNAME"].ToString().Trim();
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", dr["GOODCODE"].ToString().Trim(), js);//dr["GOODNAME"].ToString().Trim());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
|
|
|
resultBuilder.Append("</complete>");
|
|
|
return resultBuilder.ToString().Replace("&", "&");
|
|
|
}
|
|
|
|
|
|
public XmlDocument GetDoc()
|
|
|
{
|
|
|
XmlDocument xmldoc = new XmlDocument();
|
|
|
string content = BuildXML();
|
|
|
try
|
|
|
{
|
|
|
xmldoc.LoadXml(content);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
}
|
|
|
return xmldoc;
|
|
|
}
|
|
|
|
|
|
public XmlDocument GetMblnoNew()
|
|
|
{
|
|
|
XmlDocument xmldoc = new XmlDocument();
|
|
|
string content = BuildXMLMblnoNew();
|
|
|
try
|
|
|
{
|
|
|
xmldoc.LoadXml(content);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
}
|
|
|
return xmldoc;
|
|
|
}
|
|
|
|
|
|
public string BuildXMLMblnoNew()
|
|
|
{
|
|
|
string strMark="0";
|
|
|
int iPos = 0;
|
|
|
|
|
|
StringBuilder resultBuilder = new StringBuilder();
|
|
|
|
|
|
resultBuilder.Append("<?xml version=\"1.0\" ?>");
|
|
|
resultBuilder.AppendFormat("<complete{0}>", iPos == 0 ? string.Empty : " add=\"true\"");
|
|
|
if (!string.IsNullOrEmpty(strMark))
|
|
|
{
|
|
|
if (stropseaibsno != null)
|
|
|
{
|
|
|
string js = "select mblno from op_seai where bsno='" + stropseaibsno + "' or PARENTID='" + stropseaibsno + "' order by PARENTID desc,LEVELS desc";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(js);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
|
{
|
|
|
if (dr["mblno"].ToString().Trim() != "")
|
|
|
{
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", dr["mblno"].ToString().Trim(), dr["mblno"].ToString().Trim());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
|
|
|
resultBuilder.Append("</complete>");
|
|
|
return resultBuilder.ToString().Replace("&", "&");
|
|
|
}
|
|
|
|
|
|
#region 获取费率信息
|
|
|
/// <summary>
|
|
|
/// 获取费率信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetRateBySearch(string strSearch)
|
|
|
{
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
TopSeaiEntity topseaientity = new TopSeaiEntity();
|
|
|
SeaImportInfoDA opseaiDA = new SeaImportInfoDA();
|
|
|
topseaientity = opseaiDA.GetID(strbsno);
|
|
|
string customername = "";
|
|
|
if (!strcustomer.Equals(""))
|
|
|
{
|
|
|
customername = strcustomer;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (topseaientity != null)
|
|
|
{
|
|
|
customername = topseaientity.CUSTOMERNAME;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
strCondition += String.Format(" and BSNO='{0}' and CUSTOMERNAME like '%{1}%' ", strbsno, customername);
|
|
|
//if (strSearch != null)
|
|
|
//{
|
|
|
// if (!strSearch.Trim().Equals(""))
|
|
|
// {
|
|
|
// string tempSearch = strSearch;
|
|
|
// tempSearch = tempSearch.Replace("{", "");
|
|
|
// tempSearch = tempSearch.Replace("}", "");
|
|
|
// tempSearch = tempSearch.Replace("[", "");
|
|
|
// tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
// string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
// for (int i = 0; i < searchArg.Length; i++)
|
|
|
// {
|
|
|
// string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
// if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
// {
|
|
|
// switch (strArg[0].Replace("\"", ""))
|
|
|
// {
|
|
|
// case "bt"://ETD BeginDate
|
|
|
// strCondition += String.Format(" AND STARTTIME = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
// break;
|
|
|
// case "et"://ETD EndDate
|
|
|
// strCondition += String.Format(" AND ENDTIME = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
// break;
|
|
|
// case "cusid"://CUSTOMER
|
|
|
// strCondition += String.Format(" AND CLIENTGID = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
// break;
|
|
|
// case "no"://NO
|
|
|
// strCondition += String.Format(" AND CONTRACTNO = '{0}'", strArg[1].Replace("\"", ""));
|
|
|
// break;
|
|
|
// case "goods":
|
|
|
// strCondition += String.Format(" AND GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
// break;
|
|
|
// default:
|
|
|
// break;
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strCondition += " and 0>1";
|
|
|
//}
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
{
|
|
|
if (iCurrentPage == 1)
|
|
|
{
|
|
|
strSql = String.Format(" SELECT {0} GID,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME,BSNO "
|
|
|
+ " FROM wms_rate where 1>0 {1} {2} ORDER BY FEEGRADE ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
strSql = String.Format(" SELECT {0} GID,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME,BSNO "
|
|
|
+ " FROM wms_rate WHERE GID NOT IN "
|
|
|
+ " (SELECT {1} GID FROM wms_rate WHERE 1>0 {2} {3} ORDER BY FEEGRADE ) {2} {3} "
|
|
|
+ " ORDER BY FEEGRADE ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format(" SELECT GID,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME,BSNO"
|
|
|
+ " FROM wms_rate where 1>0 {0} {1} "
|
|
|
+ " ORDER BY FEEGRADE ", strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取费率信息
|
|
|
/// <summary>
|
|
|
/// 获取费率信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetRateList( string mode)
|
|
|
{
|
|
|
WmsRateDA WmsRateDA =new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
switch(mode)
|
|
|
{
|
|
|
case "search":
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
if (strCacheName != null)
|
|
|
{
|
|
|
if (Session[strCacheName] != null)
|
|
|
{
|
|
|
Session.Remove(strCacheName);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND STARTTIME >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND ENDTIME <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cusid"://CUSTOMER
|
|
|
strCondition += String.Format(" AND CLIENTGID = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "no"://NO
|
|
|
strCondition += String.Format(" AND CONTRACTNO = '{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
|
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
{
|
|
|
if (iCurrentPage == 1)
|
|
|
{
|
|
|
strSql = String.Format(" SELECT {0} GID,GOODSNAME,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME "
|
|
|
+ " FROM wms_rate where 1>0 {1} {2} ORDER BY GOODSNAME DESC ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
strSql = String.Format(" SELECT {0} GID,GOODSNAME,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME "
|
|
|
+ " FROM wms_rate WHERE GID NOT IN "
|
|
|
+ " (SELECT {1} GID FROM wms_rate WHERE 1>0 {2} {3} ORDER BY GOODSNAME DESC ) {2} {3} "
|
|
|
+ " ORDER BY GOODSNAME DESC ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format(" SELECT GID,GOODSNAME,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME"
|
|
|
+ " FROM wms_rate where 1>0 {0} {1} "
|
|
|
+ " ORDER BY GOODSNAME DESC ", strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
break;
|
|
|
case "cus":
|
|
|
strSql = String.Format(" SELECT GID,GOODSNAME,FEEGRADE,FEESCALE,FEEPRICE,FEEUNIT,REMARK,CREATEUSER,MODIFIEDTIME FROM wms_rate where CUSTOMERNAME='{0}'", strcustomer);
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
break;
|
|
|
}
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
# region 删除仓储费率(Wms_Feecode),并返回删除操作结果
|
|
|
/// <summary>
|
|
|
/// 删除仓储费率,并返回删除操作结果
|
|
|
/// </summary>
|
|
|
/// <param name="tempFeeID"></param>
|
|
|
/// <returns>返回删除操作结果</returns>
|
|
|
private bool DeleteWmsFeeCode(string strRateGid)
|
|
|
{
|
|
|
bool iResult = false;
|
|
|
WmsFeeCodeDA WmsFeeCodeDA = new WmsFeeCodeDA();
|
|
|
|
|
|
iResult = WmsFeeCodeDA.Delete(strRateGid);
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
# region 删除仓储费率(Wms_rate),并返回删除操作结果
|
|
|
/// <summary>
|
|
|
/// 删除仓储费率,并返回删除操作结果
|
|
|
/// </summary>
|
|
|
/// <param name="tempFeeID"></param>
|
|
|
/// <returns>返回删除操作结果</returns>
|
|
|
private bool DeleteWmsRate(string strRateGid)
|
|
|
{
|
|
|
bool iResult=false ;
|
|
|
WmsRateDA wmsRateDA = new WmsRateDA();
|
|
|
|
|
|
iResult = wmsRateDA.Delete(strRateGid);
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
# region 多条件删除仓储费率(Wms_rate),并返回删除操作结果
|
|
|
/// <summary>
|
|
|
/// 多条件删除仓储费率,并返回删除操作结果
|
|
|
/// </summary>
|
|
|
/// <param name="tempFeeID"></param>
|
|
|
/// <returns>返回删除操作结果</returns>
|
|
|
private bool DeleteWmsRateDtj()
|
|
|
{
|
|
|
bool iResult = false;
|
|
|
WmsRateDA wmsRateDA = new WmsRateDA();
|
|
|
string cusid = "", no = "", goods = "";
|
|
|
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "cusid"://CUSTOMER
|
|
|
cusid = strArg[1].Replace("\"", "");
|
|
|
break;
|
|
|
case "no"://CONTRACTNO
|
|
|
no = strArg[1].Replace("\"", "");
|
|
|
break;
|
|
|
case "goods"://goodsname
|
|
|
goods = strArg[1].Replace("\"", "");
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
iResult = wmsRateDA.DeleteDTj(strbsno);
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取费率信息
|
|
|
/// <summary>
|
|
|
/// 获取费率信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetWmsOutListBySearch()
|
|
|
{
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "clientnameold"://
|
|
|
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://
|
|
|
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "ischange"://
|
|
|
string ls = strArg[1].Replace("\"", "");
|
|
|
if(ls.Trim()!="")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
|
|
|
}
|
|
|
break;
|
|
|
case "bsno"://NO
|
|
|
strCondition += String.Format(" AND (a.bsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.bsno like '%{0}%') or a.bsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%' or a.BZTCHNO like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "associatedno"://NO
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsstandard":
|
|
|
strCondition += String.Format(" AND a.BSNO in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strbsno != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
}
|
|
|
}
|
|
|
strCondition += strRange;
|
|
|
//
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,b.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,b.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CUSTOMERNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID "
|
|
|
// + " where c.ISDELETE=0 {1} {2} ORDER BY a.GOODSNAME DESC ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,b.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,b.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CUSTOMERNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID WHERE c.ISDELETE=0 and a.GID NOT IN "
|
|
|
// + " (SELECT {1} a.GID from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID WHERE c.ISDELETE=0 {2} {3} ORDER BY a.GOODSNAME DESC ) {2} {3} "
|
|
|
// + " ORDER BY a.GOODSNAME DESC ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,b.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,b.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CUSTOMERNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID where c.ISDELETE=0 {0} {1} "
|
|
|
// + " ORDER BY a.GOODSNAME DESC ", strAuthorityCondition, strCondition);
|
|
|
//}
|
|
|
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
{
|
|
|
if (iCurrentPage == 1)
|
|
|
{
|
|
|
//strSql = String.Format(" SELECT {0} a.GID,(case a.ISLOCK when 1 then '是' else '否' end) as ISLOCK"
|
|
|
//+ ",(case a.ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
|
////+ ",(case when a.REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK"
|
|
|
//+ ",blno=(case a.CHARGEUNIT when 'CBM' then (select top 1 BLNO from wms_in where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) else (select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) end)"
|
|
|
//+ ",a.MBLNONEW,a.CUSTOMNO,a.BSNO,a.CUSTOMERNAME,a.CLIENTNAMEOLD,a.ARCLIENT,a.TRUCKNAME"
|
|
|
//+ ",WMSDATE=(case a.CHARGEUNIT when 'CBM' then (select convert(char(10),DODATE,20) as DODATE from wms_in where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) else (select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) end)"
|
|
|
//+ ",convert(char(10),a.DODATE,20) as DODATE"
|
|
|
//+ ",STARTBILLINGDATE=(select top 1 convert(char(10),STARTBILLINGDATE,20) as STARTBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
//+ ",ENDBILLINGDATE=(select top 1 convert(char(10),ENDBILLINGDATE,20) as ENDBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
////+ ",convert(char(10),a.OLDCUSTFEEDATE,20) as OLDCUSTFEEDATE"
|
|
|
//+ ",a.GOODSNAME,a.GOODSMODEL,a.CHARGEUNIT,a.GOODSPFSL,a.GOODSPACKPFSL,a.GOODSOUTFEE,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,a.TRUCKNO "//,newcust=(select top 1 CUSTOMERNAME from wms where ISDELETE=0 and ISLOCK=1 and gid in (select top 1 inbsno from wms_out_detail where outbsno=a.bsno)) "
|
|
|
//+ " from wms_out a "//left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID "
|
|
|
//+ " where 1=1 {1} {2} ORDER BY a.BSNO desc,a.CREATETIME desc", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
|
|
|
|
|
|
//是否入账、货权转移、提单号、吨数、品名、牌号、备案清单号、货主、转移对象、入库日期、出库日期、计费日期、车号 ---以上字段提前(中物储青岛王晨坤)2014-04-22
|
|
|
strSql = String.Format(" SELECT {0} a.GID,(case a.ISLOCK when 1 then '是' else '否' end) as ISLOCK"
|
|
|
+ ",(case a.ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
|
//+ ",(case when a.REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK"
|
|
|
+ ",blno=(case a.CHARGEUNIT when 'CBM' then (select top 1 BLNO from wms_in where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) else (select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) end)"
|
|
|
+ ",a.GOODSPFSL,a.GOODSPACKPFSL,a.GOODSNAME,a.GOODSMODEL,a.CUSTOMNO,a.CUSTOMERNAME,a.CLIENTNAMEOLD"
|
|
|
+ ",WMSDATE=(case a.CHARGEUNIT when 'CBM' then (select convert(char(10),DODATE,20) as DODATE from wms_in where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) else (select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) end)"
|
|
|
+ ",convert(char(10),a.DODATE,20) as DODATE"
|
|
|
+ ",STARTBILLINGDATE=(select top 1 convert(char(10),STARTBILLINGDATE,20) as STARTBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
+ ",ENDBILLINGDATE=(select top 1 convert(char(10),ENDBILLINGDATE,20) as ENDBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
//+ ",convert(char(10),a.OLDCUSTFEEDATE,20) as OLDCUSTFEEDATE"
|
|
|
+ ",a.TRUCKNO,a.MBLNONEW,a.BSNO,a.ARCLIENT,a.TRUCKNAME,a.CHARGEUNIT,a.GOODSOUTFEE,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,a.BZTCHNO,isDLSF=(case when isnull(a.ARCLIENTWMSOUT,'')<>'' and isnull(a.ARCLIENTWMSOUT,'')<>a.CUSTOMERNAME then '是' else '' end) "//,newcust=(select top 1 CUSTOMERNAME from wms where ISDELETE=0 and ISLOCK=1 and gid in (select top 1 inbsno from wms_out_detail where outbsno=a.bsno)) "
|
|
|
+ " from wms_out a "//left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID "
|
|
|
+ " where 1=1 {1} {2} ORDER BY a.BSNO desc,a.CREATETIME desc", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
strSql = String.Format("SELECT {0} a.GID,(case a.ISLOCK when 1 then '是' else '否' end) as ISLOCK"
|
|
|
+ ",(case a.ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
|
//+ ",(case when a.REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK"
|
|
|
+ ",blno=(case a.CHARGEUNIT when 'CBM' then (select top 1 BLNO from wms_in where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) else (select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) end)"
|
|
|
+ ",a.GOODSPFSL,a.GOODSPACKPFSL,a.GOODSNAME,a.GOODSMODEL,a.CUSTOMNO,a.CUSTOMERNAME,a.CLIENTNAMEOLD"
|
|
|
+ ",WMSDATE=(case a.CHARGEUNIT when 'CBM' then (select convert(char(10),DODATE,20) as DODATE from wms_in where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) else (select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) end)"
|
|
|
+ ",convert(char(10),a.DODATE,20) as DODATE"
|
|
|
+ ",STARTBILLINGDATE=(select top 1 convert(char(10),STARTBILLINGDATE,20) as STARTBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
+ ",ENDBILLINGDATE=(select top 1 convert(char(10),ENDBILLINGDATE,20) as ENDBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
//+ ",convert(char(10),a.OLDCUSTFEEDATE,20) as OLDCUSTFEEDATE"
|
|
|
+ ",a.TRUCKNO,a.MBLNONEW,a.BSNO,a.ARCLIENT,a.TRUCKNAME,a.CHARGEUNIT,a.GOODSOUTFEE,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,a.BZTCHNO,isDLSF=(case when isnull(a.ARCLIENTWMSOUT,'')<>'' and isnull(a.ARCLIENTWMSOUT,'')<>a.CUSTOMERNAME then '是' else '' end) "//,newcust=(select top 1 CUSTOMERNAME from wms where ISDELETE=0 and ISLOCK=1 and gid in (select top 1 inbsno from wms_out_detail where outbsno=a.bsno)) "
|
|
|
+ " from wms_out a "//left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID "
|
|
|
+ " WHERE 1=1 and a.GID NOT IN (SELECT {1} a.GID from wms_out a "//left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms c on b.INBSNO=c.GID
|
|
|
+ " WHERE 1=1 {2} {3} ORDER BY a.BSNO desc,a.CREATETIME desc) {2} {3} "
|
|
|
+ " ORDER BY a.BSNO desc,a.CREATETIME desc", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = " SELECT a.GID,(case a.ISLOCK when 1 then '是' else '否' end) as ISLOCK"
|
|
|
+ ",(case a.ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
|
//+ ",(case when a.REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK"
|
|
|
+ ",blno=(case a.CHARGEUNIT when 'CBM' then (select top 1 BLNO from wms_in where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) else (select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=a.bsno)) end)"
|
|
|
+ ",a.GOODSPFSL,a.GOODSPACKPFSL,a.GOODSNAME,a.GOODSMODEL,a.CUSTOMNO,a.CUSTOMERNAME,a.CLIENTNAMEOLD"
|
|
|
+ ",WMSDATE=(case a.CHARGEUNIT when 'CBM' then (select convert(char(10),DODATE,20) as DODATE from wms_in where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) else (select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=(select top 1 INBSNO from wms_out_detail where OUTBSNO=a.BSNO order by GID)) end)"
|
|
|
+ ",convert(char(10),a.DODATE,20) as DODATE"
|
|
|
+ ",STARTBILLINGDATE=(select top 1 convert(char(10),STARTBILLINGDATE,20) as STARTBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
+ ",ENDBILLINGDATE=(select top 1 convert(char(10),ENDBILLINGDATE,20) as ENDBILLINGDATE from wms_out_detail where OUTBSNO=a.BSNO order by GID)"
|
|
|
//+ ",convert(char(10),a.OLDCUSTFEEDATE,20) as OLDCUSTFEEDATE"
|
|
|
+ ",a.TRUCKNO,a.MBLNONEW,a.BSNO,a.ARCLIENT,a.TRUCKNAME,a.CHARGEUNIT,a.GOODSOUTFEE,CREATEUSER=(select SHOWNAME from [user] where gid=a.CREATEUSER),convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,a.BZTCHNO,'' as isDLSF "
|
|
|
+ " from wms_out a 1<0";
|
|
|
}
|
|
|
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取费率信息
|
|
|
/// <summary>
|
|
|
/// 获取费率信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private int GetWmsOutLispagetBySearch()
|
|
|
{
|
|
|
int TmpCount = 0;
|
|
|
WmsRateDA WmsRateDA = new WmsRateDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
//string strTopInclude = "";
|
|
|
//string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "bt"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "et"://ETD EndDate
|
|
|
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "clientnameold"://
|
|
|
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://
|
|
|
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "ischange"://
|
|
|
string ls = strArg[1].Replace("\"", "");
|
|
|
if (ls.Trim() != "")
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
|
|
|
}
|
|
|
break;
|
|
|
case "bsno"://NO
|
|
|
strCondition += String.Format(" AND (a.bsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.bsno like '%{0}%') or a.bsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "associatedno"://NO
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goods":
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsstandard":
|
|
|
strCondition += String.Format(" AND a.BSNO in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (strbsno != "" && strbsno!=null)
|
|
|
{
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
}
|
|
|
}
|
|
|
strCondition += strRange;
|
|
|
//
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,a.CUSTOMERNAME,convert(char(19),a.DODATE,120),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CLIENTNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO "
|
|
|
// + " where c.ISDELETE=0 {1} {2} ORDER BY GOODSNAME DESC ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,a.CUSTOMERNAME,convert(char(19),a.DODATE,120),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CLIENTNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO WHERE c.ISDELETE=0 and a.GID NOT IN "
|
|
|
// + " (SELECT {1} a.GID from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO WHERE c.ISDELETE=0 {2} {3} ORDER BY GOODSNAME DESC ) {2} {3} "
|
|
|
// + " ORDER BY GOODSNAME DESC ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql = String.Format(" SELECT {0} a.GID,a.BSNO,a.CUSTOMERNAME,convert(char(19),a.DODATE,120),a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,a.GOODSPFSL,a.GOODSOUTFEE,a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,convert(char(19),a.CREATETIME,120),a.ASSOCIATEDNO,isnull(c.CLIENTNAME,'') newcust "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO where c.ISDELETE=0 {0} {1} "
|
|
|
// + " ORDER BY GOODSNAME DESC ", strAuthorityCondition, strCondition);
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT COUNT(*) "
|
|
|
// + " from wms_out a left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO where c.ISDELETE=0 {0} {1} "
|
|
|
// , strAuthorityCondition, strCondition);
|
|
|
|
|
|
|
|
|
strSql = String.Format(" SELECT COUNT(*) "
|
|
|
+ " from wms_out a "//left outer join wms_out_detail b on a.BSNO=b.OUTBSNO left outer join wms_in c on b.INBSNO=c.BSNO
|
|
|
+ " where 1=1 {0} {1} "
|
|
|
, strAuthorityCondition, strCondition);
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
if (sourceTable!=null){
|
|
|
TmpCount=int.Parse(sourceTable.Rows[0][0].ToString());
|
|
|
}
|
|
|
return TmpCount;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取入库wms_in信息
|
|
|
/// <summary>
|
|
|
/// 获取入库wms_in信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetWmsInList()
|
|
|
{
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
//string strTopInclude = "";
|
|
|
//string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "opseaibsno"://CUSTOMER
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "blno"://NO
|
|
|
strCondition += String.Format(" AND BLNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsmodel":
|
|
|
strCondition += String.Format(" AND goodsmodel like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "store":
|
|
|
strCondition += String.Format(" AND STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "customno2":
|
|
|
strCondition += String.Format(" AND customno like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "bztchno2":
|
|
|
strCondition += String.Format(" AND bztchno like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!strbsno.Equals(null) && !strbsno.Equals(""))
|
|
|
{
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strbsno);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition += " and 0>1";
|
|
|
}
|
|
|
}
|
|
|
strCondition += " and CHARGEUNIT<>'CBM'";
|
|
|
strCondition += strRange2;
|
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
//UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modSeaImportList");
|
|
|
|
|
|
//if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
|
//{
|
|
|
// strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAILIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
|
//}
|
|
|
//if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
//{
|
|
|
// if (iCurrentPage == 1)
|
|
|
// {
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in where 1>0 {1} {2} ORDER BY BLNO,GOODSNAME,DODATE ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
// strTopInclude = "top " + iShowPage.ToString();
|
|
|
// strSql = String.Format(" SELECT {0} BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK "
|
|
|
// + " FROM wms_in WHERE BSNO NOT IN "
|
|
|
// + " (SELECT {1} BSNO FROM wms_in WHERE 1>0 {2} {3} ORDER BY BLNO,GOODSNAME,DODATE ) {2} {3} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql = String.Format(" SELECT BSNO,BLNO,DODATE,GOODSNAME,GOODSMODEL,GOODSSTOCK,0 BCPFSL,'' TRUCKNO,'' REMARK"
|
|
|
// + " FROM wms_in where 1>0 {0} {1} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strAuthorityCondition, strCondition);
|
|
|
//}
|
|
|
|
|
|
|
|
|
//strSql = String.Format(" SELECT a.BSNO,a.BLNO,convert(char(10),a.DODATE,120) DODATE,a.GOODSNAME,a.GOODSMODEL,a.GOODSSTOCK,isnull(b.GOODSPFSL,0) GOODSPFSL,isnull(b.TRUCKNO,'') TRUCKNO,isnull(b.REMARK,'') REMARK,a.STORAGENAME "
|
|
|
// + " FROM wms_in a left outer join wms_out_detail b on a.bsno=b.INBSNO where 1>0 {0} {1} "
|
|
|
// + " ORDER BY a.BLNO,a.GOODSNAME,a.DODATE ", strAuthorityCondition, strCondition);
|
|
|
|
|
|
//strSql = String.Format(" SELECT BSNO,CLIENTNAME,BLNO,convert(char(10),DODATE,120) DODATE,GOODSNAME,GOODSMODEL,GOODSPACKSTOCK,GOODSSTOCK,0 as GOODSPACKPFSL,0 as GOODSPFSL,0 as ARFEE,0 as APFEE,' ' as TRUCKNO,' ' as REMARK,STORAGENAME,ASSOCIATEDNO,(GOODSSTOCK/GOODSPACKSTOCK) GOODSKGS,CLIENTNAMEOLD "
|
|
|
// + " FROM wms_in where isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 {0} {1} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,DODATE ", strAuthorityCondition, strCondition);
|
|
|
//sourceTable = WmsInDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
strSql = String.Format(" SELECT GID,CUSTOMERNAME,BLNO,convert(char(10),WMSDATE,120) WMSDATE,convert(char(10),STARTBILLINGDATE,120) STARTBILLINGDATE,GOODSNAME,GOODSMODEL,convert(numeric(18,2),round((MARKETVALUE*GOODSSTOCK),2)) as MARKETVALUE,AREANAME,GOODSPACKSTOCK,GOODSSTOCK,0 as GOODSPACKPFSL,0 as GOODSPFSL,0 as ARFEE,0 as APFEE,' ' as TRUCKNO,' ' as REMARK,STORAGENAME,ASSOCIATEDNO,convert(numeric(18,4),(GOODSSTOCK/GOODSPACKSTOCK)) as GOODSKGS,CLIENTNAMEOLD,gid,newid() as wmsoutdetailgid,convert(char(10),STARTBILLINGDATEAP,120) STARTBILLINGDATEAP, CHARGEUNIT, GOODSPACKSTOCK as GOODSPACKSTOCK_EDIT, GOODSSTOCK as GOODSSTOCK_EDIT,MARKETVALUE as MARKETVALUE2 "
|
|
|
+ " FROM wms where isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 {0} {1} "
|
|
|
+ " ORDER BY BLNO,GOODSNAME,WMSDATE ", strAuthorityCondition, strCondition);
|
|
|
sourceTable = WmsInDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
|
|
|
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 获取入库wms_in信息_出库更新
|
|
|
/// <summary>
|
|
|
/// 获取入库wms_in信息
|
|
|
/// </summary>
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
private string GetWmsInListEdit()
|
|
|
{
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
DataTable sourceTable;
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
string strCondition = "";
|
|
|
//string strTopInclude = "";
|
|
|
//string strTopNotInclude = "";
|
|
|
string strSql = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "opseaibsno"://CUSTOMER
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "blno"://NO
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO in (select bsno from VW_Settlement where MBLNO like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsmodel":
|
|
|
strCondition += String.Format(" AND goodsmodel like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "store":
|
|
|
strCondition += String.Format(" AND STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "customno2":
|
|
|
strCondition += String.Format(" AND customno like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!strbsno.Equals(null) && !strbsno.Equals(""))
|
|
|
{
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strbsno);
|
|
|
}
|
|
|
//else
|
|
|
//{
|
|
|
// strCondition += " and 0>1";
|
|
|
//}
|
|
|
}
|
|
|
strCondition += " and CHARGEUNIT<>'CBM'";
|
|
|
//
|
|
|
string strAuthorityCondition = "";
|
|
|
//strSql = String.Format(" SELECT GID,CUSTOMERNAME,BLNO,convert(char(10),WMSDATE,120) WMSDATE,convert(char(10),STARTBILLINGDATE,120) STARTBILLINGDATE,GOODSNAME,GOODSMODEL,GOODSPACKSTOCK,GOODSSTOCK,0 as GOODSPACKPFSL,0 as GOODSPFSL,0 as ARFEE,0 as APFEE,' ' as TRUCKNO,' ' as REMARK,STORAGENAME,ASSOCIATEDNO,convert(numeric(18,4),(GOODSSTOCK/GOODSPACKSTOCK)) as GOODSKGS,CLIENTNAMEOLD "
|
|
|
// + " FROM wms where isnull(ISDELETE,0)=0 and isnull(ISLOCK,0)=1 and GOODSPACKSTOCK<>0 and GOODSSTOCK>0 {0} {1} "
|
|
|
// + " ORDER BY BLNO,GOODSNAME,WMSDATE ", strAuthorityCondition, strCondition);
|
|
|
|
|
|
//var headerArgs_wmsin = new Array("", "货主", "提单号", "入库日期", "开始计费日期", "品名", "牌号", "剩余件数", "剩余库存", "出库件数", "出库重量", "应收出库费", "应付出库费", "车号", "备注", "仓库名称", "进口委托单号", "单件吨数", "原货主");
|
|
|
|
|
|
strSql = String.Format(" SELECT GID,CUSTOMERNAME"
|
|
|
+ ",(select top 1 mblno from VW_Settlement where bsno=wms_out_detail.ASSOCIATEDNO) as BLNO"
|
|
|
+ ",convert(char(10),(select top 1 WMSDATE from wms where gid=wms_out_detail.inbsno),120) as WMSDATE"
|
|
|
+ ",convert(char(10),STARTBILLINGDATE,120) as STARTBILLINGDATE,GOODSNAME,GOODSMODEL"
|
|
|
+ ",(select top 1 convert(numeric(18,2),round((MARKETVALUE*GOODSSTOCK),2)) as MARKETVALUE from wms where gid=wms_out_detail.inbsno) as MARKETVALUE,AREANAME"
|
|
|
+ ",(select top 1 GOODSPACKSTOCK from wms where gid=wms_out_detail.inbsno) as GOODSPACKSTOCK"
|
|
|
+ ",(select top 1 GOODSSTOCK from wms where gid=wms_out_detail.inbsno) as GOODSSTOCK"
|
|
|
+ ",GOODSPACKPFSL,GOODSPFSL,ARFEE,APFEE,TRUCKNO,REMARK,STORAGENAME,ASSOCIATEDNO"
|
|
|
+ ",convert(numeric(18,4),isnull((GOODSPFSL/GOODSPACKPFSL),0)) as GOODSKGS,CLIENTNAMEOLD,inbsno,gid as wmsoutdetailgid,convert(char(10),STARTBILLINGDATEAP,120) STARTBILLINGDATEAP, CHARGEUNIT "
|
|
|
+ ",(select top 1 GOODSPACKSTOCK from wms where gid=wms_out_detail.inbsno)+GOODSPACKPFSL as GOODSPACKSTOCK_EDIT"
|
|
|
+ ",(select top 1 GOODSSTOCK from wms where gid=wms_out_detail.inbsno)+GOODSPFSL as GOODSSTOCK_EDIT"
|
|
|
+ ",(select top 1 MARKETVALUE from wms where gid=wms_out_detail.inbsno) as MARKETVALUE2 "
|
|
|
+ " FROM wms_out_detail where 1=1 {0} {1} and outbsno='{2}'"
|
|
|
+ " ORDER BY BLNO,GOODSNAME,WMSDATE ", strAuthorityCondition, strCondition, strwmsoutbsno);
|
|
|
|
|
|
sourceTable = WmsInDA.GetExcuteSql(strSql).Tables[0];
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace("\r\n", " ");
|
|
|
ls = ls.Replace("\n", " ");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 删除仓储费用(Wms_out、wms_out_detail、ch_fee ),修改wms_in、fee_gain 并返回删除操作结果
|
|
|
/// <summary>
|
|
|
/// 删除仓储费用(Wms_out、wms_out_detail、ch_fee ),修改wms_in、fee_gain 并返回删除操作结果
|
|
|
/// </summary>
|
|
|
/// <param name="tempGid">出库单GID</param>
|
|
|
/// <returns>值1删除成功 值小于1删除失败</returns>
|
|
|
public int DeleteWmsOutByGid(string tempGid)
|
|
|
{
|
|
|
int result = 0;
|
|
|
string Sqlstr = "";
|
|
|
//string tempfeeGid;
|
|
|
//string tempCurrency;
|
|
|
//int tempFeeType;
|
|
|
//decimal tempAmount;
|
|
|
//decimal tempRate;
|
|
|
//string tempBSNO;
|
|
|
//出库单信息
|
|
|
WmsOutEntity wmsoutentity = new WmsOutEntity();
|
|
|
WmsOutDA wmsoutDA = new WmsOutDA();
|
|
|
|
|
|
//ch_fee处理
|
|
|
IList<FeeEntity> FeeEntities = new List<FeeEntity>();
|
|
|
FeeDA feeDA = new FeeDA();
|
|
|
|
|
|
//入库单处理:修改
|
|
|
WmsInEntity wmsinentity = new WmsInEntity();
|
|
|
WmsOutDetailDA wmsoutdetailDA = new WmsOutDetailDA();
|
|
|
DataSet DsWmsOutDetail = new DataSet();
|
|
|
DataTable DtWmsOutDetail = new DataTable();
|
|
|
//string strSql = "";
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//判断出库单相关的op_Seai是否锁定
|
|
|
|
|
|
wmsoutentity = wmsoutDA.GetModel(tempGid,"");//出库单信息
|
|
|
|
|
|
#region 删除ch_fee、fee_gain仓储费用
|
|
|
/*
|
|
|
//ch_fee处理
|
|
|
FeeEntities = feeDA.GetFeeByWmsOutBsno(wmsoutentity.BSNO);
|
|
|
foreach (FeeEntity feeEntity in FeeEntities)
|
|
|
{//逐行删除费用ch_fee
|
|
|
tempfeeGid = feeEntity.GID;
|
|
|
tempCurrency = feeEntity.Currency;
|
|
|
tempFeeType = feeEntity.FeeType;
|
|
|
tempAmount = feeEntity.Amount;
|
|
|
tempRate = feeEntity.ExchangeRate;
|
|
|
tempBSNO = feeEntity.BSNO;
|
|
|
if (feeEntity.FeeStatus == 1 || feeEntity.FeeStatus == 6)
|
|
|
{
|
|
|
//先将费用利润表中费用金额减兑
|
|
|
if (tempFeeType == 1)
|
|
|
{
|
|
|
if (tempCurrency == "RMB")
|
|
|
{
|
|
|
strSql = String.Format(" UPDATE fee_gain SET RMBDR = RMBDR - {0},DRTTL = DRTTL - {0},RMBPROFIT = RMBPROFIT - {0},TTLPROFIT = TTLPROFIT - {0} WHERE BSNO = '{1}' ", tempAmount, tempBSNO);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format(" UPDATE fee_gain SET USDDR = USDDR - {0},DRTTL = DRTTL - {1},USDPROFIT = USDPROFIT - {0},TTLPROFIT = TTLPROFIT - {1} WHERE BSNO = '{2}' ", tempAmount, (tempAmount * tempRate), tempBSNO);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (tempCurrency == "RMB")
|
|
|
{
|
|
|
strSql = String.Format(" UPDATE fee_gain SET RMBCR = RMBCR - {0},CRTTL = CRTTL - {0},RMBPROFIT = RMBPROFIT + {0},TTLPROFIT = TTLPROFIT + {0} WHERE BSNO = '{1}' ", tempAmount, tempBSNO);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = String.Format(" UPDATE fee_gain SET USDCR = USDCR - {0},CRTTL = CRTTL - {1},USDPROFIT = USDPROFIT + {0},TTLPROFIT = TTLPROFIT + {1} WHERE BSNO = '{2}' ", tempAmount, (tempAmount * tempRate), tempBSNO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql, null);
|
|
|
|
|
|
//重新计算百分率(利润总和/应付费用总和)
|
|
|
SqlParameter[] precentParms = new SqlParameter[] {
|
|
|
new SqlParameter(PARM_FEEPROFIT_BSNO,SqlDbType.VarChar,100)
|
|
|
};
|
|
|
|
|
|
precentParms[0].Value = tempBSNO;
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_FEE_PROFIT_PRECENT, precentParms);
|
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_FEE_GID, SqlDbType.VarChar, 36);
|
|
|
parm.Value = tempfeeGid;
|
|
|
//从费用表ch_fee中将费用删除
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_DELETE_FEE_BY_GID, parm);
|
|
|
}
|
|
|
//else
|
|
|
//{
|
|
|
// result = -3;
|
|
|
// return result;
|
|
|
//}
|
|
|
}
|
|
|
*/
|
|
|
#endregion
|
|
|
|
|
|
//出库单明细列表
|
|
|
DsWmsOutDetail = wmsoutdetailDA.GetList(String.Format(" OUTBSNO='{0}' ", wmsoutentity.BSNO));
|
|
|
DtWmsOutDetail = DsWmsOutDetail.Tables[0];
|
|
|
foreach (DataRow routdetail in DtWmsOutDetail.Rows)
|
|
|
{
|
|
|
//入库单处理:修改
|
|
|
decimal GOODSPFSL = 0;
|
|
|
decimal GOODSPACKPFSL = 0;
|
|
|
string INBSNO = "";
|
|
|
GOODSPFSL= decimal.Parse(routdetail["GOODSPFSL"].ToString());
|
|
|
GOODSPACKPFSL = decimal.Parse(routdetail["GOODSPACKPFSL"].ToString().Equals(null) ? "0" : routdetail["GOODSPACKPFSL"].ToString());
|
|
|
INBSNO = routdetail["INBSNO"].ToString();
|
|
|
Sqlstr = String.Format("update wms set GOODSSTOCK=GOODSSTOCK+{0},GOODSPACKSTOCK=GOODSPACKSTOCK+{1} where ISDELETE=0 and ISLOCK=1 and gid='{2}' ", GOODSPFSL, GOODSPACKPFSL, INBSNO);
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
Sqlstr = "";
|
|
|
}
|
|
|
//wms_rate_detail处理:删除
|
|
|
Sqlstr = String.Format("delete wms_rate_detail where ASSOCIATEDNO in(select GID from wms_out_detail where OUTBSNO='{0}') ", wmsoutentity.BSNO);
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
|
//wms_out_detail处理:删除
|
|
|
Sqlstr = String.Format("delete wms_out_detail where OUTBSNO='{0}' ", wmsoutentity.BSNO);
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
|
//wms货权转移的费率处理:删除
|
|
|
Sqlstr = String.Format("delete wms_rate where BSNO in (select ingidnew from wms_out where BSNO='{0}' and ISCHANGE = 1)", wmsoutentity.BSNO);//REMARK = '货权转移'
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
|
//wms货权转移处理:删除
|
|
|
Sqlstr = String.Format("delete wms where gid in (select ingidnew from wms_out where BSNO='{0}' and ISCHANGE = 1) ", wmsoutentity.BSNO);//REMARK = '货权转移'
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
|
//wms_out处理:删除
|
|
|
Sqlstr = String.Format("delete wms_out where BSNO='{0}' ", wmsoutentity.BSNO);
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
|
result = 1;//状态为1表示删除成功
|
|
|
sqlTran.Commit();
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
result = -1;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
result = -2;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
//
|
|
|
}
|
|
|
}
|