'20221205佣金导入,对费用锁定的业务产生费用更改单'

DS7Zhanhao
ddlucky 2 years ago
parent 2234cee050
commit 4e3170d980

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress /> <Use64BitIISExpress />

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />

@ -142,7 +142,6 @@ namespace DSWeb.Common.Helper
var invItems = ChinvoiceDAL.GetDetailList("PID='" + invId + "'"); var invItems = ChinvoiceDAL.GetDetailList("PID='" + invId + "'");
RuihongPostModel postModel = new RuihongPostModel(); RuihongPostModel postModel = new RuihongPostModel();
postModel.serialNo = inv.GID; postModel.serialNo = inv.GID;
postModel.postTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); postModel.postTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@ -230,9 +229,10 @@ namespace DSWeb.Common.Helper
} }
else else
{ {
if (item.ZTAXTYPE == "免税") = "1"; //if (item.ZTAXTYPE == "免税") 零税率标识 = "1";
if (item.ZTAXTYPE == "不征税") = "2"; //if (item.ZTAXTYPE == "不征税") 零税率标识 = "2";
if (item.ZTAXTYPE == "普通零税率") = "3"; //if (item.ZTAXTYPE == "普通零税率") 零税率标识 = "3";
= item.ZTAXTYPE ;
} }
var taxrate = Math.Round(item.TAXRATE / 100, 2, MidpointRounding.AwayFromZero).ToString(); var taxrate = Math.Round(item.TAXRATE / 100, 2, MidpointRounding.AwayFromZero).ToString();
if (taxrate == "0.00" || taxrate == "0.0") taxrate = "0"; if (taxrate == "0.00" || taxrate == "0.0") taxrate = "0";

@ -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;
}
}
} }

@ -6703,8 +6703,10 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL
result.UNIT = UNIT; result.UNIT = UNIT;
result.MANAGER = SALE;
result.REMARK = remark; result.REMARK = remark;
//
CommonDataContext cdc = new CommonDataContext(); CommonDataContext cdc = new CommonDataContext();
var codefeelist = cdc.code_fee.Where(x => 1 == 1).ToList(); var codefeelist = cdc.code_fee.Where(x => 1 == 1).ToList();
@ -6756,7 +6758,7 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL
return result; return result;
} }
public static DBResult MakeNewFee(string USERID, string BSNO, string CUSTOMERNAME, string CUSTOMERTYPE, int FEETYPE, string FEENAME, decimal AMOUNT,string UNIT, decimal QUANTITY = 1,string SALE="") public static DBResult MakeNewFee(string USERID, string BSNO, string CUSTOMERNAME, string CUSTOMERTYPE, int FEETYPE, string FEENAME, decimal AMOUNT,string UNIT, decimal QUANTITY = 1,string SALE="",string REMARK="")
{ {
var result = new DBResult(); var result = new DBResult();
result.OK(""); result.OK("");
@ -6764,7 +6766,7 @@ namespace DSWeb.MvcShipping.DAL.MsChFeeDAL
{ {
if (AMOUNT != 0) if (AMOUNT != 0)
{ {
var newfee = getChFee(USERID, BSNO, CUSTOMERNAME, FEETYPE, FEENAME, AMOUNT,UNIT, QUANTITY); var newfee = getChFee(USERID, BSNO, CUSTOMERNAME, FEETYPE, FEENAME, AMOUNT,UNIT, QUANTITY, SALE,REMARK);
CommonDataContext cdc = new CommonDataContext(); CommonDataContext cdc = new CommonDataContext();

@ -2,9 +2,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
<NameOfLastUsedPublishProfile>配置文件1</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>H:\DS7_dev\DSWeb\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />

Loading…
Cancel
Save