|
|
|
|
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.WMS_ZX
|
|
|
|
|
{
|
|
|
|
|
public partial class WmsZXOutListGridSource : 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 strwmsgid;
|
|
|
|
|
private string strwmsoutbsno;
|
|
|
|
|
private string strsum;
|
|
|
|
|
private string strnum;
|
|
|
|
|
private string strmode;
|
|
|
|
|
private string strgoodspfsl;
|
|
|
|
|
private string strgoodspack;
|
|
|
|
|
private string stringid;
|
|
|
|
|
private string strgoodname;
|
|
|
|
|
private string strgoods;
|
|
|
|
|
public string strgids = "";
|
|
|
|
|
public string strislockdate = "";
|
|
|
|
|
|
|
|
|
|
private decimal outnums = 0;
|
|
|
|
|
private int feedays = 0;
|
|
|
|
|
//附件信息
|
|
|
|
|
private string strtb = "";//
|
|
|
|
|
private string linkgid = "";//
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
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["wmsgid"] != null)
|
|
|
|
|
{
|
|
|
|
|
strwmsgid = Request.QueryString["wmsgid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Request.QueryString["custid"] != null)
|
|
|
|
|
{
|
|
|
|
|
strcustid = Request.QueryString["custid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["gid"] != null)
|
|
|
|
|
{
|
|
|
|
|
strRateGid = Request.QueryString["gid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["gids"] != null && Request.QueryString["gids"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strgids = Request.QueryString["gids"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
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["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["goodspfsl"] != null)
|
|
|
|
|
{
|
|
|
|
|
strgoodspfsl = Request.QueryString["goodspfsl"].ToString().Trim() == "" ? "0" : Request.QueryString["goodspfsl"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["goodspack"] != null)
|
|
|
|
|
{
|
|
|
|
|
strgoodspack = Request.QueryString["goodspack"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["ingid"] != null)
|
|
|
|
|
{
|
|
|
|
|
stringid = Request.QueryString["ingid"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["goodname"] != null)
|
|
|
|
|
{
|
|
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
|
|
strgoodname = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["goodname"].ToString().Trim())));
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["strgoods"] != null)
|
|
|
|
|
{
|
|
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
|
|
strgoods = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["strgoods"].ToString().Trim())));
|
|
|
|
|
}
|
|
|
|
|
if (Request.QueryString["islockdate"] != null && Request.QueryString["islockdate"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strislockdate = Request.QueryString["islockdate"].ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strHandle != null)
|
|
|
|
|
{
|
|
|
|
|
if (strHandle == "wmsoutlist")
|
|
|
|
|
{//出库单列表
|
|
|
|
|
Response.Write(GetWmsOutListBySearch());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "wmsoutlistpage")
|
|
|
|
|
{//出库单列表
|
|
|
|
|
Response.Write(GetWmsOutLispagetBySearch());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "wmsinlist")
|
|
|
|
|
{
|
|
|
|
|
//指定条件的入库单剩余库存信息
|
|
|
|
|
Response.Write(GetWmsInList());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "wmsinlistedit")
|
|
|
|
|
{
|
|
|
|
|
//指定条件的入库单剩余库存信息
|
|
|
|
|
Response.Write(GetWmsInListedit(strwmsoutgid));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle.Equals("goodspfsl"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(DoGoodspfsl(strgoodspfsl, strgoodname));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle.Equals("goodspfsl2"))
|
|
|
|
|
{
|
|
|
|
|
Response.Write(DoGoodspfsl2(strgoodspack,strgoodspfsl, strgoodname));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "wmsoutdetaillist")
|
|
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
|
|
Response.Write(Getwmsoutdetaillist());
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "deletewmsout")
|
|
|
|
|
{//
|
|
|
|
|
Response.Write(DeleteWmsOutByGid(strwmsoutgid));
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "goodslist")
|
|
|
|
|
{ //获得货物信息
|
|
|
|
|
XmlDocument docs = GetDoc();
|
|
|
|
|
Response.ContentType = "text/xml";
|
|
|
|
|
Response.Write(docs.OuterXml.ToString());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "goodsmodel")
|
|
|
|
|
{ //获得货物信息
|
|
|
|
|
XmlDocument docs = GetGoodsmodel();
|
|
|
|
|
Response.ContentType = "text/xml";
|
|
|
|
|
Response.Write(docs.OuterXml.ToString());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//------
|
|
|
|
|
if (strHandle == "getratelist" && strcustid != null && strcustid != "")
|
|
|
|
|
{ //根据INFO_CLIENT.GID返回VW_WmsRateList仓储费率列表信息JSON字符串
|
|
|
|
|
Response.Write(GetRateListJsonByCusID(strcustid));
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
//wmsfeecodelist
|
|
|
|
|
if (strHandle == "wmsfeecodelist")
|
|
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
|
|
Response.Write(GetWmsFeeCodeList());
|
|
|
|
|
}
|
|
|
|
|
//deleteWmsFeeCode
|
|
|
|
|
if (strHandle == "deleteWmsFeeCode")
|
|
|
|
|
{//指定进口委托单位的出库明细 wmsoutdetaillist
|
|
|
|
|
Response.Write(DeleteWmsFeeCode(strRateGid));
|
|
|
|
|
}
|
|
|
|
|
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 == "opseaifujian")
|
|
|
|
|
{ //获取附件信息
|
|
|
|
|
Response.Write(GetLogContent(iShowPage, iCurrentPage));
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strHandle == "page")
|
|
|
|
|
{ //获取附件信息
|
|
|
|
|
Response.Write(GetPageInfo());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strHandle == "getfpk")
|
|
|
|
|
{ //获取附件信息
|
|
|
|
|
Response.Write(getfpk());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strHandle == "getfpk2")
|
|
|
|
|
{ //获取附件信息
|
|
|
|
|
Response.Write(getfpk2());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (strHandle == "islock")
|
|
|
|
|
{ //入账信息
|
|
|
|
|
Response.Write(setislock());
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "notlock")
|
|
|
|
|
{ //取消入账信息
|
|
|
|
|
Response.Write(setnotlock());
|
|
|
|
|
}
|
|
|
|
|
if (strHandle == "getislock")
|
|
|
|
|
{ //判断是否入账信息
|
|
|
|
|
Response.Write(getislock());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 + ")");
|
|
|
|
|
return ls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string setnotlock()
|
|
|
|
|
{
|
|
|
|
|
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 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))");
|
|
|
|
|
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.setnotlock(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 + "')";
|
|
|
|
|
string lsnum = T_ALL_DA.GetStrSQL("lsnum", sSQL);
|
|
|
|
|
if (lsnum.Trim() == "0")
|
|
|
|
|
{
|
|
|
|
|
return "应收客户有为空数据,不允许操作!";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
WmsOutDA WmsOutDA = new WmsOutDA();
|
|
|
|
|
int iResult = WmsOutDA.setislock(strgids, strUserID, strislockdate);
|
|
|
|
|
if (iResult < 0)
|
|
|
|
|
{
|
|
|
|
|
return "操作有误,请重新操作!";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据品名查出费率
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
|
|
private string DoGoodspfsl(string sGoodspfsl, string strgoodname)
|
|
|
|
|
{
|
|
|
|
|
string strVal = "";
|
|
|
|
|
Decimal dARRATE = 0;
|
|
|
|
|
Decimal dAPRATE = 0;
|
|
|
|
|
Decimal dGoodspfsl = 0;
|
|
|
|
|
if (sGoodspfsl.Trim().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
dGoodspfsl = Decimal.Parse(sGoodspfsl);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
DataSet DS = T_ALL_DA.GetAllSQL("select * from code_goods where goodname='" + strgoodname.Trim() + "'");
|
|
|
|
|
if (DS != null)
|
|
|
|
|
{
|
|
|
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (DS.Tables[0].Rows[0]["AROUTRATE"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
dARRATE = Decimal.Parse(DS.Tables[0].Rows[0]["AROUTRATE"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
if (DS.Tables[0].Rows[0]["APOUTRATE"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
dAPRATE = Decimal.Parse(DS.Tables[0].Rows[0]["APOUTRATE"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
dARRATE = dARRATE * dGoodspfsl;
|
|
|
|
|
if (dARRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
dARRATE = Decimal.Parse(dARRATE.ToString("#.##"));
|
|
|
|
|
}
|
|
|
|
|
dAPRATE = dAPRATE * dGoodspfsl;
|
|
|
|
|
if (dAPRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
dARRATE = Decimal.Parse(dARRATE.ToString("#.##"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
string sARRATE = "0.00";
|
|
|
|
|
string sAPRATE = "0.00";
|
|
|
|
|
if (dARRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
sARRATE = dARRATE.ToString("F2").Trim();
|
|
|
|
|
}
|
|
|
|
|
if (dAPRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
sAPRATE = dAPRATE.ToString("F2").Trim();
|
|
|
|
|
}
|
|
|
|
|
strVal = sARRATE + "," + sAPRATE + ",true";
|
|
|
|
|
return strVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据品名查出费率
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
|
|
private string DoGoodspfsl2(string sGoodspack, string sGoodspfsl, string strgoodname)
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string strVal = "";
|
|
|
|
|
Decimal dARRATE = 0;
|
|
|
|
|
Decimal dAPRATE = 0;
|
|
|
|
|
Decimal dGoodspfsl = 0;
|
|
|
|
|
if (sGoodspfsl.Trim().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
dGoodspfsl = Decimal.Parse(sGoodspfsl);
|
|
|
|
|
}
|
|
|
|
|
Decimal dGoodspack = 0;
|
|
|
|
|
if (sGoodspack.Trim().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
dGoodspack = Decimal.Parse(sGoodspack);
|
|
|
|
|
}
|
|
|
|
|
//判断库存数
|
|
|
|
|
string lsj = T_ALL_DA.GetStrSQL("lsj", "select GOODSPACKSTOCK-" + dGoodspack + " as lsj from wms_in where gid='" + stringid.Trim() + "'");
|
|
|
|
|
if (lsj.Trim().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
Decimal dlsj = Decimal.Parse(lsj);
|
|
|
|
|
if (dlsj < 0)
|
|
|
|
|
{
|
|
|
|
|
return "0.00,0.00,出库件数,大于现有的库存件数,不允许出库!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "0.00,0.00,出库件数为“0”或大于现有的库存件数,不允许出库!";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
string lsl = T_ALL_DA.GetStrSQL("lsl", "select GOODSSTOCK-" + dGoodspfsl + " as lsl from wms_in where gid='" + stringid.Trim() + "'");
|
|
|
|
|
if (lsl.Trim().Length > 0)
|
|
|
|
|
{
|
|
|
|
|
Decimal dlsl = Decimal.Parse(lsl);
|
|
|
|
|
if (dlsl < 0)
|
|
|
|
|
{
|
|
|
|
|
return "0.00,0.00,计费数量,大于现有的库存计费数量,不允许出库!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "0.00,0.00,计费数量为“0”或大于现有的库存量,不允许出库!";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
DataSet DS = T_ALL_DA.GetAllSQL("select * from code_goods where goodname='" + strgoodname.Trim() + "'");
|
|
|
|
|
if (DS != null)
|
|
|
|
|
{
|
|
|
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (DS.Tables[0].Rows[0]["AROUTRATE"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
dARRATE = Decimal.Parse(DS.Tables[0].Rows[0]["AROUTRATE"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
if (DS.Tables[0].Rows[0]["APOUTRATE"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
dAPRATE = Decimal.Parse(DS.Tables[0].Rows[0]["APOUTRATE"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
dARRATE = dARRATE * dGoodspfsl;
|
|
|
|
|
if (dARRATE!=0)
|
|
|
|
|
{
|
|
|
|
|
dARRATE = Decimal.Parse(dARRATE.ToString("#.##"));
|
|
|
|
|
}
|
|
|
|
|
dAPRATE = dAPRATE * dGoodspfsl;
|
|
|
|
|
if (dAPRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
dAPRATE = Decimal.Parse(dAPRATE.ToString("#.##"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
string sARRATE = "0.00";
|
|
|
|
|
string sAPRATE = "0.00";
|
|
|
|
|
if (dARRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
sARRATE = dARRATE.ToString("F2").Trim();
|
|
|
|
|
}
|
|
|
|
|
if (dAPRATE != 0)
|
|
|
|
|
{
|
|
|
|
|
sAPRATE = dAPRATE.ToString("F2").Trim();
|
|
|
|
|
}
|
|
|
|
|
strVal = sARRATE + "," + sAPRATE + ",true";
|
|
|
|
|
return strVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取当前列表页合计信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取费率信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>返回JSON数据</returns>
|
|
|
|
|
private string getfpk2()
|
|
|
|
|
{
|
|
|
|
|
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 "bsno"://NO
|
|
|
|
|
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("\"", ""));
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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 isnull(sum(GOODSPACKPFSL),0) as GOODSPACKPFSL,isnull(sum(arfee),0) as arfee,isnull(sum(apfee),0) as apfee from (SELECT {0} b.GOODSPACKPFSL,b.arfee,b.apfee 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.gid "
|
|
|
|
|
+ " where c.ISDELETE=0 {1} {2} ORDER BY a.GOODSNAME DESC) as z ", "top " + iShowPage.ToString(), strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
strSql = String.Format("select isnull(sum(GOODSPACKPFSL),0) as GOODSPACKPFSL,isnull(sum(arfee),0) as arfee,isnull(sum(apfee),0) as apfee from (SELECT {0} b.GOODSPACKPFSL,b.arfee,b.apfee 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.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_in c on b.INBSNO=c.gid WHERE c.ISDELETE=0 {2} {3} ORDER BY a.GOODSNAME DESC ) {2} {3} "
|
|
|
|
|
+ " ORDER BY a.GOODSNAME DESC) as z ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = String.Format("select isnull(sum(GOODSPACKPFSL),0) as GOODSPACKPFSL,isnull(sum(arfee),0) as arfee,isnull(sum(apfee),0) as apfee from (SELECT {0} b.GOODSPACKPFSL,b.arfee,b.apfee 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.gid where c.ISDELETE=0 {0} {1} "
|
|
|
|
|
+ " ORDER BY a.GOODSNAME DESC) as z ", strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
string ls = sourceTable.Rows[0][0].ToString().Trim() + "," + sourceTable.Rows[0][1].ToString().Trim() + "," + sourceTable.Rows[0][2].ToString().Trim();
|
|
|
|
|
return ls;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#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 "bsno"://NO
|
|
|
|
|
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("\"", ""));
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
strSql = String.Format(" SELECT isnull(sum(b.GOODSPACKPFSL),0) as GOODSPACKPFSL,isnull(sum(b.arfee),0) as arfee,isnull(sum(b.apfee),0) as arfeep"
|
|
|
|
|
+ " 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.gid "
|
|
|
|
|
+ " where c.ISDELETE=0 {0} ", strCondition);
|
|
|
|
|
sourceTable = WmsRateDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
string ls = sourceTable.Rows[0][0].ToString().Trim() + "," + sourceTable.Rows[0][1].ToString().Trim() + "," + sourceTable.Rows[0][2].ToString().Trim();
|
|
|
|
|
return ls;
|
|
|
|
|
}
|
|
|
|
|
#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,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.ISDELETE=0 and a.ASSOCIATEDNO='{0}' and a.OUTBSNO='{1}' "
|
|
|
|
|
+ " ORDER BY a.bsno ", strwmsgid, 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("\"", ""));
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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,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
|
|
|
|
|
|
|
|
|
|
#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 CLIENTNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "blno"://NO
|
|
|
|
|
strCondition += String.Format(" AND BLNO 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);
|
|
|
|
|
//}
|
|
|
|
|
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, 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,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, 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, 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,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, 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, 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,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, CREATETIME,ASSOCIATEDNO,0 iswmsout "
|
|
|
|
|
+ " FROM wms_in where ISDELETE=0 and GOODSSTOCK>0 {0} {1} "
|
|
|
|
|
+ " ORDER BY CLIENTNAME,BLNO ", strAuthorityCondition, strCondition, OutDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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() + "\",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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 strSql = "";
|
|
|
|
|
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
|
|
|
|
|
//"", "提单号", "入库单号", "出库单号", "出库人", "仓库名称", "品名", "型号", "入库日期", "出库日期"
|
|
|
|
|
//, "入库件数", "剩余件数", "出库件数", "本次出库", "出库应收", "出库应付", "车号", "制单人", "制单时间", "备注"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strSql = String.Format(" SELECT a.GID,INBSNO=(select WMSNO from wms where gid=b.ASSOCIATEDNO),a.OUTBSNO,a.CUSTOMERNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,INDATE=(select convert(char(10),WMSDATE,20) as WMSDATE from wms where gid=b.ASSOCIATEDNO),convert(char(10),a.DODATE,20) OUTDATE, "
|
|
|
|
|
+ " b.GOODSPACK,b.GOODSPACKSTOCK,b.GOODSPACK-b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.ARFEE,a.APFEE,a.TRUCKNO, a.CREATEUSER, a.CREATETIME, a.REMARK "
|
|
|
|
|
+ " FROM wms_out_detail a left outer join wms_in b on a.INBSNO=b.gid "
|
|
|
|
|
+ " where isnull(b.ISDELETE,0)=0 and a.OUTBSNO in (select BSNO from wms_out where gid='{1}') {2} "
|
|
|
|
|
+ " ORDER BY a.OUTBSNO,INBSNO ", strwmsgid, 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();
|
|
|
|
|
if (j == 18 || j == 21)
|
|
|
|
|
{
|
|
|
|
|
ls = ls.Replace(" ", ",");
|
|
|
|
|
ls = ls.Replace("\r\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 string BuildXMLGoodsmodel()
|
|
|
|
|
{
|
|
|
|
|
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))
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select GOODSMODEL from wms_in where ASSOCIATEDNO like 'WmsZ%' and GOODSNAME='" + strgoods + "' group by GOODSMODEL");
|
|
|
|
|
if (ds != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
|
|
|
{
|
|
|
|
|
if (dr["GOODSMODEL"].ToString().Trim() != "" || dr["GOODSMODEL"].ToString().Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", dr["GOODSMODEL"].ToString().Trim(), dr["GOODSMODEL"].ToString().Trim());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
resultBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", "", "");
|
|
|
|
|
resultBuilder.Append("</complete>");
|
|
|
|
|
return resultBuilder.ToString().Replace("&", "&");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public XmlDocument GetGoodsmodel()
|
|
|
|
|
{
|
|
|
|
|
XmlDocument xmldoc = new XmlDocument();
|
|
|
|
|
string content = BuildXMLGoodsmodel();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xmldoc.LoadXml(content);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
return xmldoc;
|
|
|
|
|
}
|
|
|
|
|
#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 convert(char(10),a.DODATE,20) >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "et"://ETD EndDate
|
|
|
|
|
strCondition += String.Format(" AND convert(char(10),a.DODATE,20) <= '{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.CLIENTBSNO like '%{0}%' or a.bsno like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cbISLOCK"://NO
|
|
|
|
|
string sbl = strArg[1].Replace("\"", "");
|
|
|
|
|
if (sbl.Trim().ToLower() == "false")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND a.ISLOCK='{0}'", sbl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "goods":
|
|
|
|
|
strCondition += String.Format("AND a.bsno in (select outbsno from wms_out_detail where GOODSNAME like '%{0}%') ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (strbsno != "")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strbsno);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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,(case a.ISLOCK when 1 then '是' else '否' end) ISLOCK,a.BSNO,a.CLIENTBSNO,a.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,CREATEUSER=(SELECT SHOWNAME FROM dbo.[user] WHERE (GID = a.CREATEUSER)),convert(char(10),a.CREATETIME,20),a.ASSOCIATEDNO"
|
|
|
|
|
+ " from wms_out a "
|
|
|
|
|
+ " where 1=1 {1} {2} ORDER BY 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) ISLOCK,a.BSNO,a.CLIENTBSNO,a.CUSTOMERNAME,convert(char(10),a.DODATE,20),a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,CREATEUSER=(SELECT SHOWNAME FROM dbo.[user] WHERE (GID = a.CREATEUSER)),convert(char(10),a.CREATETIME,20),a.ASSOCIATEDNO "
|
|
|
|
|
+ " from wms_out a WHERE a.GID NOT IN "
|
|
|
|
|
+ " (SELECT {1} a.GID from wms_out a WHERE 1=1 {2} {3} ORDER BY a.CREATETIME DESC ) {2} {3} "
|
|
|
|
|
+ " ORDER BY a.CREATETIME DESC ", strTopInclude, strTopNotInclude, strAuthorityCondition, strCondition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = "SELECT a.GID,a.ISLOCK,a.BSNO,a.CLIENTBSNO,a.CUSTOMERNAME,a.DODATE,a.GOODSPACKPFSL,a.TRUCKNO,a.REMARK,a.CREATEUSER,a.CREATETIME,a.ASSOCIATEDNO from wms_out a where 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 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.CLIENTBSNO like '%{0}%' or a.bsno like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cbISLOCK"://NO
|
|
|
|
|
string sbl = strArg[1].Replace("\"", "");
|
|
|
|
|
if (sbl.Trim().ToLower() == "false")
|
|
|
|
|
{
|
|
|
|
|
strCondition += String.Format(" AND a.ISLOCK='{0}'", sbl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "goods":
|
|
|
|
|
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
strCondition += String.Format(" AND (a.ASSOCIATEDNO='' or a.ASSOCIATEDNO is null) ", strbsno);
|
|
|
|
|
|
|
|
|
|
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 COUNT(*) from wms_out a 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 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 "wmsgid"://CUSTOMER
|
|
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://CUSTOMER
|
|
|
|
|
strCondition += String.Format(" AND CLIENTNAME='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "blno"://NO
|
|
|
|
|
strCondition += String.Format(" AND WMSNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
//case "clientbsno"://NO
|
|
|
|
|
// strCondition += String.Format(" AND CLIENTBSNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
// break;
|
|
|
|
|
case "store":
|
|
|
|
|
strCondition += String.Format(" AND STORAGENAME='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "outcustomer":
|
|
|
|
|
strCondition += String.Format(" AND WMSOP='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "goods":
|
|
|
|
|
strCondition += String.Format(" AND GOODSNAME='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "goodsmodel":
|
|
|
|
|
strCondition += String.Format(" AND GOODSMODEL='{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
//case "remark":
|
|
|
|
|
// strCondition += String.Format(" AND REMARK like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
// break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition += " and 0>1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//if (!strbsno.Equals(null) && !strbsno.Equals(""))
|
|
|
|
|
//{
|
|
|
|
|
// strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strbsno);
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
strCondition += " and 0>1";
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
|
|
|
|
|
//("", "货主", "仓库名称", "提单号", "入库日期", "品名", "型号",, "剩余件数", "出库件数", "本次出库", "应收费用", "应付费用", "车号", "备注");
|
|
|
|
|
|
|
|
|
|
strSql = String.Format(" SELECT gid,STORAGENAME,AREANAME,WMSNO,CLIENTBSNO,convert(char(10),WMSDATE,120) WMSDATE,GOODSNAME,GOODSMODEL,CHARGEUNIT,GOODSPACKSTOCK,GOODSPACK-GOODSPACKSTOCK,GOODSSTOCK,GOODSRKSL-GOODSSTOCK, 0, 0.00, 0.00,0.00,'' as TRUCKNO,'' as REMARK,ASSOCIATEDNO,'' as ingid,'' as outgid "
|
|
|
|
|
+ " FROM VW_WMS_IN where ISDELETE=0 and GOODSPACKSTOCK<>0 {0} {1} "
|
|
|
|
|
+ " ORDER BY WMSNO,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(string stroutgid)
|
|
|
|
|
{
|
|
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
|
|
DataTable sourceTable;
|
|
|
|
|
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 "wmsgid"://CUSTOMER
|
|
|
|
|
strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "cus"://CUSTOMER
|
|
|
|
|
strCondition += String.Format(" AND CLIENTNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "blno"://NO
|
|
|
|
|
strCondition += String.Format(" AND BLNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "clientbsno"://NO
|
|
|
|
|
strCondition += String.Format(" AND CLIENTBSNO like '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
case "store":
|
|
|
|
|
strCondition += String.Format(" AND STORAGENAME 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";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// if (!strbsno.Equals(null) && !strbsno.Equals(""))
|
|
|
|
|
// {
|
|
|
|
|
// strCondition += String.Format(" AND ASSOCIATEDNO = '{0}' ", strbsno);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// strCondition += " and 0>1";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
string strAuthorityCondition = "";
|
|
|
|
|
strSql = String.Format(" SELECT GID_OUT,STORAGENAME,AREANAME,WMSNO=(select WMSNO from wms where gid=VW_WMS_DETAIL_2.ASSOCIATEDNO),CLIENTBSNO=(select CLIENTBSNO from wms where gid=VW_WMS_DETAIL_2.ASSOCIATEDNO),convert(char(10),(select WMSDATE from wms where gid=VW_WMS_DETAIL_2.ASSOCIATEDNO),120) WMSDATE,GOODSNAME,GOODSMODEL,CHARGEUNIT,GOODSPACKSTOCK,GOODSPACK-GOODSPACKSTOCK,GOODSSTOCK,GOODSRKSL-GOODSSTOCK,GOODSPACKPFSL,GOODSPFSL_OUT, ARFEE_OUT,APFEE_OUT,'' as TRUCKNO,REMARK_OUT,gid as ingid,outgid FROM VW_WMS_DETAIL_2 where ISDELETE=0 {0} {1} and outgid='{2}' "
|
|
|
|
|
+ " ORDER BY WMSNO,GOODSNAME,WMSDATE ", strAuthorityCondition, strCondition, stroutgid);
|
|
|
|
|
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++)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
#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 = "";
|
|
|
|
|
//出库单信息
|
|
|
|
|
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();
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//判断出库单相关的op_Seai是否锁定
|
|
|
|
|
wmsoutentity = wmsoutDA.GetModel(tempGid);//出库单信息
|
|
|
|
|
//出库单明细列表
|
|
|
|
|
DsWmsOutDetail = wmsoutdetailDA.GetList(String.Format(" OUTBSNO='{0}' ", wmsoutentity.BSNO));
|
|
|
|
|
DtWmsOutDetail = DsWmsOutDetail.Tables[0];
|
|
|
|
|
foreach (DataRow routdetail in DtWmsOutDetail.Rows)
|
|
|
|
|
{
|
|
|
|
|
//入库单处理:修改
|
|
|
|
|
Decimal GOODSPACKPFSL = 0;
|
|
|
|
|
Decimal GOODSPFSL = 0;
|
|
|
|
|
string INBSNO = "";
|
|
|
|
|
GOODSPACKPFSL = Decimal.Parse(routdetail["GOODSPACKPFSL"].ToString().Equals(null) ? "0.0000" : routdetail["GOODSPACKPFSL"].ToString());
|
|
|
|
|
GOODSPFSL = Decimal.Parse(routdetail["GOODSPFSL"].ToString().Equals(null) ? "0.0000" : routdetail["GOODSPFSL"].ToString());
|
|
|
|
|
INBSNO = routdetail["INBSNO"].ToString();
|
|
|
|
|
Sqlstr = String.Format("update wms_in set GOODSPACKSTOCK=GOODSPACKSTOCK+{0},GOODSSTOCK=GOODSSTOCK+{2} where isnull(ISDELETE,0)=0 and gid='{1}' ", GOODSPACKPFSL, INBSNO, GOODSPFSL);
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
Sqlstr = "";
|
|
|
|
|
}
|
|
|
|
|
//wms_out_detail处理:删除
|
|
|
|
|
Sqlstr = String.Format("delete wms_out_detail where OUTBSNO='{0}' ", wmsoutentity.BSNO);
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, Sqlstr, null);
|
|
|
|
|
Sqlstr = "";
|
|
|
|
|
//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
|
|
|
|
|
}
|
|
|
|
|
}
|