You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
543 lines
23 KiB
C#
543 lines
23 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.MsOpPriceDAL;
|
|
using DSWeb.MvcShipping.Models.MsOpPrice;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using System.Collections.Generic;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Models;
|
|
using DSWeb.Attributes;
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
using DSWeb.MvcShipping.Models.MsCodeServiceFeeTemplate;
|
|
using System.IO;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
using System.Web.Configuration;
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
using DSWeb.Areas.SysMng.DAL.SysUser;
|
|
using DSWeb.MvcShipping.DAL.MsCodeOpTemplate;
|
|
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
using DSWeb.MvcShipping.Models.MsOpLetter;
|
|
using DSWeb.SoftMng.Filter;
|
|
using DSWeb.MvcShipping.DAL.MsOpApplyDAL;
|
|
using DSWeb.Areas.Account.DAL.Chfee_Payapplication;
|
|
using DSWeb.Areas.Account.Models.Chfee_do_detail;
|
|
using DSWeb.Areas.Account.Models.BSNOLB;
|
|
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
|
|
using DSWeb.MvcShipping.DAL.MsCodeDingTalkSet;
|
|
using DSWeb.MvcShipping.DAL.MsCompanysDAL;
|
|
using DSWeb.MvcShipping.DAL.MsSeaeOrderDAL;
|
|
using DSWeb.MvcShipping.Models.MsChFee;
|
|
using Ivony.Fluent;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsOpPriceController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult SellEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult AuditIndex()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult HistryIndex()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpPriceDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
int count = MsOpPriceDAL.getTotalCount(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpPriceDAL.GetAuditDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
int count = MsOpPriceDAL.getTotalCount(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataListStr(string sort, string condition)
|
|
{
|
|
var dataListStr = MsOpPriceDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
MsOpPrice head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsOpPriceDAL.GetData(condition);
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new MsOpPrice();
|
|
head.CREATEUSER = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();
|
|
head.BILLSTATUS = 1;
|
|
head.BILLSTATUSREF = "未提交";
|
|
//head.BSTYPE = "2";
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string bodylist, string otbodylist,string subtype="0", string pricetype = "询价")
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
|
|
var headData = JsonConvert.Deserialize<MsOpPrice>(data);
|
|
var bodyPriceFreight = JsonConvert.Deserialize<List<MsOpPriceFreight>>(bodylist);
|
|
var bodyPriceOther = JsonConvert.Deserialize<List<MsOpPriceOther>>(otbodylist);
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
var iscreatecustno = false;
|
|
|
|
//分公司代码
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
{
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
}
|
|
|
|
//分公司代码
|
|
if (headData.GID == "" || headData.GID == null)
|
|
{
|
|
headData.GID = Guid.NewGuid().ToString().Replace("-","");
|
|
}
|
|
headData.PRICETYPE = pricetype;
|
|
if (string.IsNullOrEmpty(headData.PGID))
|
|
headData.PGID = headData.GID;
|
|
//decimal ttlfreight = 0;
|
|
|
|
//if (bodyPriceFreight != null && bodyPriceFreight.Count != 0) {
|
|
// foreach (var bodyctn in bodyPriceFreight) {
|
|
// ttlfreight = ttlfreight + bodyctn.PRICE * bodyctn.CTNNUM;
|
|
// }
|
|
|
|
//}
|
|
//headData.TTLFREIGHT = ttlfreight;
|
|
|
|
//decimal ttlrmb = 0;
|
|
//decimal ttlusd = 0;
|
|
|
|
//if (bodyPriceOther != null && bodyPriceOther.Count != 0)
|
|
//{
|
|
// foreach (var bodyctn in bodyPriceOther)
|
|
// {
|
|
// if (bodyctn.CURRENCY=="RMB")
|
|
// ttlrmb = ttlrmb + bodyctn.AMOUNT;
|
|
// if (bodyctn.CURRENCY == "USD")
|
|
// ttlusd = ttlusd + bodyctn.AMOUNT;
|
|
// }
|
|
|
|
//}
|
|
//headData.RMBOT = ttlrmb;
|
|
//headData.USDOT = ttlusd;
|
|
var _date = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
#region 委托编号规则
|
|
var isuse = false;
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='运价管理'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
isuse = true;
|
|
else
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "6");
|
|
if (headData.BILLNO == "")
|
|
{
|
|
|
|
if (isuse)
|
|
{
|
|
if (billnoset.BILLTYPE != "")
|
|
{
|
|
headData.BILLNO= MsSysBillNoSetDAL.GetBillNo(billnoset, _date, _date, "", "", "", "");
|
|
iscreatecustno = true;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
if (headData.EFFECTIVEDATE == "") headData.EFFECTIVEDATE = null;
|
|
if (headData.VALIDDATE == "") headData.VALIDDATE = null;
|
|
if (headData.PQENDDATE == "") headData.PQENDDATE = null;
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
|
|
//
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
//
|
|
headData.BILLSTATUS = 1;
|
|
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
|
|
headData.CREATETIME = DateTime.Parse(rq);//创建时间
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
|
|
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
//
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
|
|
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.GID;
|
|
if (result.Success == true)
|
|
{
|
|
MsOpPriceDAL.SaveDetail(headData.GID, bodyPriceFreight, bodyPriceOther);
|
|
if (subtype == "2") {
|
|
if (pricetype == "询价")
|
|
{
|
|
string blUpSQL = " update op_price set BILLSTATUS=0 where GID='" + headData.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
}
|
|
else
|
|
{
|
|
string blUpSQL = " update op_price set BILLSTATUS=2 where GID='" + headData.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpPriceDAL.GetData("GID='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else {
|
|
if (iscreatecustno == true)
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
var jsonRespose = new JsonResponse { Success = false, Message =errorstr };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetPriceFreightList(string condition, string sort)
|
|
{
|
|
var dataList = MsOpPriceDAL.GetPriceFreightList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetPriceOtherList(string condition, string sort)
|
|
{
|
|
var dataList = MsOpPriceDAL.GetPriceOtherList(condition, sort);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var head = JsonConvert.Deserialize<MsOpPrice>(data);
|
|
var isfee = MsOpPriceDAL.GetFeeCount(head.GID);
|
|
if (isfee)
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message ="此票业务存在费用,请先删除费用才能删除此票业务!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else {
|
|
var BSNO = head.GID;
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Delete(head);
|
|
if (result.Success == true) { MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public ContentResult DeleteFreightDetail(string data)
|
|
{
|
|
var headdata = JsonConvert.Deserialize<MsOpPriceFreight>(data);
|
|
DBResult result = MsOpPriceDAL.DeleteFreightDetail(headdata);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeleteOtherDetail(string data)
|
|
{
|
|
var headdata = JsonConvert.Deserialize<MsOpPriceOther>(data);
|
|
DBResult result = MsOpPriceDAL.DeleteOtherDetail(headdata);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
#region 提交和撤销审核
|
|
public ContentResult SubmitAudit(string bill)
|
|
{
|
|
var headdata = MsOpPriceDAL.GetData(" GID='" + bill + "'");
|
|
|
|
if (headdata.BILLSTATUS == 1 || headdata.BILLSTATUS == 6)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string blUpSQL = " update op_price set BILLSTATUS=2 where GID='"+ headdata.GID+ "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "更新完成!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "当前状态不允许提交!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
public ContentResult SubmitAuditBack(string bill)
|
|
{
|
|
var headdata = MsOpPriceDAL.GetData(" GID='" + bill + "'");
|
|
if (headdata.PRICETYPE == "询价") {
|
|
var blcount = MsOpPriceDAL.GetRdCount("PRICETYPE='报价' and PGID='"+headdata.GID+"'");
|
|
if (blcount == 0)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string blUpSQL = " update op_price set BILLSTATUS=1 where GID='" + headdata.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "更新完成!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
else {
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "当前状态不允许,撤销提交!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else if (headdata.PRICETYPE=="报价"&&headdata.BILLSTATUS == 2)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string blUpSQL = " update op_price set BILLSTATUS=1 where GID='" + headdata.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "更新完成!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else
|
|
{
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "当前状态不允许,撤销提交!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
}
|
|
|
|
public ContentResult AuditList(string data)
|
|
{
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpPrice>>(data);
|
|
if (bodyList != null && bodyList.Count != 0) {
|
|
foreach (var body in bodyList) {
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string blUpSQL = " update op_price set BILLSTATUS=0 where GID='" + body.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "更新完成" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult AuditBackList(string data, string reason)
|
|
{
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpPrice>>(data);
|
|
if (bodyList != null && bodyList.Count != 0)
|
|
{
|
|
foreach (var body in bodyList)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string blUpSQL = " update op_price set BILLSTATUS=6,AUDITREMARK='"+reason+"' where GID='" + body.GID + "' ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "更新完成" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
public ContentResult AddSeaeOrder(string GID, string ORDNO)
|
|
{
|
|
var HeadData = MsSeaeOrderDAL.GetData("ORDNO='" + ORDNO + "'", CookieConfig.GetCookie_UserId(Request));
|
|
if (HeadData.ORSTATUS == "0" || HeadData.ORSTATUS == "1" || HeadData.ORSTATUS == "8") {
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "当前状态不允许引入报价!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
var OpPirce = MsOpPriceDAL.GetData(" GID='" + GID + "'");
|
|
var otbodyList = MsOpPriceDAL.GetPriceOtherList("BSNO='"+GID+"'");
|
|
var bodyList = MsOpPriceDAL.GetPriceFreightList("BSNO='" + GID + "'");
|
|
var OldOpPirce = OpPirce;
|
|
var OldotbodyList = otbodyList;
|
|
var OldbodyList = bodyList;
|
|
if (OpPirce.PRICETYPE == "报价" && !string.IsNullOrEmpty(OpPirce.PGID))
|
|
{
|
|
|
|
OldOpPirce = MsOpPriceDAL.GetData(" GID='" + OpPirce.PGID + "'");
|
|
OldotbodyList = MsOpPriceDAL.GetPriceOtherList("BSNO='" + OpPirce.PGID + "'");
|
|
OldbodyList = MsOpPriceDAL.GetPriceFreightList("BSNO='" + OpPirce.PGID + "'");
|
|
}
|
|
|
|
|
|
|
|
var result = MsOpPriceDAL.AddSeaeOrder(HeadData,OpPirce,bodyList,otbodyList, OldOpPirce, OldbodyList, OldotbodyList, Convert.ToString(Session["USERID"]).ToString().Trim(), Convert.ToString(Session["COMPANYID"]).ToString().Trim());
|
|
|
|
var json = JsonConvert.Serialize(new { Success = result.Success, Message = result.Message});
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult CreatePriceSell(string GID)
|
|
{
|
|
var headData = MsOpPriceDAL.GetData("GID='"+GID+"'");
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
var _date = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
|
|
//
|
|
headData.BILLSTATUS = 1;
|
|
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
|
|
headData.CREATETIME = DateTime.Parse(rq);//创建时间
|
|
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
|
|
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
|
|
headData.PRICETYPE = "报价";
|
|
headData.PGID = headData.GID;
|
|
headData.GID= Guid.NewGuid().ToString().Replace("-", "");
|
|
#region 委托编号规则
|
|
var isuse = false;
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='运价管理'", Convert.ToString(Session["COMPANYID"]));
|
|
if (billnoset.BILLTYPE != "")
|
|
isuse = true;
|
|
else
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "6");
|
|
|
|
if (isuse)
|
|
{
|
|
if (billnoset.BILLTYPE != "")
|
|
{
|
|
headData.BILLNO = MsSysBillNoSetDAL.GetBillNo(billnoset, _date, _date, "", "", "", "");
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
var OpPirce = MsOpPriceDAL.GetData(" GID='" + GID + "'");
|
|
var otbodyList = MsOpPriceDAL.GetPriceOtherList("BSNO='" + GID + "'");
|
|
var bodyList = MsOpPriceDAL.GetPriceFreightList("BSNO='" + GID + "'");
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.GID;
|
|
if (result.Success == true)
|
|
{
|
|
MsOpPriceDAL.SaveDetail(headData.GID, bodyList, otbodyList);
|
|
|
|
}
|
|
else
|
|
{
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = BSNO
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|