You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/DAL/MsOp_InternalTrade/MsOp_InternalTradeDAL.cs

1284 lines
76 KiB
C#

3 years ago
using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using DSWeb.MvcShipping.Models.MsOp_InternalTrade;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using System.Web.Mvc;//ContentResult
using DSWeb.TruckMng.Helper.Repository;//ModelObjectRepository
using DSWeb.MvcShipping.Helper;
using DSWeb.Areas.CommMng.DAL;//使用获取权限子句
using DSWeb.Areas.SysMng.DAL.SysTask;
2 years ago
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using HcUtility.Core;
using DSWeb.MvcShipping.Models.MsChFee;
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
3 years ago
namespace DSWeb.Areas.MvcShipping.DAL.MsOp_InternalTrade
{
public class MsOp_InternalTradeDAL
{
#region 内贸业务 头表/明细表 查询
static public List<MsOp_INTERNALTRADEmb> GetDataList (int start,int limit, string strCondition,string USERID,out int count, string sort = "" )
{
var strSql = "";
MsOp_INTERNALTRADEmb qo = new MsOp_INTERNALTRADEmb();
strSql = qo.getSQL(start,limit, strCondition,USERID,out count, sort);
return SetData(strSql);
}
public static MsOp_INTERNALTRADEmb GetData(string condition, string USERID)
{
var _count = 0;
var dataList = GetDataList(0,1,condition, USERID, out _count);
var result = new MsOp_INTERNALTRADEmb();
if (dataList.Count > 0)
{
result = dataList[0];
}
else {
result.getDef(USERID);
}
return result;
}
public static string getHeadListStr(string condition)
{
MsOp_INTERNALTRADEmb qo = new MsOp_INTERNALTRADEmb();
var result = qo.getSQL_all(0, 999, condition);
return result;
}
public static string getBodyListStr(string condition)
{
string result = MsOp_INTERNALTRADE_Detailmb.getSQL() ;
if (!string.IsNullOrWhiteSpace(condition)) {
result += condition;
}
return result;
}
private static List<MsOp_INTERNALTRADEmb> SetData(string strSql)
{
var headList = new List<MsOp_INTERNALTRADEmb>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql))
{
while (reader.Read())
{
////根据字段名设定同名属性值
MsOp_INTERNALTRADEmb data = new MsOp_INTERNALTRADEmb();
data.SetExtendValue(reader);
if (data.GetDecimal("TTLINVDR") == 0)
{
data.SetValue("DRINVSTATUS", "未开票");
}
else
{
var _TTLINVDR = data.GetDecimal("TTLINVDR");
var _TTLDR = data.GetDecimal("_TTLDR");
if (_TTLINVDR == _TTLDR)
{
data.SetValue("DRINVSTATUS", "已开票");
}
else
if (_TTLINVDR != _TTLDR)
{
data.SetValue("DRINVSTATUS", "部分开票");
}
}
headList.Add(data);
}
reader.Close();
}
return headList;
}
static public List<MsOp_INTERNALTRADE_Detailmb> GetBodyList(string strCondition, string sort = null)
{
var strSql = new StringBuilder();
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by GOODSNAME,LOTNO ");
}
return SetBodyData(strSql);
}
private static List<MsOp_INTERNALTRADE_Detailmb> SetBodyData(StringBuilder strSql)//, List<HcUtility.Core.Fieldmb> fieldlist
{
var headList = new List<MsOp_INTERNALTRADE_Detailmb>();
Database db = DatabaseFactory.CreateDatabase();
string sql = getBodyListStr(strSql.ToString());
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql))
{
while (reader.Read())
{
////根据字段名设定同名属性值
MsOp_INTERNALTRADE_Detailmb data = new MsOp_INTERNALTRADE_Detailmb();
data.SetExtendValue(reader);
headList.Add(data);
}
reader.Close();
}
return headList;
}
#endregion
2 years ago
public static DBResult ImpOpInternalTrade(DataTable table, string userid, string username, string companyid)
{
var result = new DBResult();
var PreCUSTNO = "";
var BSNO = "";
Database db = DatabaseFactory.CreateDatabase();
var cmdInsert =
db.GetSqlStringCommand(
@"insert into op_InternalTrade_Detail (GID,BSNO,ORDERNO,LOTNO,GOODSNAME,PACKEGS,LOADDATE,LOADADDR,SEQUENCE)
values (@GID,@BSNO,@ORDERNO,@LOTNO,@GOODSNAME,@PACKEGS,@LOADDATE,@LOADADDR,@SEQUENCE) ");
var _date = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
try
{
var CUSTOMERNAME = "";
var TRUCKER = "";
var TRUCKER2 = "";
var CARRIER = "";
int num = 0;
foreach (DataRow row in table.Rows)
{
if (row[1].ToString() != "")
{
num = num + 1;
var CUSTNO = Convert.ToString(row["委托编号"]);
if (!string.IsNullOrEmpty(CUSTNO))
{
PreCUSTNO = CUSTNO;
num = 0;
var headData = new MsOp_INTERNALTRADEmb();
headData.GetTableField(db);
BSNO = System.Guid.NewGuid().ToString();
headData.SetValue("BSNO", BSNO);
headData.SetValue("MASTERNO", BSNO);
headData.SetValue("BSSTATUS", "0");
headData.SetValue("FEESTATUS","0");
headData.SetValue("BSDATE", _date);
headData.SetValue("CREATOR", username);
headData.SetValue("OP", username);
headData.SetValue("DOC", username);
headData.SetValue("CUSTSERVICE", username);
headData.SetValue("CORPID", companyid);
headData.SetValue("SALECORPID", companyid);
headData.DbOperationType = DbOperationType.DbotIns;
headData.SetValue("CUSTNO", CUSTNO);
CUSTOMERNAME = Convert.ToString(row["委托单位"]);
headData.SetValue("CUSTOMERNAME", CUSTOMERNAME);
headData.SetValue("MBLNO", Convert.ToString(row["主提单号"]));
headData.SetValue("OP", Convert.ToString(row["操作"]));
headData.SetValue("SALE", Convert.ToString(row["销售"]));
CARRIER = Convert.ToString(row["船公司"]);
headData.SetValue("CARRIER", CARRIER);
headData.SetValue("VESSEL", Convert.ToString(row["船名"]));
headData.SetValue("VOYNO", Convert.ToString(row["航次"]));
var period = ChMonthCloseDAL.GetData("", companyid);
if (Convert.ToDateTime(period.FDAY) > DateTime.Now)
{
headData.SetValue("ACCDATE", period.PERIOD);
}
else
{
headData.SetValue("ACCDATE", DateTime.Now.ToString("yyyy-MM"));
}
headData.SetValue("PORTLOADID", Convert.ToString(row["启运港"]));
headData.SetValue("ETD", Convert.ToString(row["开船日期"]));
headData.SetValue("ETA", Convert.ToString(row["到港日期"]));
headData.SetValue("EMPTYCTNTOSHIPPERDATE", Convert.ToString(row["提箱日期"]));
headData.SetValue("CTNALL", Convert.ToString(row["箱型"]));
headData.SetValue("SALEDEPT", Convert.ToString(row["所属部门"]));
TRUCKER = Convert.ToString(row["装货车队"]);
headData.SetValue("TRUCKER", TRUCKER);
headData.SetValue("TRUCKNO", Convert.ToString(row["装货车牌号"]));
headData.SetValue("CNTRNO", Convert.ToString(row["箱号"]));
headData.SetValue("SEALNO", Convert.ToString(row["封号"]));
headData.SetValue("PORTDISCHARGEID", Convert.ToString(row["目的港"]));
2 years ago
headData.SetValue("CONSIGNEECONTACT", Convert.ToString(row["收货人"]));
2 years ago
headData.SetValue("CONSIGNEETEL", Convert.ToString(row["收货人电话"]));
headData.SetValue("PlACERECEIPT", Convert.ToString(row["收货人地址"]));
TRUCKER2 = Convert.ToString(row["送货车队名称"]);
headData.SetValue("TRUCKER2", TRUCKER2);
headData.SetValue("TRUCKNO2", Convert.ToString(row["送货车牌号"]));
headData.SetValue("RECEIVEDATE", Convert.ToString(row["到厂日期"]));
headData.SetValue("DISCHARGEREMARK", Convert.ToString(row["备注"]));
var modb = new ModelObjectDB();
result = modb.Save(headData);
}
if (result.Success)
{
cmdInsert.Parameters.Clear();
db.AddInParameter(cmdInsert, "@GID", DbType.String, Guid.NewGuid().ToString());
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, BSNO);
db.AddInParameter(cmdInsert, "@ORDERNO", DbType.String, Convert.ToString(row["系统订单号"]));
db.AddInParameter(cmdInsert, "@LOTNO", DbType.String, Convert.ToString(row["批次号"]));
db.AddInParameter(cmdInsert, "@GOODSNAME", DbType.String, Convert.ToString(row["品名"]));
db.AddInParameter(cmdInsert, "@PACKEGS", DbType.String, Convert.ToString(row["单柜数量"]));
db.AddInParameter(cmdInsert, "@LOADDATE", DbType.String, Convert.ToString(row["装箱时间"]));
db.AddInParameter(cmdInsert, "@LOADADDR", DbType.String, Convert.ToString(row["装箱地点"]));
db.AddInParameter(cmdInsert, "@SEQUENCE", DbType.Int16, num);
db.ExecuteNonQuery(cmdInsert);
var newfeelist = new List<MsChFee>();
var baoxian = Convert.ToString(row["保险费"]);
var baoxiangongs = Convert.ToString(row["保险公司名称"]);
if ((!string.IsNullOrEmpty(baoxian)) &&(Convert.ToDecimal(baoxian)!=0)) {
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType =2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName ="保险费";
enumValueBody.CustomerName = baoxiangongs;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(baoxian);
enumValueBody.Amount = Convert.ToDecimal(baoxian);
enumValueBody.NoTaxAmount = Convert.ToDecimal(baoxian);
enumValueBody.Currency ="RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var HYF = Convert.ToString(row["海运费"]);
var HYFGS = Convert.ToString(row["船公司名称"]);
if ((!string.IsNullOrEmpty(HYF)) && (Convert.ToDecimal(HYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "海运费";
enumValueBody.CustomerName = HYFGS;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(HYF);
enumValueBody.Amount = Convert.ToDecimal(HYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(HYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var QYGLYF = Convert.ToString(row["起始港陆运费"]);
var QYGLYFGS = Convert.ToString(row["车队名称1"]);
if ((!string.IsNullOrEmpty(QYGLYF)) && (Convert.ToDecimal(QYGLYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "起始港陆运费";
enumValueBody.CustomerName = QYGLYFGS;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(QYGLYF);
enumValueBody.Amount = Convert.ToDecimal(QYGLYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(QYGLYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var QYGLXF = Convert.ToString(row["落箱费"]);
if ((!string.IsNullOrEmpty(QYGLXF)) && (Convert.ToDecimal(QYGLXF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "落箱费";
enumValueBody.CustomerName = TRUCKER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(QYGLXF);
enumValueBody.Amount = Convert.ToDecimal(QYGLXF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(QYGLXF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var QYGYYFJF = Convert.ToString(row["起始港燃油附加费"]);
if ((!string.IsNullOrEmpty(QYGYYFJF)) && (Convert.ToDecimal(QYGYYFJF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "起始港燃油附加费";
enumValueBody.CustomerName = TRUCKER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(QYGYYFJF);
enumValueBody.Amount = Convert.ToDecimal(QYGYYFJF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(QYGYYFJF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var QYGCZF = Convert.ToString(row["船证费"]);
if ((!string.IsNullOrEmpty(QYGCZF)) && (Convert.ToDecimal(QYGCZF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "船证费";
enumValueBody.CustomerName = TRUCKER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(QYGCZF);
enumValueBody.Amount = Convert.ToDecimal(QYGCZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(QYGCZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var MDGLYF = Convert.ToString(row["目的港陆运费"]);
var MDGLYFGS = Convert.ToString(row["车队名称2"]);
if ((!string.IsNullOrEmpty(MDGLYF)) && (Convert.ToDecimal(MDGLYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "目的港陆运费";
enumValueBody.CustomerName = MDGLYFGS;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(MDGLYF);
enumValueBody.Amount = Convert.ToDecimal(MDGLYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(MDGLYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var MDGZF = Convert.ToString(row["目的港杂费"]);
if ((!string.IsNullOrEmpty(MDGZF)) && (Convert.ToDecimal(MDGZF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "目的港杂费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(MDGZF);
enumValueBody.Amount = Convert.ToDecimal(MDGZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(MDGZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var YYFJF = Convert.ToString(row["燃油附加费"]);
if ((!string.IsNullOrEmpty(YYFJF)) && (Convert.ToDecimal(YYFJF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "燃油附加费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(YYFJF);
enumValueBody.Amount = Convert.ToDecimal(YYFJF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(YYFJF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var ZXF = Convert.ToString(row["装卸费"]);
if ((!string.IsNullOrEmpty(ZXF)) && (Convert.ToDecimal(ZXF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "装卸费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(ZXF);
enumValueBody.Amount = Convert.ToDecimal(ZXF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(ZXF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var BW1J = Convert.ToString(row["保温一级"]);
if ((!string.IsNullOrEmpty(BW1J)) && (Convert.ToDecimal(BW1J) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "保温一级";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(BW1J);
enumValueBody.Amount = Convert.ToDecimal(BW1J);
enumValueBody.NoTaxAmount = Convert.ToDecimal(BW1J);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var BW2J = Convert.ToString(row["保温二级"]);
if ((!string.IsNullOrEmpty(BW2J)) && (Convert.ToDecimal(BW2J) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "保温二级";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(BW2J);
enumValueBody.Amount = Convert.ToDecimal(BW2J);
enumValueBody.NoTaxAmount = Convert.ToDecimal(BW2J);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var BW3J = Convert.ToString(row["保温三级"]);
if ((!string.IsNullOrEmpty(BW3J)) && (Convert.ToDecimal(BW3J) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "保温三级";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(BW3J);
enumValueBody.Amount = Convert.ToDecimal(BW3J);
enumValueBody.NoTaxAmount = Convert.ToDecimal(BW3J);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var CGSLYF = Convert.ToString(row["船公司陆运费"]);
if ((!string.IsNullOrEmpty(CGSLYF)) && (Convert.ToDecimal(CGSLYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "陆运费";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(CGSLYF);
enumValueBody.Amount = Convert.ToDecimal(CGSLYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(CGSLYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var MDGHDF = Convert.ToString(row["目的港换单费"]);
if ((!string.IsNullOrEmpty(MDGHDF)) && (Convert.ToDecimal(MDGHDF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "换单费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(MDGHDF);
enumValueBody.Amount = Convert.ToDecimal(MDGHDF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(MDGHDF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var RYFJF = Convert.ToString(row["燃油附加费"]);
if ((!string.IsNullOrEmpty(RYFJF)) && (Convert.ToDecimal(RYFJF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "燃油附加费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(RYFJF);
enumValueBody.Amount = Convert.ToDecimal(RYFJF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(RYFJF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var PSF = Convert.ToString(row["破损"]);
if ((!string.IsNullOrEmpty(PSF)) && (Convert.ToDecimal(PSF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "破损";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(PSF);
enumValueBody.Amount = Convert.ToDecimal(PSF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(PSF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
enumValueBody.Remark= Convert.ToString(row["破损备注"]);
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var DCCQF = Convert.ToString(row["堆存超期费"]);
if ((!string.IsNullOrEmpty(DCCQF)) && (Convert.ToDecimal(DCCQF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "堆存超期费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(DCCQF);
enumValueBody.Amount = Convert.ToDecimal(DCCQF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(DCCQF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var XSCQF = Convert.ToString(row["箱使费超期"]);
if ((!string.IsNullOrEmpty(XSCQF)) && (Convert.ToDecimal(XSCQF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "箱使费超期";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(XSCQF);
enumValueBody.Amount = Convert.ToDecimal(XSCQF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(XSCQF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var XTFJF = Convert.ToString(row["箱体附加费"]);
if ((!string.IsNullOrEmpty(XTFJF)) && (Convert.ToDecimal(XTFJF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "箱体附加费";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(XTFJF);
enumValueBody.Amount = Convert.ToDecimal(XTFJF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(XTFJF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var YSYF = Convert.ToString(row["运费"]);
if ((!string.IsNullOrEmpty(YSYF)) && (Convert.ToDecimal(YSYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 1;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "运费";
enumValueBody.CustomerName = CUSTOMERNAME;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(YSYF);
enumValueBody.Amount = Convert.ToDecimal(YSYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(YSYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var HYGZF = Convert.ToString(row["海运港杂费"]);
if ((!string.IsNullOrEmpty(HYGZF)) && (Convert.ToDecimal(HYGZF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "海运港杂费";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(HYGZF);
enumValueBody.Amount = Convert.ToDecimal(HYGZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(HYGZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var HYCZF = Convert.ToString(row["海运操作费"]);
if ((!string.IsNullOrEmpty(HYCZF)) && (Convert.ToDecimal(HYCZF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "海运操作费";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(HYCZF);
enumValueBody.Amount = Convert.ToDecimal(HYCZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(HYCZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var HYDZF = Convert.ToString(row["海运单证费"]);
2 years ago
if ((!string.IsNullOrEmpty(HYDZF)) && (Convert.ToDecimal(HYDZF) != 0))
2 years ago
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "海运单证费";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(HYDZF);
enumValueBody.Amount = Convert.ToDecimal(HYDZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(HYDZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
if (newfeelist.Count != 0)
MsChFeeDAL.SaveUpdateFee(newfeelist,BSNO, userid);
}
}
}
result.Success = true;
result.Message = "导入成功";
}
catch (Exception ex)
{
result.Success = false;
result.Message = "导入中出错:" + ex.Message;
}
3 years ago
2 years ago
return result;
}
3 years ago
2 years ago
public static DBResult UpdateOpInternalTrade(DataTable table, string userid, string username, string companyid)
{
var result = new DBResult();
var PreCUSTNO = "";
var BSNO = "";
Database db = DatabaseFactory.CreateDatabase();
var cmdInsert =
db.GetSqlStringCommand(
@"insert into op_InternalTrade_Detail (GID,BSNO,ORDERNO,LOTNO,GOODSNAME,PACKEGS,LOADDATE,LOADADDR,SEQUENCE)
values (@GID,@BSNO,@ORDERNO,@LOTNO,@GOODSNAME,@PACKEGS,@LOADDATE,@LOADADDR,@SEQUENCE) ");
var _date = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
try
{
var CUSTOMERNAME = "";
var TRUCKER = "";
var TRUCKER2 = "";
var CARRIER = "";
int num = 0;
foreach (DataRow row in table.Rows)
{
2 years ago
if (row[0].ToString() != "")
2 years ago
{
num = num + 1;
var CUSTNO = Convert.ToString(row["委托编号"]);
if (!string.IsNullOrEmpty(CUSTNO))
{
2 years ago
var headData = GetData("CUSTNO='" + CUSTNO + "'", userid);
2 years ago
if (headData != null)
{
2 years ago
if (string.IsNullOrEmpty(TRUCKER2))
TRUCKER2 = headData.GetValue("TRUCKER2");
CUSTOMERNAME = headData.GetValue("CUSTOMERNAME");
BSNO = headData.GetValue("BSNO");
var strSql = new StringBuilder();
strSql.Append("update Op_INTERNALTRADE set BSNO=BSNO ");
2 years ago
var ETD = Convert.ToString(row["开船日期"]);
if (!string.IsNullOrEmpty(ETD))
2 years ago
strSql.Append(",ETD=@ETD");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["到港日期"])))
2 years ago
strSql.Append(",ETA=@ETA");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人"])))
2 years ago
strSql.Append(",CONSIGNEECONTACT=@CONSIGNEECONTACT");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人电话"])))
2 years ago
strSql.Append(",CONSIGNEETEL=@CONSIGNEETEL");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人地址"])))
2 years ago
strSql.Append(",PlACERECEIPT=@PlACERECEIPT");
2 years ago
TRUCKER2 = Convert.ToString(row["送货车队名称"]);
if (!string.IsNullOrEmpty(TRUCKER2))
2 years ago
strSql.Append(",TRUCKER2=@TRUCKER2");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["送货车牌号"])))
2 years ago
strSql.Append(",TRUCKNO2=@TRUCKNO2");
2 years ago
if (!string.IsNullOrEmpty(Convert.ToString(row["到厂日期"])))
2 years ago
strSql.Append(",RECEIVEDATE=@RECEIVEDATE");
strSql.Append(" where BSNO=@BSNO ");
var cmdupdate =
db.GetSqlStringCommand(strSql.ToString());
cmdupdate.Parameters.Clear();
if (!string.IsNullOrEmpty(ETD))
db.AddInParameter(cmdupdate, "@ETD", DbType.String, Convert.ToString(row["开船日期"]));
if (!string.IsNullOrEmpty(Convert.ToString(row["到港日期"])))
db.AddInParameter(cmdupdate, "@ETA", DbType.String, Convert.ToString(row["到港日期"]));
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人"])))
db.AddInParameter(cmdupdate, "@CONSIGNEECONTACT", DbType.String, Convert.ToString(row["收货人"]));
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人电话"])))
db.AddInParameter(cmdupdate, "@CONSIGNEETEL", DbType.String, Convert.ToString(row["收货人电话"]));
if (!string.IsNullOrEmpty(Convert.ToString(row["收货人地址"])))
db.AddInParameter(cmdupdate, "@PlACERECEIPT", DbType.String, Convert.ToString(row["收货人地址"]));
TRUCKER2 = Convert.ToString(row["送货车队名称"]);
if (!string.IsNullOrEmpty(TRUCKER2))
db.AddInParameter(cmdupdate, "@TRUCKER2", DbType.String, TRUCKER2);
if (!string.IsNullOrEmpty(Convert.ToString(row["送货车牌号"])))
db.AddInParameter(cmdupdate, "@TRUCKNO2", DbType.String, Convert.ToString(row["送货车牌号"]));
if (!string.IsNullOrEmpty(Convert.ToString(row["到厂日期"])))
db.AddInParameter(cmdupdate, "@RECEIVEDATE", DbType.String, Convert.ToString(row["到厂日期"]));
db.AddInParameter(cmdupdate, "@BSNO", DbType.String,BSNO);
db.ExecuteNonQuery(cmdupdate);
result.Success = true;
2 years ago
}
if (result.Success)
{
var newfeelist = new List<MsChFee>();
var ZXF = Convert.ToString(row["装卸费"]);
2 years ago
2 years ago
if ((!string.IsNullOrEmpty(ZXF)) && (Convert.ToDecimal(ZXF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "装卸费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(ZXF);
enumValueBody.Amount = Convert.ToDecimal(ZXF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(ZXF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var MDGLYF = Convert.ToString(row["目的港陆运费"]);
if ((!string.IsNullOrEmpty(MDGLYF)) && (Convert.ToDecimal(MDGLYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "目的港陆运费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(MDGLYF);
enumValueBody.Amount = Convert.ToDecimal(MDGLYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(MDGLYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var MDGZF = Convert.ToString(row["目的港杂费"]);
if ((!string.IsNullOrEmpty(MDGZF)) && (Convert.ToDecimal(MDGZF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "目的港杂费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(MDGZF);
enumValueBody.Amount = Convert.ToDecimal(MDGZF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(MDGZF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var PSF = Convert.ToString(row["破损"]);
if ((!string.IsNullOrEmpty(PSF)) && (Convert.ToDecimal(PSF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "破损";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(PSF);
enumValueBody.Amount = Convert.ToDecimal(PSF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(PSF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
enumValueBody.Remark = Convert.ToString(row["破损备注"]);
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var DCCQF = Convert.ToString(row["堆存超期费"]);
if ((!string.IsNullOrEmpty(DCCQF)) && (Convert.ToDecimal(DCCQF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "堆存超期费";
enumValueBody.CustomerName = TRUCKER2;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(DCCQF);
enumValueBody.Amount = Convert.ToDecimal(DCCQF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(DCCQF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var XSCQF = Convert.ToString(row["箱使费超期"]);
if ((!string.IsNullOrEmpty(XSCQF)) && (Convert.ToDecimal(XSCQF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 2;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "箱使费超期";
enumValueBody.CustomerName = CARRIER;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(XSCQF);
enumValueBody.Amount = Convert.ToDecimal(XSCQF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(XSCQF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
var YSYF = Convert.ToString(row["运费"]);
if ((!string.IsNullOrEmpty(YSYF)) && (Convert.ToDecimal(YSYF) != 0))
{
var enumValueBody = new MsChFee();
enumValueBody.GId = Guid.NewGuid().ToString();
enumValueBody.BsNo = "*";
enumValueBody.FeeType = 1;
enumValueBody.FeeStatus = 0;
enumValueBody.FeeName = "运费";
enumValueBody.CustomerName = CUSTOMERNAME;
enumValueBody.EnteroPerator = userid;
enumValueBody.Unit = "票";
enumValueBody.Quantity = 1;
enumValueBody.UnitPrice = Convert.ToDecimal(YSYF);
enumValueBody.Amount = Convert.ToDecimal(YSYF);
enumValueBody.NoTaxAmount = Convert.ToDecimal(YSYF);
enumValueBody.Currency = "RMB";
enumValueBody.ExChangerate = 1;
enumValueBody.IsOpen = "0";
enumValueBody.IsAdvancedpay = "0";
enumValueBody.FeeStatus = 1;
enumValueBody.TaxRate = 0;
enumValueBody.AccTaxRate = 0;
enumValueBody.IsInvoice = "0";
enumValueBody.LOCALCURR = "RMB";
if (enumValueBody.Amount != 0)
newfeelist.Add(enumValueBody);
}
if (newfeelist.Count != 0)
MsChFeeDAL.SaveUpdateFee(newfeelist, BSNO, userid);
}
}
}
}
result.Success = true;
result.Message = "导入成功";
}
catch (Exception ex)
{
result.Success = false;
result.Message = "导入中出错:" + ex.Message;
}
return result;
}
3 years ago
}
}