|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Configuration;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Security;
|
|
|
using System.Web.UI;
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
using System.Web.UI.WebControls;
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
using DSWeb.Models;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Text;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Xml.Linq;
|
|
|
using JsonHelper;
|
|
|
using System.Xml;
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace DSWeb.SeaiInfo
|
|
|
{
|
|
|
public partial class WmsInfoGridSource : System.Web.UI.Page
|
|
|
{
|
|
|
private string strReadXmlType = "";//读取xml串方式 "init"-初始化获取所有账户信息;"add"-添加新的账户信息;"delete"-删除账户信息;"exist"查看是否有与委托相关账户
|
|
|
private int iShowCount;//每页显示数据量
|
|
|
|
|
|
//delete
|
|
|
private string strWmsZXInfoGid;//账户信息GID
|
|
|
private string strHandle;//账户操作说明
|
|
|
private const int iResult = -99;//参数错误
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
private string strRange = String.Empty;//权限可视范围
|
|
|
RangeDA RangeDA = new RangeDA();
|
|
|
public string strUserID;//用户GID
|
|
|
public string strParentGID;//
|
|
|
public string strassociatedno;//
|
|
|
public string strGIDS;//
|
|
|
public string strgoodspack;//
|
|
|
public string strgoodname;//
|
|
|
public string strgoodsrksl;//
|
|
|
public string strcntrno;//
|
|
|
public string StartBillingDate;//
|
|
|
public string FreeStorageperiod;//
|
|
|
public string strCompanyID;//公司GID
|
|
|
public string strShowName;//用户显示名
|
|
|
public string strDeptName;//部门名称
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
if (Session["USERID"] != null)
|
|
|
{
|
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
|
}
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
{
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
}
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
{
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
}
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
{
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
}
|
|
|
//
|
|
|
#region 判断参数是否正确
|
|
|
if (Request.QueryString["read"] != null)
|
|
|
{
|
|
|
strReadXmlType = Request.QueryString["read"].ToString().Trim();
|
|
|
}
|
|
|
if (Request.QueryString["showcount"] != null)
|
|
|
{
|
|
|
iShowCount = int.Parse(Request.QueryString["showcount"].ToString());
|
|
|
}
|
|
|
if (Request.QueryString["id"] != null)
|
|
|
{
|
|
|
strParentGID = Request.QueryString["id"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["associatedno"] != null)
|
|
|
{
|
|
|
strassociatedno = Request.QueryString["associatedno"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["gids"] != null)
|
|
|
{
|
|
|
strGIDS = Request.QueryString["gids"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["goodspack"] != null)
|
|
|
{
|
|
|
strgoodspack = Request.QueryString["goodspack"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["goodsrksl"] != null)
|
|
|
{
|
|
|
strgoodsrksl = Request.QueryString["goodsrksl"].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["cntrno"] != null)
|
|
|
{
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
strcntrno = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["cntrno"].ToString().Trim())));
|
|
|
}
|
|
|
if (Request.QueryString["startbillingdate"] != null)
|
|
|
{
|
|
|
StartBillingDate = Request.QueryString["startbillingdate"].ToString();
|
|
|
}
|
|
|
if (Request.QueryString["freestorageperiod"] != null)
|
|
|
{
|
|
|
FreeStorageperiod = Request.QueryString["freestorageperiod"].ToString();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 权限可视范围
|
|
|
//strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modOrderManagement");
|
|
|
//if (strRange.Trim().Equals("0"))//全部
|
|
|
//{
|
|
|
// strRange = "";
|
|
|
//}
|
|
|
//else if (strRange.Trim().Equals("1"))//分公司
|
|
|
//{
|
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementCompany(strUserID.Trim()) + ")";
|
|
|
//}
|
|
|
//else if (strRange.Trim().Equals("2"))//部门
|
|
|
//{
|
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementDEPT(strUserID.Trim()) + ")";
|
|
|
//}
|
|
|
//else if (strRange.Trim().Equals("3"))//个人
|
|
|
//{
|
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementPerson(strUserID.Trim()) + ")";
|
|
|
//}
|
|
|
//else if (strRange.Trim().Equals("4"))//无
|
|
|
//{
|
|
|
// strRange = " and 1<0";
|
|
|
//}
|
|
|
//else//空
|
|
|
//{
|
|
|
// strRange = " and 1<0";
|
|
|
//}
|
|
|
#endregion
|
|
|
|
|
|
//
|
|
|
if (!strReadXmlType.Equals(""))
|
|
|
{
|
|
|
if (strReadXmlType.Equals("delete") || strReadXmlType.Equals("recover"))
|
|
|
{
|
|
|
strWmsZXInfoGid = (String)Request.QueryString["gid"] as String;
|
|
|
strHandle = (String)Request.QueryString["read"] as String;
|
|
|
if (strWmsZXInfoGid == null || strHandle == null)
|
|
|
{
|
|
|
Response.Write(iResult);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string strQuery = DoExcute(strWmsZXInfoGid, strHandle);
|
|
|
Response.Write(strQuery);
|
|
|
}
|
|
|
}
|
|
|
else if (strReadXmlType.Equals("goodsrksl"))
|
|
|
{
|
|
|
Response.Write(DoGoodspack(strgoodsrksl, strgoodname));
|
|
|
}
|
|
|
else if (strReadXmlType.Equals("isout"))
|
|
|
{
|
|
|
Response.Write(Doisout(strGIDS));
|
|
|
}
|
|
|
else if (strReadXmlType.Equals("getadd"))
|
|
|
{
|
|
|
Response.Write(getadd());
|
|
|
return;
|
|
|
}
|
|
|
else if (strReadXmlType.Equals("getsealno"))
|
|
|
{
|
|
|
Response.Write(getsealno());
|
|
|
return;
|
|
|
}
|
|
|
if (strReadXmlType.Equals("getCTNNUM"))
|
|
|
{
|
|
|
Response.Write(getCTNNUM());
|
|
|
return;
|
|
|
}
|
|
|
if (strReadXmlType.Equals("getfpk"))
|
|
|
{
|
|
|
Response.Write(getfpk());
|
|
|
return;
|
|
|
}
|
|
|
if (strReadXmlType.Equals("setstartbillingdate"))
|
|
|
{
|
|
|
//更改应收开始计费日期
|
|
|
Response.Write(setstartbillingdate());
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string strOutputXml = "";
|
|
|
strOutputXml = GetCells(iShowCount, strReadXmlType);
|
|
|
//输出XML字符串
|
|
|
Response.ContentType = "text/xml";
|
|
|
strOutputXml.Replace("&", "&");
|
|
|
Response.Write(strOutputXml);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//访问参数不正确
|
|
|
Response.ContentType = "text/xml";
|
|
|
Response.Write("-2");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更改应收开始计费日期
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string setstartbillingdate()
|
|
|
{
|
|
|
string ls = "";
|
|
|
WmsDA WmsDA = new EntityDA.WmsDA();
|
|
|
int iR = WmsDA.updateStartBillingDate(StartBillingDate, FreeStorageperiod, strParentGID, strUserID, strShowName);
|
|
|
if (iR > 0)
|
|
|
{
|
|
|
string sql = "select *,OUTGID=(select top 1 GID from wms_out where BSNO=wms_out_detail.OUTBSNO) from wms_out_detail where INBSNO='" + strParentGID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(sql);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
|
{
|
|
|
ls += "、" + ds.Tables[0].Rows[i]["OUTBSNO"].ToString().Trim();
|
|
|
}
|
|
|
//
|
|
|
if (ls.Trim() != "")
|
|
|
{
|
|
|
ls = "请注意因修改入库的“应收开始计费日期”,而导致的出库号为“" + ls.Trim().Substring(1) + "”的出库单的仓储费不准,可重新计算出库的仓储费!";
|
|
|
}
|
|
|
//
|
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
|
{
|
|
|
bool isdisabled = false;
|
|
|
bool islock = false;
|
|
|
if (ds.Tables[0].Rows[i]["ISLOCK"].ToString().Trim() == "True")
|
|
|
{
|
|
|
//alt = "已入账的信息,不允许修改!";
|
|
|
isdisabled = true;
|
|
|
islock = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string strSQL = "select count(gid) nums from (SELECT o.GID,o.REMARK,o.bsno FROM wms AS i INNER JOIN wms_out AS o ON i.ASSOCIATEDNO = o.ASSOCIATEDNO AND o.ingidnew = i.gid AND o.ISCHANGE = 1 and o.ASSOCIATEDNO not like 'topseailcl%' and i.ISLOCK=1) as a where GID in ('" + ds.Tables[0].Rows[i]["OUTGID"].ToString().Trim() + "') or bsno in ('" + ds.Tables[0].Rows[i]["OUTBSNO"].ToString().Trim() + "') ";
|
|
|
string ls2 = T_ALL_DA.GetStrSQL("nums", strSQL);
|
|
|
if (ls2.Trim() != "0")
|
|
|
{
|
|
|
//alt = "已入库的货权转移信息,不允许修改!";
|
|
|
isdisabled = true;
|
|
|
}
|
|
|
}
|
|
|
int ischangecust = 0;
|
|
|
if (ds.Tables[0].Rows[i]["ISCHANGE"].ToString().Trim() == "True")
|
|
|
{
|
|
|
ischangecust = 1;
|
|
|
}
|
|
|
//
|
|
|
if (ds.Tables[0].Rows[i]["CHARGEUNIT"].ToString().Trim() == "CBM")
|
|
|
{
|
|
|
ls += ";../SeaiFee/WmsOutEditCBM.aspx?handle=edit&outgid=" + ds.Tables[0].Rows[i]["OUTGID"].ToString().Trim() + "&ischangecust=" + ischangecust + "&isdisabled=" + isdisabled + "&islock=" + islock;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ls += ";../SeaiFee/WmsOutEdit.aspx?handle=edit&outgid=" + ds.Tables[0].Rows[i]["OUTGID"].ToString().Trim() + "&ischangecust=" + ischangecust + "&isdisabled=" + isdisabled + "&islock=" + islock;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ls = iR.ToString();
|
|
|
}
|
|
|
return ls;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 返回件数、重量、应收、应付的统计
|
|
|
private string getfpk()
|
|
|
{
|
|
|
string dvfpk = "";
|
|
|
if (strParentGID != null)
|
|
|
{
|
|
|
if (strParentGID.ToString().Trim() != "")
|
|
|
{
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select top 1 GOODSPACK=(select sum(GOODSPACK) from wms_in where ASSOCIATEDNO=wms.gid),GOODSRKSL=(select sum(GOODSRKSL) from wms_in where ASSOCIATEDNO=wms.gid),ARFEE=(select sum(ARFEE) from wms_in where ASSOCIATEDNO=wms.gid),APFEE=(select sum(APFEE) from wms_in where ASSOCIATEDNO=wms.gid) from wms where gid='" + strParentGID.Trim() + "'");
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
//件数
|
|
|
dvfpk += ds.Tables[0].Rows[0]["GOODSPACK"].ToString().Trim();
|
|
|
//计费数量
|
|
|
dvfpk += "," + ds.Tables[0].Rows[0]["GOODSRKSL"].ToString().Trim();
|
|
|
//出库应收
|
|
|
dvfpk += "," + ds.Tables[0].Rows[0]["ARFEE"].ToString().Trim();
|
|
|
//出库应付
|
|
|
dvfpk += "," + ds.Tables[0].Rows[0]["APFEE"].ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return dvfpk;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 返回箱型箱量的统计
|
|
|
private string getCTNNUM()
|
|
|
{
|
|
|
string dvCTN = "";
|
|
|
if (strParentGID != null)
|
|
|
{
|
|
|
if (strParentGID.ToString().Trim() != "")
|
|
|
{
|
|
|
//CTN统计
|
|
|
//string sSQL = "select CTNALL,sum(CTNNUM) as CTNNUM from op_ctn where bsno='" + strParentGID.Trim() + "' group by CTNALL";
|
|
|
string sSQL = "select (case when CTNALL='' then '为空' else CTNALL end) CTNALL,count(CTNALL) as CTNNUM from wms_in where ASSOCIATEDNO='" + strParentGID.Trim() + "' group by CTNALL order by CTNALL";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(sSQL);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
for (int t = 0; t < ds.Tables[0].Rows.Count; t++)
|
|
|
{
|
|
|
dvCTN += "," + ds.Tables[0].Rows[t]["CTNALL"].ToString().Trim() + "*" + ds.Tables[0].Rows[t]["CTNNUM"].ToString().Trim();
|
|
|
}
|
|
|
if (dvCTN.Trim() != "")
|
|
|
{
|
|
|
dvCTN = dvCTN.Trim().Substring(1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return dvCTN;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据箱号查出封号
|
|
|
/// </summary>
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
private string getsealno()
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string ls = "";
|
|
|
string snum = "select top 1 isnull(SEALNO,'') SEALNO,isnull(PKGS,0) PKGS,isnull(KGS,0) KGS from op_ctn where cntrno in ('" + strcntrno.Trim() + "') and bsno='" + strassociatedno + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(snum);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
ls = ds.Tables[0].Rows[0]["SEALNO"].ToString().Trim() + "," + ds.Tables[0].Rows[0]["PKGS"].ToString().Trim() + "," + ds.Tables[0].Rows[0]["KGS"].ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
return ls;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据业务编号,提取默认值
|
|
|
/// </summary>
|
|
|
private string getadd()
|
|
|
{
|
|
|
SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA();
|
|
|
TopSeaiEntity TopSeaiEntity = new TopSeaiEntity();
|
|
|
string sls = "";
|
|
|
//
|
|
|
if (strassociatedno.Trim() != "")
|
|
|
{
|
|
|
TopSeaiEntity = SeaImportInfoDA.GetID(strassociatedno.Trim());
|
|
|
if (TopSeaiEntity.BSNO != null)
|
|
|
{
|
|
|
sls = TopSeaiEntity.GOODSNAME.ToString().Trim();
|
|
|
sls += "," + TopSeaiEntity.GOODSTYPENAME.ToString().Trim();
|
|
|
sls += "," + TopSeaiEntity.UNITOFWEIGHT.ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
return sls;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据仓库查出库位
|
|
|
/// </summary>
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
private string Doisout(string sGIDS)
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string snum="select count(*) num from wms_out_detail where INBSNO in ('" + sGIDS.Trim() + "')";
|
|
|
snum = T_ALL_DA.GetStrSQL("num", snum);
|
|
|
return snum;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据品名查出费率
|
|
|
/// </summary>
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
private string DoGoodspack(string sGoodsrksl, string strgoodname)
|
|
|
{
|
|
|
string strVal = "";
|
|
|
Decimal dARRATE = 0;
|
|
|
Decimal dAPRATE = 0;
|
|
|
Decimal dGoodspack = 0;
|
|
|
if (sGoodsrksl.Trim().Length > 0)
|
|
|
{
|
|
|
dGoodspack = Decimal.Parse(sGoodsrksl);
|
|
|
}
|
|
|
//
|
|
|
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]["ARRATE"].ToString().Trim() != "")
|
|
|
{
|
|
|
dARRATE = Decimal.Parse(DS.Tables[0].Rows[0]["ARRATE"].ToString().Trim());
|
|
|
}
|
|
|
if (DS.Tables[0].Rows[0]["APRATE"].ToString().Trim() != "")
|
|
|
{
|
|
|
dAPRATE = Decimal.Parse(DS.Tables[0].Rows[0]["APRATE"].ToString().Trim());
|
|
|
}
|
|
|
//
|
|
|
dARRATE = dARRATE * dGoodspack;
|
|
|
if (dARRATE != 0)
|
|
|
{
|
|
|
dARRATE = Decimal.Parse(dARRATE.ToString("#.##"));
|
|
|
}
|
|
|
dAPRATE = dAPRATE * dGoodspack;
|
|
|
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;
|
|
|
return strVal;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据用户提交的
|
|
|
/// </summary>
|
|
|
/// <param name="tempGid">账户GID</param>
|
|
|
/// <param name="tempHandle">操作类型 delete删除单条账户</param>
|
|
|
/// <returns>值1-删除成功;值-1 -删除操作异常 值-2 -回滚失败 值-3 -未获取相关账户信息</returns>
|
|
|
private string DoExcute(string tempGid, string tempHandle)
|
|
|
{
|
|
|
string strVal = "";
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
|
|
|
//操作类型为删除
|
|
|
if (tempHandle == "delete")
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
//先判断当前要删除的账户是否存在
|
|
|
if (!tempGid.Trim().Equals(""))
|
|
|
{
|
|
|
WmsInEntity WmsInEntity = new WmsInEntity();
|
|
|
WmsInEntity = WmsInDA.GetID(tempGid);
|
|
|
|
|
|
if (WmsInEntity.GID != null)
|
|
|
{
|
|
|
string alt = "";
|
|
|
alt = WmsInDA.GetWmsInDel(WmsInEntity.GID.ToString().Trim(), strUserID);
|
|
|
if (alt.Trim() == "")
|
|
|
{
|
|
|
iResult = 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -3; //未获取相关账户信息
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -3; //未获取相关账户信息
|
|
|
}
|
|
|
}
|
|
|
strVal = iResult.ToString();
|
|
|
}
|
|
|
|
|
|
if (tempHandle == "recover")
|
|
|
{
|
|
|
if (!tempGid.Trim().Equals(""))
|
|
|
{
|
|
|
WmsInEntity WmsInEntity = new WmsInEntity();
|
|
|
WmsInEntity = WmsInDA.GetID(tempGid);
|
|
|
|
|
|
if (WmsInEntity != null)
|
|
|
{
|
|
|
if (WmsInEntity.GID != null)
|
|
|
{
|
|
|
StringBuilder WMSZXBuilder = new StringBuilder();
|
|
|
WMSZXBuilder.Append(WmsInEntity.GID + ",");//惟一编号
|
|
|
WMSZXBuilder.Append("0,");
|
|
|
WMSZXBuilder.Append(WmsInEntity.LINENUM + ",");
|
|
|
WMSZXBuilder.Append(WmsInEntity.CTNALL + ",");
|
|
|
WMSZXBuilder.Append(WmsInEntity.CNTRNO + ",");
|
|
|
WMSZXBuilder.Append(WmsInEntity.SEALNO + ",");
|
|
|
WMSZXBuilder.Append(WmsInEntity.GOODSPACK + ",");//件数
|
|
|
WMSZXBuilder.Append(WmsInEntity.GOODSRKSL + ",");//计费数量
|
|
|
WMSZXBuilder.Append(WmsInEntity.GOODSPACKACTUAL + ",");//实际件数
|
|
|
WMSZXBuilder.Append(WmsInEntity.GOODSRKSLACTUAL + ",");//实际计费数量
|
|
|
WMSZXBuilder.Append(WmsInEntity.ARFEE + ",");//应收账款
|
|
|
WMSZXBuilder.Append(WmsInEntity.APFEE + ",");//应付账款
|
|
|
WMSZXBuilder.Append(WmsInEntity.MARKETVALUE + ",");//市场货值
|
|
|
WMSZXBuilder.Append(WmsInEntity.BANKVALUE + ",");//银行货值
|
|
|
WMSZXBuilder.Append(WmsInEntity.AREANAME);//库位
|
|
|
WMSZXBuilder.Append(WmsInEntity.REMARK);//备注
|
|
|
strVal = WMSZXBuilder.ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strVal = "-3";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strVal = "-3";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strVal = "-3";
|
|
|
}
|
|
|
}
|
|
|
return strVal;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取账户信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
private string GetCells(int iShowCount, string readXmlType)
|
|
|
{
|
|
|
WmsInDA WmsZXInfoEntity = new WmsInDA();
|
|
|
WmsInDA WmsInDA = new WmsInDA();
|
|
|
|
|
|
if (strReadXmlType.Equals("exist"))
|
|
|
{
|
|
|
return "1";//存在账户
|
|
|
}
|
|
|
else if (strReadXmlType.Equals("add"))
|
|
|
{
|
|
|
//
|
|
|
SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA();
|
|
|
TopSeaiEntity TopSeaiEntity = new TopSeaiEntity();
|
|
|
string sGOODSTYPENAME = "";
|
|
|
string sGOODSNAME = "";
|
|
|
string sUNITOFWEIGHT = "";
|
|
|
//
|
|
|
if (strassociatedno.Trim() != "")
|
|
|
{
|
|
|
TopSeaiEntity = SeaImportInfoDA.GetID(strassociatedno.Trim());
|
|
|
if (TopSeaiEntity.BSNO != null)
|
|
|
{
|
|
|
sGOODSTYPENAME = TopSeaiEntity.GOODSTYPENAME.ToString().Trim();
|
|
|
sGOODSNAME = TopSeaiEntity.GOODSNAME.ToString().Trim();
|
|
|
sUNITOFWEIGHT = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
StringBuilder dataBuilder = new StringBuilder();
|
|
|
dataBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
dataBuilder.Append("<rows>");
|
|
|
dataBuilder.Append("<row id=\"" + Guid.NewGuid().ToString() + "\">");
|
|
|
//
|
|
|
dataBuilder.Append("<cell>0</cell>");
|
|
|
dataBuilder.Append("<cell>1</cell>");
|
|
|
//
|
|
|
string strcb = GetCTNALL("");
|
|
|
if (strcb.Trim() == "")
|
|
|
{
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dataBuilder.Append(strcb);
|
|
|
}
|
|
|
//
|
|
|
//strcb = GetCTN("");
|
|
|
//if (strcb.Trim() == "")
|
|
|
//{
|
|
|
// dataBuilder.Append("<cell></cell>");
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// dataBuilder.Append(strcb);
|
|
|
//}
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
dataBuilder.Append("<cell>0.0000</cell>");
|
|
|
dataBuilder.Append("<cell>0.0000</cell>");
|
|
|
dataBuilder.Append("<cell>0.0000</cell>");
|
|
|
dataBuilder.Append("<cell>0.0000</cell>");
|
|
|
dataBuilder.Append("<cell>0.00</cell>");
|
|
|
dataBuilder.Append("<cell>0.00</cell>");
|
|
|
dataBuilder.Append("<cell>0.00</cell>");
|
|
|
dataBuilder.Append("<cell>0.00</cell>");
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
dataBuilder.Append("<cell></cell>");
|
|
|
//
|
|
|
dataBuilder.Append("</row>");
|
|
|
dataBuilder.Append("</rows>");
|
|
|
return dataBuilder.ToString();
|
|
|
}
|
|
|
else if (!strReadXmlType.Equals("exist"))
|
|
|
{
|
|
|
//获取所有账户信息,用做Grid显示
|
|
|
DataTable WmsZXInfoTable = new DataTable();
|
|
|
|
|
|
//初始化
|
|
|
string strInitSql = "";
|
|
|
if (strParentGID.ToString().Trim() == "")
|
|
|
{
|
|
|
strInitSql = " SELECT GID,LINENUM,CTNALL,CNTRNO,SEALNO,GOODSPACK,GOODSRKSL,GOODSPACKACTUAL,GOODSRKSLACTUAL,ARFEE,APFEE,MARKETVALUE,BANKVALUE,AREANAME,REMARK,GOODSPACKSTOCK,GOODSSTOCK,ASSOCIATEDNO,MODIFIEDTIME FROM wms_in WHERE 1<0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//Row_Number() over (order by getdate()) as
|
|
|
strInitSql = " SELECT GID,LINENUM,CTNALL,CNTRNO,SEALNO,GOODSPACK,GOODSRKSL,GOODSPACKACTUAL,GOODSRKSLACTUAL,ARFEE,APFEE,MARKETVALUE,BANKVALUE,AREANAME,REMARK,GOODSPACKSTOCK,GOODSSTOCK,ASSOCIATEDNO,MODIFIEDTIME FROM wms_in WHERE 1=1 and ASSOCIATEDNO='" + strParentGID.ToString().Trim() + "'" + strRange + " ORDER BY CREATETIME,LINENUM";//MODIFIEDTIME desc
|
|
|
}
|
|
|
WmsZXInfoTable = getStatusNameTable(WmsInDA.GetExcuteSql(strInitSql).Tables[0]);
|
|
|
|
|
|
//编排字符串 xml串
|
|
|
StringBuilder dataBuilder = new StringBuilder();
|
|
|
|
|
|
dataBuilder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
|
|
dataBuilder.Append("<rows>");
|
|
|
|
|
|
int iCount = WmsZXInfoTable.Rows.Count;
|
|
|
|
|
|
for (int i = 0; i < iCount; i++)
|
|
|
{
|
|
|
int jCount = WmsZXInfoTable.Columns.Count;
|
|
|
dataBuilder.Append("<row id=\"" + WmsZXInfoTable.Rows[i]["GID"].ToString() + "\">");
|
|
|
dataBuilder.Append("<cell>0</cell>");
|
|
|
for (int j = 1; j < jCount; j++)
|
|
|
{
|
|
|
switch (j)
|
|
|
{
|
|
|
case 1:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 2:
|
|
|
string xl = GetCTNALL(WmsZXInfoTable.Rows[i][j].ToString().Trim());
|
|
|
if (xl != "")
|
|
|
{
|
|
|
dataBuilder.Append(xl);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
|
//string xl = GetCTN(WmsZXInfoTable.Rows[i][j].ToString().Trim());
|
|
|
//if (xl != "")
|
|
|
//{
|
|
|
// dataBuilder.Append(xl);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
//}
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 4:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 5:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 6:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 7:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 8:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 9:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 10:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 11:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 12:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 13:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 14:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 15:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
case 16:
|
|
|
dataBuilder.Append("<cell>" + WmsZXInfoTable.Rows[i][j].ToString() + "</cell>");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
dataBuilder.Append("</row>");
|
|
|
}
|
|
|
dataBuilder.Append("</rows>");
|
|
|
|
|
|
return dataBuilder.ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return "-3";//没有相关的账户
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取当前业务录入的集装箱——箱型
|
|
|
/// </summary>
|
|
|
/// <param name="strClientValue">当前业务GID</param>
|
|
|
/// <returns></returns>
|
|
|
public string GetCTNALL(string strCTNALL)
|
|
|
{
|
|
|
StringBuilder CTNBuilder = new StringBuilder();
|
|
|
CTNBuilder.Append("<cell xmlcontent=\"1\" editable=\"1\">" + strCTNALL);
|
|
|
//
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
//string js = "select * from op_ctn where bsno in ('" + strassociatedno + "') order by CTNALL";
|
|
|
string js = "select * from code_ctn order by CTN";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(js);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
DataTable CTNTable = ds.Tables[0];
|
|
|
if (CTNTable != null)
|
|
|
{
|
|
|
for (int i = 0; i < CTNTable.Rows.Count; i++)
|
|
|
{
|
|
|
if (!CTNTable.Rows[i]["CTN"].ToString().Trim().Equals(""))
|
|
|
{
|
|
|
CTNBuilder.Append("<option value=\"" + CTNTable.Rows[i]["CTN"].ToString().ToUpper() + "\">" + CTNTable.Rows[i]["CTN"].ToString().ToUpper() + "</option>");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
CTNBuilder.Append("<option value=\"\"></option>");
|
|
|
CTNBuilder.Append("</cell>");
|
|
|
return CTNBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取当前业务录入的集装箱——箱号
|
|
|
/// </summary>
|
|
|
/// <param name="strClientValue">当前业务GID</param>
|
|
|
/// <returns></returns>
|
|
|
public string GetCTN(string strCTN)
|
|
|
{
|
|
|
StringBuilder CTNBuilder = new StringBuilder();
|
|
|
CTNBuilder.Append("<cell xmlcontent=\"1\" editable=\"1\">" + strCTN);
|
|
|
//
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
string js = "select * from op_ctn where bsno in ('" + strassociatedno + "') order by CNTRNO";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(js);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
DataTable CTNTable = ds.Tables[0];
|
|
|
if (CTNTable != null)
|
|
|
{
|
|
|
for (int i = 0; i < CTNTable.Rows.Count; i++)
|
|
|
{
|
|
|
if (!CTNTable.Rows[i]["CNTRNO"].ToString().Trim().Equals(""))
|
|
|
{
|
|
|
CTNBuilder.Append("<option value=\"" + CTNTable.Rows[i]["CNTRNO"].ToString().ToUpper() + "\">" + CTNTable.Rows[i]["CNTRNO"].ToString().ToUpper() + "</option>");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
CTNBuilder.Append("<option value=\"\"></option>");
|
|
|
CTNBuilder.Append("</cell>");
|
|
|
return CTNBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 将数据集表中账户状态WmsZXInfoStatus和应收应付类型WmsZXInfoType的数字状态位转换成文字
|
|
|
/// </summary>
|
|
|
/// <param name="tempTable">原数据源DataTable</param>
|
|
|
/// <returns>返回新数据源DataTable</returns>
|
|
|
private DataTable getStatusNameTable(DataTable tempTable)
|
|
|
{
|
|
|
DataTable sourceTable = tempTable;
|
|
|
DataTable cloneTable = new DataTable();
|
|
|
int iSwitch = 0;
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
if (iSwitch == 0)
|
|
|
{
|
|
|
for (int j = 0; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
DataColumn newColumn = new DataColumn();
|
|
|
newColumn.ColumnName = sourceTable.Columns[j].ColumnName;
|
|
|
newColumn.DataType = sourceTable.Columns[j].DataType;
|
|
|
cloneTable.Columns.Add(newColumn);
|
|
|
}
|
|
|
iSwitch = 1;
|
|
|
}
|
|
|
DataRow cloneRow = cloneTable.NewRow();
|
|
|
|
|
|
for (int k = 0; k < sourceTable.Columns.Count; k++)
|
|
|
{
|
|
|
cloneRow[sourceTable.Columns[k].ColumnName] = sourceTable.Rows[i][k];
|
|
|
}
|
|
|
cloneTable.Rows.Add(cloneRow);
|
|
|
}
|
|
|
return cloneTable;
|
|
|
}
|
|
|
|
|
|
//
|
|
|
}
|
|
|
}
|