dev
hanxuntao 3 weeks ago
commit 8addf3aaab

@ -3612,6 +3612,12 @@ namespace DSWeb.Common.DB
public decimal? ORDERAMOUNT { get; set; }
public decimal? ORDERINVOICE { get; set; }
public DateTime? SUBMITDATE { get; set; }
/// <summary>
/// 此字段现在用于记录这条销售订舱费用来源于哪条集装箱信息
/// </summary>
public string CTN_ID { get; set; }
public string AUDITOPERATOR { get; set; }
public DateTime? AUDITDATE { get; set; }
public string ENTEROPERATOR { get; set; }

@ -180,6 +180,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
}
else {
BasicDataRefDAL.SaveLog("用户名、密码错误", obj.openid, "wxapp", "登录2.1");
return Json(new { ErrorCode = 500, Message = "用户名或密码错误" }, JsonRequestBehavior.AllowGet);
}
var userinfo = dbc.vw_user.First(x => x.USERID == userWx.GID);
@ -197,6 +198,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
catch (Exception e) {
BasicDataRefDAL.SaveLog("", e.Message, "wxapp", "登陆错误");
//log.Debug("wxapp登陆错误" + e.Message);
return Json(new { ErrorCode = 501, Message = "系统错误:"+e.Message }, JsonRequestBehavior.AllowGet);
}
BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录f");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
@ -3357,6 +3359,18 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//20241104 保存时
//前端逻辑是编辑时先保存费用 再保存业务
//因此做如下修改
//1 如果没用费用 产生费用
//2 如果有费用 根据费用单价和单位,回写至集装箱的应收应付单价中(找不到对应的就不处理)
var updbodylist= MsSeaeOrderDAL.CreateFeeOrder(headData);
if (updbodylist != null && updbodylist.Count > 0) {
result = DSWeb.MvcShipping.DAL.MsSeaeOrderDAL.MsSeaeOrderDAL.DoSave(saveinfo.opstatus, userinfo.USERID, userinfo.SHOWNAME, headData, updbodylist);
}
return Json(new { ErrorCode = 0,Message= result.Message, Data = result.Data });
}
else
@ -3784,7 +3798,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//提交审核成功后添加费用
MsSeaeOrderDAL.CreateFeeOrder(headData);
//MsSeaeOrderDAL.CreateFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}
@ -3848,7 +3862,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//撤回提交成功 删除 ch_fee_order
MsSeaeOrderDAL.DeleteFeeOrder(headData);
//MsSeaeOrderDAL.DeleteFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}
@ -3975,7 +3989,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
if (result.Success)
{
//驳回提交成功 删除 ch_fee_order
MsSeaeOrderDAL.DeleteFeeOrder(headData);
//MsSeaeOrderDAL.DeleteFeeOrder(headData);
return Json(new { ErrorCode = 0, Message = result.Message, Data = result.Data });
}

@ -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)
{

Loading…
Cancel
Save