|
|
|
@ -1739,14 +1739,19 @@ namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 通过微信小程序提交审核时 产生ch_fee_order / 撤回或驳回时删除
|
|
|
|
|
#region 通过微信小程序保存时 产生ch_fee_order
|
|
|
|
|
|
|
|
|
|
public static DBResult CreateFeeOrder(MsSeaeOrder OrderData) {
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
public static List<MsSeaeOrderCtn> CreateFeeOrder(MsSeaeOrder OrderData) {
|
|
|
|
|
|
|
|
|
|
//var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
//result.OK();
|
|
|
|
|
|
|
|
|
|
result.OK();
|
|
|
|
|
|
|
|
|
|
var bodycondition= " ordno='" + OrderData.ORDNO + "'";
|
|
|
|
|
var updbody = new List<MsSeaeOrderCtn>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
@ -1757,43 +1762,38 @@ namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
if (bodylist.Exists(x => x.Price_YS > 0))
|
|
|
|
|
{
|
|
|
|
|
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 {
|
|
|
|
|
if (!currentorderfee.Exists(x => x.FEETYPE == 1 && x.CTN_ID == ctn.CTN_ID))
|
|
|
|
|
{ //目前费用里面没有这个箱型的单价 生成之
|
|
|
|
|
var newfee = new ch_fee_order_md();
|
|
|
|
|
newfee.FEENAME = "海运费";
|
|
|
|
|
newfee.FEETYPE = 1;
|
|
|
|
|
newfee.SetAmount(ctn.CTNALL,(decimal) ctn.Price_YS, ctn.CTNNUM);
|
|
|
|
|
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;
|
|
|
|
|
newfee.CTN_ID = ctn.CTN_ID;
|
|
|
|
|
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 _fee = currentorderfee.First(x => x.FEETYPE == 1 && x.CTN_ID == ctn.CTN_ID);
|
|
|
|
|
|
|
|
|
|
var updrec = ctn;
|
|
|
|
|
ctn.CTNALL= _fee.UNIT;
|
|
|
|
|
ctn.Price_YS = _fee.UNITPRICE;
|
|
|
|
|
ctn.CTNNUM =(int) _fee.QUANTITY;
|
|
|
|
|
updbody.Add(ctn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!currentorderfee.Exists(x => x.FEETYPE == 2 && x.CTN_ID == ctn.CTN_ID))
|
|
|
|
|
{ //目前费用里面没有这个箱型的单价 生成之
|
|
|
|
|
var newfee = new ch_fee_order_md();
|
|
|
|
|
newfee.FEENAME = "海运费";
|
|
|
|
|
newfee.FEETYPE = 2;
|
|
|
|
@ -1802,18 +1802,46 @@ namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
|
|
|
|
|
newfee.BSNO = OrderData.BSNO;
|
|
|
|
|
newfee.CUSTOMERTYPE = "订舱代理";
|
|
|
|
|
newfee.CUSTOMERNAME = OrderData.FORWARDER;
|
|
|
|
|
newfee.CTN_ID = ctn.CTN_ID;
|
|
|
|
|
addFeeList.Add(newfee);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//目前费用里面有了这个箱的单价 看看单价是否和箱信息中相同,如果不同则修改箱信息中的单价
|
|
|
|
|
var _fee = currentorderfee.First(x => x.FEETYPE == 2 && x.CTN_ID == ctn.CTN_ID);
|
|
|
|
|
|
|
|
|
|
if (updbody.Exists(x => x.CTN_ID == ctn.CTN_ID))
|
|
|
|
|
{
|
|
|
|
|
updbody.First(x => x.CTN_ID == ctn.CTN_ID).CTNALL = _fee.UNIT;
|
|
|
|
|
updbody.First(x => x.CTN_ID == ctn.CTN_ID).Price_YF = _fee.UNITPRICE;
|
|
|
|
|
updbody.First(x => x.CTN_ID == ctn.CTN_ID).CTNNUM = (int)_fee.QUANTITY;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var updrec = ctn;
|
|
|
|
|
ctn.CTNALL = _fee.UNIT;
|
|
|
|
|
ctn.Price_YF = _fee.UNITPRICE;
|
|
|
|
|
ctn.CTNNUM = (int)_fee.QUANTITY;
|
|
|
|
|
updbody.Add(ctn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addFeeList != null && addFeeList.Count > 0) {
|
|
|
|
|
cdc.ch_fee_order.AddRange(addFeeList);
|
|
|
|
|
cdc.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (updbody != null && updbody.Count > 0) {
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
return updbody;
|
|
|
|
|
}
|
|
|
|
|
public static DBResult DeleteFeeOrder(MsSeaeOrder OrderData)
|
|
|
|
|
{
|
|
|
|
|