|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
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 System.Text;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.SeaiFee
|
|
|
|
|
{
|
|
|
|
|
public partial class WmsFeeCodeEdit : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
private string strUserID;
|
|
|
|
|
private string strCompanyID;//公司GID
|
|
|
|
|
private string strShowName;//用户显示名
|
|
|
|
|
private string strDeptName;//部门名称
|
|
|
|
|
private string strfeeJson;
|
|
|
|
|
private string strSeaBSNO;
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
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["id"] != null)
|
|
|
|
|
{
|
|
|
|
|
strSeaBSNO = Request.QueryString["id"].ToString();
|
|
|
|
|
this.h_bsno.Value = strSeaBSNO;
|
|
|
|
|
}
|
|
|
|
|
strfeeJson = h_feecache.Value;
|
|
|
|
|
if (!strfeeJson.Equals("") && h_post.Value.Equals("1"))
|
|
|
|
|
{
|
|
|
|
|
SaveWmsFeeCodeAction();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#region 将页面post获取的仓储费用信息,保存到wms_feecode中,并返回操作结果
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将页面post获取的仓储费用信息,保存到wms_feecode中,并返回操作结果
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void SaveWmsFeeCodeAction()
|
|
|
|
|
{
|
|
|
|
|
IList<WmsFeeCodeEntity> WmsFeeCodeEntities = new List<WmsFeeCodeEntity>();
|
|
|
|
|
|
|
|
|
|
if (!strfeeJson.Trim().Equals(""))
|
|
|
|
|
{ //将应收费用信息从前台页面写入费用实体类feeEntities
|
|
|
|
|
WmsFeeCodeEntities = ResolveWmsFeeCodeJSON(strfeeJson.Trim(), WmsFeeCodeEntities);
|
|
|
|
|
this.h_feecache.Value = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WmsFeeCodeDA WmsFeeCodeDA = new WmsFeeCodeDA();
|
|
|
|
|
foreach (WmsFeeCodeEntity feecodeentity in WmsFeeCodeEntities)
|
|
|
|
|
{
|
|
|
|
|
string strwhere = String.Format(" GID='{0}' ", feecodeentity.GID);
|
|
|
|
|
int strExists = WmsFeeCodeDA.GetRecordCount(strwhere);
|
|
|
|
|
if (strExists == 1)
|
|
|
|
|
{
|
|
|
|
|
bool iRecvState = WmsFeeCodeDA.Update(feecodeentity);//rateDA.Add(rateEntities, feeProfitEntity, strSeaBSNO);
|
|
|
|
|
}
|
|
|
|
|
else if (strExists == 0)
|
|
|
|
|
{
|
|
|
|
|
bool iRecvState = WmsFeeCodeDA.Add(feecodeentity);//rateDA.Add(rateEntities, feeProfitEntity, strSeaBSNO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.h_post.Value = "";//请求状态清空
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 将页面post获取的费用信息读入到费用实体类ch_fee中
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将页面post获取的费用信息读入到费用实体类ch_fee中
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempJSON"></param>
|
|
|
|
|
/// <param name="tempFeeEntities"></param>
|
|
|
|
|
/// <returns>将页面post获取的费用信息读入到费用实体类ch_fee中</returns>
|
|
|
|
|
private IList<WmsFeeCodeEntity> ResolveWmsFeeCodeJSON(string tempJSON, IList<WmsFeeCodeEntity> tempWmsFeeCodeEntities)
|
|
|
|
|
{
|
|
|
|
|
string strFilter = "";
|
|
|
|
|
if (tempJSON.IndexOf("[") >= 0 && tempJSON.IndexOf("]") > 0)
|
|
|
|
|
{
|
|
|
|
|
strFilter = tempJSON.Substring(tempJSON.IndexOf("[") + 1, tempJSON.IndexOf("]") - tempJSON.IndexOf("[") - 1);
|
|
|
|
|
|
|
|
|
|
string[] strFees = strFilter.Split(new string[] { "},{" }, System.StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
if (strFees.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < strFees.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
strFees[i] = strFees[i].ToString().Replace("{", "");
|
|
|
|
|
strFees[i] = strFees[i].ToString().Replace("}", "");
|
|
|
|
|
string[] strCell = strFees[i].Split(new char[] { ',' });
|
|
|
|
|
|
|
|
|
|
if (strCell.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
WmsFeeCodeEntity WmsFeeCodeEntity = new WmsFeeCodeEntity();
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < strCell.Length; j++)
|
|
|
|
|
{
|
|
|
|
|
string[] strArg = strCell[j].Split(new char[] { ':' });
|
|
|
|
|
|
|
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
|
|
{
|
|
|
|
|
case "id":
|
|
|
|
|
WmsFeeCodeEntity.GID = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
//case "type":
|
|
|
|
|
// string feetype=strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
// if (feetype == "收费")
|
|
|
|
|
// {
|
|
|
|
|
// WmsFeeCodeEntity.FEETYPE=1;
|
|
|
|
|
// }
|
|
|
|
|
// else if (feetype == "付费")
|
|
|
|
|
// {
|
|
|
|
|
// WmsFeeCodeEntity.FEETYPE = 2;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
case "bsno":
|
|
|
|
|
WmsFeeCodeEntity.BSNO = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
//case "fname":
|
|
|
|
|
// WmsFeeCodeEntity.FEENAME = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
// break;
|
|
|
|
|
//case "unit":
|
|
|
|
|
// WmsFeeCodeEntity.UNIT = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
// break;
|
|
|
|
|
case "price":
|
|
|
|
|
WmsFeeCodeEntity.UNITPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", ""));
|
|
|
|
|
break;
|
|
|
|
|
//case "cur":
|
|
|
|
|
// WmsFeeCodeEntity.CURRENCY = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
// break;
|
|
|
|
|
//case "exchange":
|
|
|
|
|
// WmsFeeCodeEntity.EXCHANGERATE = decimal.Parse(strArg[1].ToString().Replace("\"", ""));
|
|
|
|
|
// break;
|
|
|
|
|
case "remark":
|
|
|
|
|
WmsFeeCodeEntity.REMARK = strArg[1].ToString().Replace("\"", "");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//WmsFeeCodeEntity.BSNO = strSeaBSNO;
|
|
|
|
|
|
|
|
|
|
WmsFeeCodeEntity.FEETYPE = 1;
|
|
|
|
|
WmsFeeCodeEntity.FEENAME = "出库费";
|
|
|
|
|
WmsFeeCodeEntity.UNIT = "重量";
|
|
|
|
|
WmsFeeCodeEntity.CURRENCY = "RMB";
|
|
|
|
|
WmsFeeCodeEntity.EXCHANGERATE =1;
|
|
|
|
|
WmsFeeCodeEntity.CREATEUSER = this.strShowName;
|
|
|
|
|
WmsFeeCodeEntity.MODIFIEDUSER = this.strShowName;
|
|
|
|
|
|
|
|
|
|
tempWmsFeeCodeEntities.Add(WmsFeeCodeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tempWmsFeeCodeEntities;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|