dev
dengyu 4 weeks ago
parent 6af142d3f0
commit 5c98291999

@ -1267,6 +1267,7 @@ namespace DSWeb.Common.DB
public DateTime? PRINTTIME { get; set; }
}
[Table("company")]
public class company_md
{
@ -3667,7 +3668,7 @@ namespace DSWeb.Common.DB
PREAMOUNT = 0;
}
public void SetAmount(decimal amount = 0) {
public void SetAmount(decimal amount ) {
AMOUNT = amount;
//QUANTITY = 1;
UNITPRICE = AMOUNT;
@ -3685,6 +3686,36 @@ namespace DSWeb.Common.DB
//ORDERINVSETTLEMENT = 0;
//PREAMOUNT = 0;
}
public void SetAmount(string _UNIT,decimal _PRICE, decimal _QUANTITY=1)
{
//QUANTITY = 1;
UNITPRICE = _PRICE;
TAXUNITPRICE = _PRICE;
//EXCHANGERATE = 1;
//CURRENCY = "RMB";
//SETTLEMENT = 0;
//INVOICE = 0;
//ORDERAMOUNT = 0;
//ORDERINVOICE = 0;
QUANTITY = _QUANTITY;
AMOUNT = (decimal)(UNITPRICE * QUANTITY);
NOTAXAMOUNT = UNITPRICE * QUANTITY;
//ACCTAXRATE = 0;
//TAX = 0;
//ORDERSETTLEMENT = 0;
//ORDERINVSETTLEMENT = 0;
//PREAMOUNT = 0;
}
public void SetAmount()
{
AMOUNT = (decimal)(UNITPRICE * QUANTITY);
NOTAXAMOUNT = UNITPRICE * QUANTITY;
}
}

@ -446,6 +446,19 @@ namespace DSWeb.Areas.Dispatch.Controllers
});
}
if (QueryInfo.formname == "BSSOURCE")
{
var evList = BasicDataRefDAL.GetSourceList("1=1", "");
_result = Json(new
{
ErrorCode = 0,
Message = "获取成功",
BaseInfo = evList
});
}
return _result;
}
catch (Exception e)
@ -3286,7 +3299,11 @@ namespace DSWeb.Areas.Dispatch.Controllers
var condition = SearchParam.getcondition(searchParams);
var datalist = MsSeaeOrderDAL.GetDataList(QueryInfo.start, QueryInfo.limit, condition, userinfo.USERID,userinfo.CODENAME, userinfo.COMPANYID);
//DatasetSort _sort = new DatasetSort();
var sortstr = @"[{""property"":""BSDATE"",""direction"":""desc""}]";
var datalist = MsSeaeOrderDAL.GetDataList(QueryInfo.start, QueryInfo.limit, condition, userinfo.USERID,userinfo.CODENAME, userinfo.COMPANYID, sortstr);
var totalcount = MsSeaeOrderDAL.getTotalCount(condition, userinfo.USERID, userinfo.CODENAME, userinfo.COMPANYID);
@ -3386,7 +3403,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
var condition = SearchParam.getcondition(searchParams);
var datalist = MsSeaeOrderDAL.GetAuditDataList( condition, userinfo.USERID, userinfo.SHOWNAME, userinfo.COMPANYID, QueryInfo.start, QueryInfo.limit);
var sortstr = @"[{""property"":""BSDATE"",""direction"":""desc""}]";
var datalist = MsSeaeOrderDAL.GetAuditDataList( condition, userinfo.USERID, userinfo.SHOWNAME, userinfo.COMPANYID, QueryInfo.start, QueryInfo.limit, sortstr);
var totalcount = MsSeaeOrderDAL.getAuditCount(condition, userinfo.USERID, userinfo.SHOWNAME, userinfo.COMPANYID);
@ -3764,6 +3783,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//提交审核成功后添加费用
MsSeaeOrderDAL.CreateFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}
else
@ -3825,7 +3847,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//删除 ch_fee_order
//撤回提交成功 删除 ch_fee_order
MsSeaeOrderDAL.DeleteFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}
else
@ -3950,7 +3974,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//删除ch_fee_order
//驳回提交成功 删除 ch_fee_order
MsSeaeOrderDAL.DeleteFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}
else
@ -4031,7 +4057,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
/// <summary>
/// 获取费用列表
/// 获取销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>
@ -4089,7 +4115,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
/// <summary>
/// 保存费用列表
/// 保存销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>
@ -4117,7 +4143,6 @@ namespace DSWeb.Areas.Dispatch.Controllers
#endregion
string LANGUAGES = "";
string userid = userinfo.USERID;
@ -4154,7 +4179,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
/// <summary>
/// 删除费用列表
/// 删除销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>

@ -26,6 +26,10 @@ using DSWeb.MvcShipping.DAL.MsInfoClient;
using DSWeb.MvcShipping.Models.MsOpSeai;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.Models.MsChFee;
using com.sun.crypto.provider;
using System.Linq;
namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
{
@ -1735,6 +1739,103 @@ namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
}
#endregion
#region 通过微信小程序提交审核时 产生ch_fee_order / 撤回或驳回时删除
public static DBResult CreateFeeOrder(MsSeaeOrder OrderData) {
var result = new DBResult();
result.OK();
var bodycondition= " ordno='" + OrderData.ORDNO + "'";
var bodylist = GetBodyList(bodycondition);
if (bodylist != null && bodylist.Count > 0 && bodylist.Exists(x => x.Price_YF > 0 || x.Price_YS > 0))
{
//生成费用 应收结算对象为委托单位 应付对象为订舱代理
var cdc = new CommonDataContext();
var currentorderfee = cdc.ch_fee_order.Where(x => x.BSNO == OrderData.BSNO && x.FEENAME=="海运费").ToList();
var addFeeList = new List<ch_fee_order_md>();
if (bodylist.Exists(x => x.Price_YS > 0) && !currentorderfee.Exists(x => x.FEETYPE == 1))
{
foreach (var ctn in bodylist.Where(x => x.Price_YS > 0))
{
if (addFeeList.Exists(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 1 && x.UNITPRICE == ctn.Price_YS))
{
addFeeList.First(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 1 && x.UNITPRICE == ctn.Price_YS).QUANTITY += ctn.CTNNUM;
addFeeList.First(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 1 && x.UNITPRICE == ctn.Price_YS).SetAmount();
}
else {
var newfee = new ch_fee_order_md();
newfee.FEENAME = "海运费";
newfee.FEETYPE = 1;
newfee.SetAmount(ctn.CTNALL,(decimal) ctn.Price_YS, ctn.CTNNUM);
newfee.GID = Guid.NewGuid().ToString();
newfee.BSNO = OrderData.BSNO;
newfee.CUSTOMERTYPE = "委托单位";
newfee.CUSTOMERNAME = OrderData.CUSTOMERNAME;
addFeeList.Add(newfee);
}
}
}
if (bodylist.Exists(x => x.Price_YF > 0) && !currentorderfee.Exists(x => x.FEETYPE == 2))
{
foreach (var ctn in bodylist.Where(x => x.Price_YF > 0))
{
if (addFeeList.Exists(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 2 && x.UNITPRICE == ctn.Price_YF))
{
addFeeList.First(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 2 && x.UNITPRICE == ctn.Price_YF).QUANTITY += ctn.CTNNUM;
addFeeList.First(x => x.UNIT == ctn.CTNALL && x.FEETYPE == 2 && x.UNITPRICE == ctn.Price_YF).SetAmount();
}
else
{
var newfee = new ch_fee_order_md();
newfee.FEENAME = "海运费";
newfee.FEETYPE = 2;
newfee.SetAmount(ctn.CTNALL, (decimal)ctn.Price_YF, ctn.CTNNUM);
newfee.GID = Guid.NewGuid().ToString();
newfee.BSNO = OrderData.BSNO;
newfee.CUSTOMERTYPE = "订舱代理";
newfee.CUSTOMERNAME = OrderData.FORWARDER;
addFeeList.Add(newfee);
}
}
}
if (addFeeList != null && addFeeList.Count > 0) {
cdc.ch_fee_order.AddRange(addFeeList);
cdc.SaveChanges();
}
}
return result;
}
public static DBResult DeleteFeeOrder(MsSeaeOrder OrderData)
{
var result = new DBResult();
result.OK();
var cdc = new CommonDataContext();
var currentorderfee = cdc.ch_fee_order.Where(x => x.BSNO == OrderData.BSNO && x.FEENAME == "海运费").ToList();
if (currentorderfee != null && currentorderfee.Count > 0)
{
cdc.ch_fee_order.RemoveRange(currentorderfee);
cdc.SaveChanges();
}
return result;
}
#endregion
#region 确认订舱
public static DBResult OrderToOp(MsSeaeOrder OrderData, string accdate, string op, string custservice, string FORWARDER, string ORREMARK,string OPNAME,string COMPANYID,string userid)

Loading…
Cancel
Save