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.
DS7/DSWeb/Areas/TruckMng/Controllers/MsOpTruckBulkPcController.cs

1336 lines
58 KiB
C#

3 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.TruckMng.DAL.MsOpTruckBulkPcDAL;
using DSWeb.TruckMng.DAL.MsOpTruckBulkDAL;
using DSWeb.TruckMng.Models.MsOpTruckBulkPc;
using DSWeb.TruckMng.Models.MsOpTruckBulk;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using DSWeb.EntityDA;
using DSWeb.Attributes;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
namespace DSWeb.Areas.TruckMng.Controllers
{
[JsonRequestBehavior]
public class MsOpTruckBulkPcController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult HistryFeeIndex()
{
return View();
}
public ActionResult Edit()
{
return View();
}
public ActionResult FeeEdit()
{
return View();
}
public ActionResult OtherFeeView()
{
return View();
}
public ActionResult FeeAmendEdit()
{
return View();
}
public ActionResult PiLiangFeeEdit()
{
return View();
}
public ActionResult AuditIndex()
{
return View();
}
public ActionResult CtnIndex()
{
return View();
}
public ActionResult CtnEdit()
{
return View();
}
public ActionResult CtnAuditIndex()
{
return View();
}
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsOpTruckBulkPcDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
int count = MsOpTruckBulkPcDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), 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 };
}
public ContentResult GetAuditDataList(int start, int limit, string sort, string condition, string isaudit)
{
var dataList = MsOpTruckBulkPcDAL.GetAuditDataList(condition, isaudit, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition)
{
var dataListStr = MsOpTruckBulkPcDAL.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 };
}
public ContentResult GetBodyList(int start, int limit, string sort, string condition)
{
var dataList = MsOpTruckBulkPcDAL.GetBodyList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition)
{
MsOpTruckBulkPc head = null;
if (handle == "edit")
{
head = MsOpTruckBulkPcDAL.GetData(condition);
}
if (head == null)
{
head = new MsOpTruckBulkPc();
head.OP = Convert.ToString(Session["SHOWNAME"]);
head.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
head.CTNNUM = 0;
//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)
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var isPost = true;
var errorstr = "";
var iscreatecustno = false;
//分公司代码
if (headData.CORPID == "" || headData.CORPID == null)
{
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
}
//分公司代码
if (headData.BSNO == "" || headData.BSNO == null)
{
headData.BSNO = "toptruck" + Guid.NewGuid().ToString().Replace("-","");
}
#region 委托编号规则
var isuse = false;
var transstr = "陆运普货派车";
if (headData.TRANSTYPE == "集装箱") transstr = "陆运集运派车单";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='"+ transstr + "'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
if (headData.CUSTNO == "")
{
if (isuse)
{
if (billnoset.BILLTYPE != "")
{
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
iscreatecustno = true;
}
}
}
else {
if (!isuse) {
var ct = MsOpTruckBulkPcDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
if (ct != 0)
{
isPost = false;
errorstr = "委托编号";
}
}
}
#endregion
//
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
{
//根据客户、开船日计算账期
//var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "陆运散货", headData.ETD, headData.SALE);
//headData.STLNAME = _dmb.STLNAME;
//headData.STLDATE = _dmb.STLDATE;
//if (_dmb.STLNAME == "")
//{
// headData.STLNAME = "现结买单";
// headData.STLDATE = headData.ETD;
//}
}
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
//
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
//
headData.BSSTATUS = false;//业务状态
headData.FEESTATUS = false;//费用状态
headData.ISVOU = false;//是否生成凭证
headData.VOUNO="";//凭证号
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
headData.CREATETIME = DateTime.Parse(rq).ToString("yyyy-MM-dd HH:mm:ss");//创建时间
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
headData.TRANSSTATUS = "新建";
headData.ISFEE = "0";
}
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 (headData.CTNNUM == null) { headData.CTNNUM = 0; }
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
// result = MsOpTruckBulkDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
//--result = MsOpOtherDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + 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) };
}
}
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<MsOpTruckBulkPc>(data);
var isfee = MsOpTruckBulkPcDAL.GetFeeCount(head.BSNO);
if (isfee)
{
var jsonRespose = new JsonResponse { Success = false, Message ="此票业务存在费用,请先删除费用才能删除此票业务!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else {
var BSNO = head.BSNO;
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
if (result.Success == true) { MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
if (result.Success == true)
{
var bodylist = MsOpTruckBulkPcDAL.GetBodyList("d.BSNO='"+head.BSNO+"'");
if (bodylist != null) {
foreach (var enumValue in bodylist)
{
MsOpTruckBulkPcDAL.DeletetruckBulkDetail(enumValue);
MsOpTruckBulkPcDAL.p_update_status(enumValue.LINKBSNO);
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
//
public ContentResult DeleteList(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 headData = JsonConvert.Deserialize<List<MsOpTruckBulkPc>>(data);
var errstr = "";
if (headData != null)
{
foreach (var enumValue in headData)
{
var isfee = MsOpTruckBulkDAL.GetFeeCount(enumValue.BSNO);
if (isfee)
{
if (errstr == "")
errstr = enumValue.CUSTNO;
else
errstr = errstr + "," + enumValue.CUSTNO;
}
else
{
var BSNO = enumValue.BSNO;
var modb = new ModelObjectDB();
DBResult result = modb.Delete(enumValue);
if (result.Success == true) { MsSysBillNoSetDAL.DeleteBsNo(enumValue.CUSTNO); }
if (result.Success == true)
{
var bodylist = MsOpTruckBulkPcDAL.GetBodyList("d.BSNO='" + enumValue.BSNO + "'");
if (bodylist != null)
{
foreach (var enumValueBody in bodylist)
{
MsOpTruckBulkPcDAL.DeletetruckBulkDetail(enumValueBody);
MsOpTruckBulkPcDAL.p_update_status(enumValueBody.LINKBSNO);
}
}
}
}
}
}
if (errstr == "") errstr = "删除成功!";
else errstr = errstr + "存在费用,请先删除费用才能删除此票业务!";
var jsonRespose = new JsonResponse { Success = true, Message = errstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AddBill(string opstatus, string data,string body)
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var bodyList = JsonConvert.Deserialize<List<MsOpTruckBulk>>(body);
var isPost = true;
var errorstr = "";
var iscreatecustno = false;
//分公司代码
if (headData.CORPID == "" || headData.CORPID == null)
{
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
}
//分公司代码
if (headData.BSNO == "" || headData.BSNO == null)
{
headData.BSNO = "toptruck" + Guid.NewGuid().ToString().Replace("-", "");
}
#region 委托编号规则
var isuse = false;
var transstr = "陆运普货派车";
if (headData.TRANSTYPE == "集装箱") transstr = "陆运集运派车单";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='"+ transstr + "'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
if (headData.CUSTNO == "")
{
if (isuse)
{
if (billnoset.BILLTYPE != "")
{
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
iscreatecustno = true;
}
}
}
else
{
if (!isuse)
{
var ct = MsOpTruckBulkPcDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
if (ct != 0)
{
isPost = false;
errorstr = "委托编号";
}
}
}
#endregion
//
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
{
//根据客户、开船日计算账期
//var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "陆运散货", headData.ETD, headData.SALE);
//headData.STLNAME = _dmb.STLNAME;
//headData.STLDATE = _dmb.STLDATE;
//if (_dmb.STLNAME == "")
//{
// headData.STLNAME = "现结买单";
// headData.STLDATE = headData.ETD;
//}
}
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
//
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
//
headData.BSSTATUS = false;//业务状态
headData.FEESTATUS = false;//费用状态
headData.ISVOU = false;//是否生成凭证
headData.VOUNO = "";//凭证号
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
headData.CREATETIME = DateTime.Parse(rq).ToString("yyyy-MM-dd HH:mm:ss");//创建时间
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
headData.TRANSSTATUS = "新建";
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
//
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = MsOpTruckBulkPcDAL.AddBill(headData, bodyList, Convert.ToString(Session["USERID"]));
if (result.Success == true) {
if (bodyList != null)
{
foreach (var bulk in bodyList)
{
MsOpTruckBulkPcDAL.p_update_status(bulk.BSNO);
}
}
headData = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + BSNO + "'");
if (headData.TRANSTYPE=="普运") {
MsOpTruckBulkPcDAL.SetFreight(headData, Convert.ToString(Session["USERID"]));
} else MsOpTruckBulkPcDAL.SetCtnFreight(headData, Convert.ToString(Session["USERID"]));
MsOpTruckBulkPcDAL.p_update_pc(headData.BSNO);
}
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + 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) };
}
}
public ContentResult AddBillAuto(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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var OpTruckBulk = JsonConvert.Deserialize<MsOpTruckBulk>(data);
var isPost = true;
var errorstr = "";
var iscreatecustno = false;
var headData = new MsOpTruckBulkPc();
headData.OP = Convert.ToString(Session["SHOWNAME"]);
headData.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
headData.ETD = DateTime.Now.ToString("yyyy-MM-dd");
headData.CUSTOMERNAME = OpTruckBulk.CUSTOMERNAME;
headData.CUSTTEL = OpTruckBulk.CUSTTEL;
headData.CUSTATTN = OpTruckBulk.CUSTATTN;
headData.CONSIGNEENAME = OpTruckBulk.CONSIGNEENAME;
headData.CONSIGNEEATTN= OpTruckBulk.CONSIGNEEATTN;
headData.CONSIGNEEADDR = OpTruckBulk.CONSIGNEEADDR;
headData.CONSIGNEETEL = OpTruckBulk.CONSIGNEETEL;
headData.PORTLOAD = OpTruckBulk.PORTLOAD;
headData.PORTDISCHARGE = OpTruckBulk.PORTDISCHARGE;
headData.DDOP = Convert.ToString(Session["SHOWNAME"]);
headData.ACCDATE = DateTime.Now.ToString("yyyy-MM");
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.TRANSSTATUS = "新建";
headData.TRANSTYPE = OpTruckBulk.TRANSTYPE;
headData.MBLNO = OpTruckBulk.MBLNO;
headData.YARD = OpTruckBulk.YARD;
headData.CLOSINGDATE = OpTruckBulk.CLOSINGDATE;
headData.TRADETYPE = OpTruckBulk.TRADETYPE;
headData.SALE = OpTruckBulk.SALE;
headData.GOODSNAME = OpTruckBulk.GOODSNAME;
headData.ETA = OpTruckBulk.ETA;
//分公司代码
if (headData.CORPID == "" || headData.CORPID == null)
{
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
}
//分公司代码
if (headData.BSNO == "" || headData.BSNO == null)
{
headData.BSNO = "toptruck" + Guid.NewGuid().ToString().Replace("-", "");
}
#region 委托编号规则
var isuse = false;
var transstr = "陆运普货派车";
if (headData.TRANSTYPE == "集装箱") transstr = "陆运集运派车单";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='"+ transstr + "'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
if (headData.CUSTNO == "")
{
if (isuse)
{
if (billnoset.BILLTYPE != "")
{
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
iscreatecustno = true;
}
}
}
else
{
if (!isuse)
{
var ct = MsOpTruckBulkPcDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
if (ct != 0)
{
isPost = false;
errorstr = "委托编号";
}
}
}
#endregion
//
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
{
//根据客户、开船日计算账期
//var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "陆运散货", headData.ETD, headData.SALE);
//headData.STLNAME = _dmb.STLNAME;
//headData.STLDATE = _dmb.STLDATE;
//if (_dmb.STLNAME == "")
//{
// headData.STLNAME = "现结买单";
// headData.STLDATE = headData.ETD;
//}
}
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
//
headData.DbOperationType = DbOperationType.DbotIns;
//
headData.BSSTATUS = false;//业务状态
headData.FEESTATUS = false;//费用状态
headData.ISVOU = false;//是否生成凭证
headData.VOUNO = "";//凭证号
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
headData.CREATETIME = DateTime.Parse(rq).ToString("yyyy-MM-dd HH:mm:ss");//创建时间
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
var bodyList = new List<MsOpTruckBulk>();
bodyList.Add(OpTruckBulk);
var BSNOSTR = "";
isPost = false;
if (bodyList != null)
{
errorstr = "没有需要派车的业务!";
foreach (var bulk in bodyList)
{
if (BSNOSTR == "")
BSNOSTR = BSNOSTR + " BSNO='" + bulk.BSNO + "'";
else
BSNOSTR = BSNOSTR + " OR BSNO='" + bulk.BSNO + "'";
}
if (BSNOSTR == "") BSNOSTR = "1=2";
var detaillist = MsOpTruckBulkDAL.GetBodyList(BSNOSTR);
if (detaillist != null)
{
foreach (var enumValue in detaillist)
{
var pkgs = enumValue.PKGS - enumValue.PCPKGS;
if (pkgs < 0) pkgs = 0;
var kgs = enumValue.KGS - enumValue.PCKGS;
if (kgs < 0) kgs = 0;
var cbm = enumValue.CBM - enumValue.PCCBM;
if (cbm < 0) cbm = 0;
var trucknum = enumValue.TRUCKNUM - enumValue.PCTRUCKNUM;
if (trucknum < 0) trucknum = 0;
var ctnnum = 0;
ctnnum = enumValue.CTNNUM - enumValue.PCCTNNUM;
if (ctnnum < 0) ctnnum = 0;
if (((headData.TRANSTYPE == "普运") && (pkgs != 0 || kgs != 0 || cbm != 0 || trucknum != 0)) || (headData.TRANSTYPE == "集装箱" && ctnnum != 0))
{
isPost = true;
}
}
}
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = MsOpTruckBulkPcDAL.AddBill(headData, bodyList, Convert.ToString(Session["USERID"]));
if (headData.TRANSTYPE == "普运")
{
MsOpTruckBulkPcDAL.SetFreight(headData, Convert.ToString(Session["USERID"]));
}
else MsOpTruckBulkPcDAL.SetCtnFreight(headData, Convert.ToString(Session["USERID"]));
MsOpTruckBulkPcDAL.p_update_status(OpTruckBulk.BSNO);
MsOpTruckBulkPcDAL.p_update_pc(headData.BSNO);
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + 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) };
}
}
public ContentResult UpTransStatus(string data,string transstatus,string statusdate="",string arriverremark="")
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var OpTruckBulk = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var bodyList = new List<MsOpTruckBulkPc>();
bodyList.Add(OpTruckBulk);
var result = MsOpTruckBulkPcDAL.UpTransStatus(bodyList, transstatus, statusdate, arriverremark);
if (transstatus=="已回单"&& result.Success==true) {
MsOpTruckBulkPcDAL.UphuidanStatus(OpTruckBulk.BSNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + OpTruckBulk.BSNO+ "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UpTransStatusList(string data, string transstatus, string statusdate = "", string arriverremark = "")
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var bodyList = JsonConvert.Deserialize < List<MsOpTruckBulkPc>>(data);
var result = MsOpTruckBulkPcDAL.UpTransStatus(bodyList, transstatus, statusdate, arriverremark);
if (transstatus == "已回单" && result.Success == true)
{
if (bodyList != null)
{
foreach (var enumValue in bodyList)
{
MsOpTruckBulkPcDAL.UphuidanStatus(enumValue.BSNO);
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AddDetail(string opstatus, string data, string body)
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var bodyList = JsonConvert.Deserialize<List<MsOpTruckBulkDetail>>(body);
var isPost = true;
var errorstr = "";
var iscreatecustno = false;
//分公司代码
if (headData.CORPID == "" || headData.CORPID == null)
{
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
}
//分公司代码
if (headData.BSNO == "" || headData.BSNO == null)
{
headData.BSNO = "toptruck" + Guid.NewGuid().ToString().Replace("-", "");
}
#region 委托编号规则
var isuse = false;
var transstr = "陆运普货派车";
if (headData.TRANSTYPE == "集装箱") transstr = "陆运集运派车单";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='"+ transstr + "'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
if (headData.CUSTNO == "")
{
if (isuse)
{
if (billnoset.BILLTYPE != "")
{
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
iscreatecustno = true;
}
}
}
else
{
if (!isuse)
{
var ct = MsOpTruckBulkPcDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
if (ct != 0)
{
isPost = false;
errorstr = "委托编号";
}
}
}
#endregion
//
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
{
//根据客户、开船日计算账期
//var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "陆运散货", headData.ETD, headData.SALE);
//headData.STLNAME = _dmb.STLNAME;
//headData.STLDATE = _dmb.STLDATE;
//if (_dmb.STLNAME == "")
//{
// headData.STLNAME = "现结买单";
// headData.STLDATE = headData.ETD;
//}
}
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
//
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
//
headData.BSSTATUS = false;//业务状态
headData.FEESTATUS = false;//费用状态
headData.ISVOU = false;//是否生成凭证
headData.VOUNO = "";//凭证号
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
headData.CREATETIME = DateTime.Parse(rq).ToString("yyyy-MM-dd HH:mm:ss");//创建时间
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
headData.TRANSSTATUS = "新建";
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
//
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
}
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
result = MsOpTruckBulkPcDAL.AddDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
if (result.Success == true) {
MsOpTruckBulkPcDAL.p_update_status(bodyList[0].BSNO);
MsOpTruckBulkPcDAL.p_update_pc(headData.BSNO);
if (headData.TRANSTYPE == "普运")
{
headData = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + BSNO + "'");
MsOpTruckBulkPcDAL.SetFreight(headData, Convert.ToString(Session["USERID"]));
}
else {
headData = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + BSNO + "'");
MsOpTruckBulkPcDAL.SetCtnFreight(headData, Convert.ToString(Session["USERID"]));
}
}
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + 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) };
}
}
public ContentResult DeletetruckBulkPcDetail(string data)
{
var head = JsonConvert.Deserialize<MsOpTruckBulkPcDetail>(data);
DBResult result = MsOpTruckBulkPcDAL.DeletetruckBulkDetail(head);
MsOpTruckBulkPcDAL.p_update_status(head.LINKBSNO);
MsOpTruckBulkPcDAL.p_update_pc(head.BSNO);
var headData = MsOpTruckBulkPcDAL.GetData("op_truck_bulk_pc.BSNO='" + head.BSNO + "'");
if (headData.TRANSTYPE == "普运")
{
MsOpTruckBulkPcDAL.SetFreight(headData, Convert.ToString(Session["USERID"]));
} else MsOpTruckBulkPcDAL.SetCtnFreight(headData, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(
new { Success = true, Message = "删除成功!", data = headData });
return new ContentResult() { Content = json };
}
#region 审核、撤销审核
public ContentResult SubmitAudit(string opstatus, string data, string data2, string body)
{
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) };
}
//
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
AttributeManage attributeManager = new AttributeManage();
var headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var isPost = true;
var errorstr = "";
var iscreatecustno = false;
//分公司代码
if (headData.CORPID == "" || headData.CORPID == null)
{
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
}
//分公司代码
if (headData.BSNO == "" || headData.BSNO == null)
{
headData.BSNO = "toptruck" + Guid.NewGuid().ToString().Replace("-", "");
}
#region 委托编号规则
var isuse = false;
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运普货派车'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
if (headData.CUSTNO == "")
{
if (isuse)
{
if (billnoset.BILLTYPE != "")
{
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
iscreatecustno = true;
}
}
}
else
{
if (!isuse)
{
var ct = MsOpTruckBulkPcDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
if (ct != 0)
{
isPost = false;
errorstr = "委托编号";
}
}
}
#endregion
//
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
{
//根据客户、开船日计算账期
//var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "陆运散货", headData.ETD, headData.SALE);
//headData.STLNAME = _dmb.STLNAME;
//headData.STLDATE = _dmb.STLDATE;
//if (_dmb.STLNAME == "")
//{
// headData.STLNAME = "现结买单";
// headData.STLDATE = headData.ETD;
//}
}
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
//
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
//
headData.BSSTATUS = false;//业务状态
headData.FEESTATUS = false;//费用状态
headData.ISVOU = false;//是否生成凭证
headData.VOUNO = "";//凭证号
headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人
headData.CREATETIME = DateTime.Parse(rq).ToString("yyyy-MM-dd HH:mm:ss");//创建时间
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人
headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间
headData.TRANSSTATUS = "新建";
}
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 (headData.CTNNUM == null) { headData.CTNNUM = 0; }
if (headData.ETD == "") headData.ETD = null;
if (headData.ETA == "") headData.ETA = null;
if (isPost)
{
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var BSNO = headData.BSNO;
if (result.Success == true)
{
var headList = new List<MsOpTruckBulkPc>();
headList.Add(headData);
result = MsOpTruckBulkPcDAL.SubmitAudit(Convert.ToString(Session["USERID"]), headList);
if (result.Success == true&&headData.CONTRACTNO!=""&&headData.TEMPLATENAME!="" && headData.UNITPRICE == headData.ORUNITPRICE && headData.ORFREIGHT == headData.FREIGHT)
{
result = MsOpTruckBulkPcDAL.CreateFeeBl(headData, Convert.ToString(Session["USERID"]));
}
}
else
{
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + 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) };
}
}
public ContentResult SubmitAuditList(string data)
{
var headList = JsonConvert.Deserialize<List<MsOpTruckBulkPc>>(data);
var modb = new ModelObjectDB();
DBResult result = MsOpTruckBulkPcDAL.SubmitAudit(Convert.ToString(Session["USERID"]), headList);
if (result.Success == true)
{
if (headList != null)
{
foreach (var headData in headList)
{
if (headData.CONTRACTNO != "" && headData.TEMPLATENAME != "" && headData.UNITPRICE == headData.ORUNITPRICE && headData.FREIGHT == headData.ORFREIGHT)
result = MsOpTruckBulkPcDAL.CreateFeeBl(headData, Convert.ToString(Session["USERID"]));
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBack(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 headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var isfee = MsOpTruckBulkPcDAL.GetFeeCount(headData.BSNO, " CARGO_GID='" + headData.BSNO + "' and (SETTLEMENT<>0 or INVOICE<>0 and ORDERAMOUNT<>0 and ORDERINVOICE<>0) ");
if (isfee)
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "此票生成费用已做申请或结算或开票,不能驳回!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var headList = new List<MsOpTruckBulkPc>();
headList.Add(headData);
var result = MsOpTruckBulkPcDAL.SubmitAuditBack(Convert.ToString(Session["USERID"]), headList);
if (result.Success == true)
{
result = MsOpTruckBulkPcDAL.DelCreateFeeBl(headData, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_PC.BSNO='" + headData.BSNO + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBackList(string data)
{
var headList = JsonConvert.Deserialize<List<MsOpTruckBulkPc>>(data);
var modb = new ModelObjectDB();
DBResult result = MsOpTruckBulkPcDAL.SubmitAuditBack(Convert.ToString(Session["USERID"]), headList);
if (result.Success == true)
{
if (headList != null)
{
foreach (var headData in headList)
{
var isfee = MsOpTruckBulkPcDAL.GetFeeCount(headData.BSNO, " CARGO_GID='" + headData.BSNO + "' and (SETTLEMENT<>0 or INVOICE<>0 and ORDERAMOUNT<>0 and ORDERINVOICE<>0) ");
if (!isfee)
result = MsOpTruckBulkPcDAL.DelCreateFeeBl(headData, Convert.ToString(Session["USERID"]));
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Audit(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 headData = JsonConvert.Deserialize<MsOpTruckBulkPc>(data);
var headList = new List<MsOpTruckBulkPc>();
headList.Add(headData);
var result = MsOpTruckBulkPcDAL.AuditList(headList, Convert.ToString(Session["USERID"]));
if (result.Success)
{
List<MsOpTruckBulkPc> AuditList = result.Data as List<MsOpTruckBulkPc>;
if (AuditList != null)
{
foreach (var enumValue in AuditList)
{
MsOpTruckBulkPcDAL.CreateFeeBl(enumValue, Convert.ToString(Session["USERID"]));
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + headData.BSNO + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditList(string data)
{
var headList = JsonConvert.Deserialize<List<MsOpTruckBulkPc>>(data);
var modb = new ModelObjectDB();
DBResult result = MsOpTruckBulkPcDAL.AuditList(headList, Convert.ToString(Session["USERID"]));
if (result.Success)
{
List<MsOpTruckBulkPc> AuditList = result.Data as List<MsOpTruckBulkPc>;
if (AuditList != null)
{
foreach (var enumValue in AuditList)
{
MsOpTruckBulkPcDAL.CreateFeeBl(enumValue, Convert.ToString(Session["USERID"]));
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBack(string data, string reason)
{
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<MsOpTruckBulkPc>(data);
var isfee = MsOpTruckBulkPcDAL.GetFeeCount(headData.BSNO, " CARGO_GID='" + headData.BSNO + "' and (SETTLEMENT<>0 or INVOICE<>0 and ORDERAMOUNT<>0 and ORDERINVOICE<>0) ");
if (isfee)
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "此票生成费用已做申请或结算或开票,不能驳回!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var headList = new List<MsOpTruckBulkPc>();
headList.Add(headData);
var result = MsOpTruckBulkPcDAL.AuditBackList(headList, Convert.ToString(Session["USERID"]), reason);
if (result.Success) {
MsOpTruckBulkPcDAL.DelCreateFeeBl(headData, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpTruckBulkPcDAL.GetData(" op_truck_bulk_pc.BSNO='" + headData.BSNO + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBackList(string data, string reason)
{
var headList = JsonConvert.Deserialize<List<MsOpTruckBulkPc>>(data);
var modb = new ModelObjectDB();
DBResult result = MsOpTruckBulkPcDAL.AuditBackList(headList, Convert.ToString(Session["USERID"]), reason);
if (result.Success)
{
if (headList != null)
{
foreach (var enumValue in headList)
{
MsOpTruckBulkPcDAL.DelCreateFeeBl(enumValue, Convert.ToString(Session["USERID"]));
}
}
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}