|
|
@ -30,6 +30,11 @@ using MsOpBill = DSWeb.Areas.Account.Models.MsOpBill.MsOpBill;
|
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
|
using DSWeb.Areas.Account.Models.BSNOLB;
|
|
|
|
using DSWeb.Areas.Account.Models.BSNOLB;
|
|
|
|
using DSWeb.Areas.MvcShipping.Comm;
|
|
|
|
using DSWeb.Areas.MvcShipping.Comm;
|
|
|
|
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Helper;
|
|
|
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
|
|
|
|
|
|
|
|
using Quartz.Util;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1772,14 +1777,95 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var USERID = Convert.ToString(Session["USERID"]).ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
新增更改单Helper 新增更改单Helper = new 新增更改单Helper(USERID, Convert.ToString(Session["SHOWNAME"]).ToString(), Convert.ToString(Session["COMPANYID"]).ToString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (DataRow row in table.Rows) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
|
|
|
|
|
if (MBLNO != "")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var BSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where FEESTATUS=1 AND MBLNO='" + MBLNO + "'");
|
|
|
|
|
|
|
|
//20221202 如果该业务已费用锁定【feestatus=1】 采用生成费用更改单的方式生成费用
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(BSNO)) continue;
|
|
|
|
|
|
|
|
//如否 则仍按原逻辑生成费用
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
//判断业务是否已费用锁定
|
|
|
|
|
|
|
|
var head = cdc.v_op_bs.FirstOrDefault(x => x.BSNO == BSNO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (head.FEESTATUS == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//建立一个费用更改单
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
新增更改单Helper.AddHead(head, USERID, filename + "佣金导入");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mblno=Convert.ToString(row["主提单号"]);
|
|
|
|
|
|
|
|
var DRCRStr = Convert.ToString(row["收/付"]);
|
|
|
|
|
|
|
|
//var DRCR = DRCRStr == "收" ? 1 : 2;
|
|
|
|
|
|
|
|
var FEENAME = Convert.ToString(row["费用名称"]).Trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CUSTNAME = Convert.ToString(row["结算对象"]).Trim();
|
|
|
|
|
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from info_client where SHORTNAME='" + CUSTNAME + "'");
|
|
|
|
|
|
|
|
if (BLCOUNT == "0")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isSucess = false;
|
|
|
|
|
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认客户名称:" + CUSTNAME + ",是否正确!";
|
|
|
|
|
|
|
|
//jsonRespose.Success = false;
|
|
|
|
|
|
|
|
//jsonRespose.Message = message;
|
|
|
|
|
|
|
|
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from code_fee where [NAME]='" + FEENAME + "'");
|
|
|
|
|
|
|
|
if (BLCOUNT == "0")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isSucess = false;
|
|
|
|
|
|
|
|
//if (i != 0) message = "已导入" + i.ToString() + "条费用。";
|
|
|
|
|
|
|
|
message = message + " 提单号:" + MBLNO + " 无法导入,请确认费用名称:" + FEENAME + ",是否正确!";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AMOUNTSTR = Convert.ToString(row["金额"]);
|
|
|
|
|
|
|
|
var EXRATESTR = Convert.ToString(row["汇率"]);
|
|
|
|
|
|
|
|
var CURR = Convert.ToString(row["币种"]);
|
|
|
|
|
|
|
|
var ISOPEN = Convert.ToString(row["是否机密"]);
|
|
|
|
|
|
|
|
decimal amount = 0M;
|
|
|
|
|
|
|
|
decimal exrate = 0M;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
amount = Convert.ToDecimal(AMOUNTSTR);
|
|
|
|
|
|
|
|
exrate = Convert.ToDecimal(EXRATESTR);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
新增更改单Helper.AddFee(mblno, DRCRStr, FEENAME, CUSTNAME, amount,exrate,CURR, ISOPEN);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
|
|
|
jsonRespose.Message = message;
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
新增更改单Helper.DoSave();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
var i = 0;
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
|
var MBLNO = Convert.ToString(row["主提单号"]);
|
|
|
|
if (MBLNO != "")
|
|
|
|
if (MBLNO != "")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var BSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where FEESTATUS=0 AND MBLNO='" + MBLNO + "'");
|
|
|
|
var BSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where isnull(FEESTATUS,0)=0 AND MBLNO='" + MBLNO + "'");
|
|
|
|
if (BSNO == "") {
|
|
|
|
|
|
|
|
|
|
|
|
var AmendBSNO = T_ALL_DA.GetStrSQL("BSNO", "select BSNO from V_OP_BS where isnull(FEESTATUS,0)=1 AND MBLNO='" + MBLNO + "'");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( string.IsNullOrWhiteSpace(BSNO) && string.IsNullOrWhiteSpace(AmendBSNO) ) {
|
|
|
|
isSucess = false;
|
|
|
|
isSucess = false;
|
|
|
|
if (i != 0) message = "已导入"+i.ToString()+"条费用。";
|
|
|
|
if (i != 0) message = "已导入"+i.ToString()+"条费用。";
|
|
|
|
message = message+" 提单号:"+MBLNO+" 无法导入,请确认提单号正确并未费用封账!";
|
|
|
|
message = message+" 提单号:"+MBLNO+" 无法导入,请确认提单号正确并未费用封账!";
|
|
|
@ -1832,6 +1918,7 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
var userid = CookieConfig.GetCookie_UserId(Request);
|
|
|
|
var datestr = DateTime.Now.ToString();
|
|
|
|
var datestr = DateTime.Now.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 托单数据生成
|
|
|
|
#region 托单数据生成
|
|
|
|
|
|
|
|
|
|
|
|
var blUpSQL = " INSERT INTO ch_fee(GID, BSNO, FEETYPE, FEENAME, FEEDESCRIPTION, CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY, "
|
|
|
|
var blUpSQL = " INSERT INTO ch_fee(GID, BSNO, FEETYPE, FEENAME, FEEDESCRIPTION, CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY, "
|
|
|
@ -1843,11 +1930,9 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
+ " 0," + AMOUNTSTR + ",0,50," + AMOUNTSTR + ",'" + userid + "','" + datestr + "','',0,0,'','RMB','',0)";
|
|
|
|
+ " 0," + AMOUNTSTR + ",0,50," + AMOUNTSTR + ",'" + userid + "','" + datestr + "','',0,0,'','RMB','',0)";
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i = i + 1;
|
|
|
|
i = i + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1876,6 +1961,8 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> ExcelSheetName(string filepath,string ExcelExt)
|
|
|
|
public List<string> ExcelSheetName(string filepath,string ExcelExt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var al = new List<string>();
|
|
|
|
var al = new List<string>();
|
|
|
@ -1962,4 +2049,123 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class 新增更改单Helper
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
private List<v_op_bs_mb> vopbsList { get; set; }
|
|
|
|
|
|
|
|
private List<新增更改单> HeadList { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string USERID { get; set; }
|
|
|
|
|
|
|
|
private string SHOWNAME { get; set; }
|
|
|
|
|
|
|
|
private string COMPANYID { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public 新增更改单Helper(string USERID,string SHOWNAME, string COMPANYID) {
|
|
|
|
|
|
|
|
this.USERID = USERID;
|
|
|
|
|
|
|
|
this.SHOWNAME = SHOWNAME;
|
|
|
|
|
|
|
|
this.COMPANYID = COMPANYID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HeadList = new List<新增更改单>();
|
|
|
|
|
|
|
|
vopbsList = new List<v_op_bs_mb>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void AddHead(v_op_bs_mb vopbs, string USERID, string AMENDREMARK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HeadList.Count>0 && HeadList.Exists(x => x.head.PARENTID == vopbs.BSNO))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var newhead = new 新增更改单(vopbs, USERID, AMENDREMARK);
|
|
|
|
|
|
|
|
HeadList.Add(newhead);
|
|
|
|
|
|
|
|
vopbsList.Add(vopbs);
|
|
|
|
|
|
|
|
//this.USERID = USERID;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void AddFee(string MBLNO, string 应收应付, string FEENAME, string CUSTOMERNAME, decimal AMOUNT, decimal RATE, string CURR,string ISOPEN)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//var bsno
|
|
|
|
|
|
|
|
int DRCR= ((应收应付=="收")?1 : 2);
|
|
|
|
|
|
|
|
var vopbs = vopbsList.First(x => x.MBLNO == MBLNO);
|
|
|
|
|
|
|
|
var sale = vopbs.SALE;
|
|
|
|
|
|
|
|
var newfee = MsChFeeDAL.getChFee(USERID, "*", CUSTOMERNAME, DRCR, FEENAME, AMOUNT, "单票", 1, sale,"导入佣金");
|
|
|
|
|
|
|
|
newfee.EXCHANGERATE = RATE;
|
|
|
|
|
|
|
|
newfee.CURRENCY = CURR;
|
|
|
|
|
|
|
|
//newfee.setTax();
|
|
|
|
|
|
|
|
newfee.FEESTATUS = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var currentHead = HeadList.First(x => x.head.PARENTID == vopbs.BSNO);
|
|
|
|
|
|
|
|
currentHead.FeeList.Add(newfee);
|
|
|
|
|
|
|
|
//newfee.BSNO = "*";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public DBResult DoSave()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//执行保存
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HeadList != null && HeadList.Count > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mschfeecontroller = new DSWeb.MvcShipping.Controllers.MsChFeeController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var head in HeadList) {
|
|
|
|
|
|
|
|
var savehead = head.head;
|
|
|
|
|
|
|
|
savehead.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
savehead.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var savelist = head.GetChfeelist(); //AutoMapperHelper.MapToList<ch_fee_md, MsChFee>(head.FeeList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mschfeecontroller.SaveAmend_Object(head.head.BSNO, head.head, savelist, null, USERID, SHOWNAME, COMPANYID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class 新增更改单
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public MsOpAmend head { get; set; } = new MsOpAmend();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<ch_fee_md> FeeList { get; set; } = new List<ch_fee_md>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<MsChFee> GetChfeelist()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (FeeList != null && FeeList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return AutoMapperHelper.MapToList<ch_fee_md, MsChFee>(FeeList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new List<MsChFee>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public 新增更改单(v_op_bs_mb vopbs, string USERID, string AMENDREMARK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
head.BSNO = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
head.GID = head.BSNO;
|
|
|
|
|
|
|
|
head.PARENTID = vopbs.BSNO;
|
|
|
|
|
|
|
|
head.FEESTATUS = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
head.ACCDATE = System.DateTime.Now.ToString("yyyy-MM");
|
|
|
|
|
|
|
|
head.SALE = vopbs.SALE;
|
|
|
|
|
|
|
|
//head.REMARKS
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
var _user = cdc.VW_user.FirstOrDefault(x => x.USERID == USERID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
head.CREATETIME = "";
|
|
|
|
|
|
|
|
head.REMARKS = AMENDREMARK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|