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.
954 lines
38 KiB
C#
954 lines
38 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Models.MsOpLetter;
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
using DSWeb.MvcShipping.Models.MsOpAire;
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.Dispatch.Helper;
|
|
using System.Collections.Generic;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
|
|
[JsonRequestBehavior]
|
|
public class MsOpLetterController : Controller
|
|
{
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult PcLSEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult YardEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult TruckEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult TruckView()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult TruckLSEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult TruckFeeIndex()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult SurEdit()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult ChangeEdit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ContentResult GetListData(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpLetterDAL.GetDataList(condition);
|
|
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 GetData(string condition)
|
|
{
|
|
MsOpLetter head = null;
|
|
var list = MsOpLetterDAL.GetDataList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetYardData(string condition)
|
|
{
|
|
MsOpLetterYard head = null;
|
|
var list = MsOpLetterDAL.GetYardList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetTruckList(string condition)
|
|
{
|
|
var dataList = MsOpLetterDAL.GetTruckList(condition);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetTruckData(string condition)
|
|
{
|
|
MsOpLetterTruck head = null;
|
|
var list = MsOpLetterDAL.GetTruckList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetSurData(string condition)
|
|
{
|
|
MsOpLetterSur head = null;
|
|
var list = MsOpLetterDAL.GetSurList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetChangeData(string condition)
|
|
{
|
|
MsOpLetterChange head = null;
|
|
var list = MsOpLetterDAL.GetChangeList(condition);
|
|
if (list.Count > 0)
|
|
head = list[0];
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult SaveYard(string opstatus, string data, string body)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterYard>(body);
|
|
var le_id = "";
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "入货通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
if (bodyData.ETD == "") bodyData.ETD = null;
|
|
if (bodyData.DRQ == "") bodyData.DRQ = null;
|
|
if (bodyData.CLOSEDOCDATE == "") bodyData.CLOSEDOCDATE = null;
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
if (bodyData.CLOSEVGMDATE == "") bodyData.CLOSEVGMDATE = null;
|
|
if (bodyData.TiXiangTime == "") bodyData.TiXiangTime = null;
|
|
if (bodyData.RuHuoTime == "") bodyData.RuHuoTime = null;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
result = modb.Save(bodyData);
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetData("LE_ID='" + le_id + "'")
|
|
};
|
|
MsOpStatusNewDAL mdal = new MsOpStatusNewDAL();
|
|
string uname = CookieConfig.GetCookie_UserName(Request);
|
|
mdal.UpdateMainStatus(BSNO, 1, uname);
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult SaveTruck(string opstatus, string data, string body)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
|
|
var le_id = "";
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "派车通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
bodyData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
|
|
if (bodyData.TRUCKFEE == "") bodyData.TRUCKFEE = null;
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
result = modb.Save(bodyData);
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult GetLetterCtnList(string condition)
|
|
{
|
|
var dataList = MsOpLetterDAL.GetLetterCtnList(condition);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult SaveBLTruck(string opstatus, string data, string body, string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = "";
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "派车通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
bodyData.INPUTBY = Convert.ToString(Session["USERID"]);
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
bodyData.TRUCK = headData.HEAD_TO;
|
|
bodyData.BSNO = headData.BSNO;
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
|
|
|
|
var IsSave = MsOpLetterDAL.IsSaveTruckCtn(bodyData, bodyctnData);
|
|
if (IsSave.Success == false)
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = IsSave.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctnData);
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string sql_update = "UPDATE [op_task] SET [TASKTITLE]='箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ' ";
|
|
if (bodyData.FACTRYTIME != "") sql_update = sql_update + ",TASKBEGINDATE='" + bodyData.FACTRYTIME + "'";
|
|
sql_update = sql_update + " WHERE TASKNO='" + le_id + "'";
|
|
bool blZ = T_ALL_DA.GetExecuteSqlCommand(sql_update);
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
public ContentResult SubmitPcBLTruck(string opstatus, string data, string body, string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = "";
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "派车通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
bodyData.INPUTBY = Convert.ToString(Session["USERID"]);
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
bodyData.TRUCK = headData.HEAD_TO;
|
|
bodyData.BSNO = headData.BSNO;
|
|
// bodyData.TRUCKSTATUS = "提交派车";
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
|
|
var IsSave = MsOpLetterDAL.IsSaveTruckCtn(bodyData, bodyctnData);
|
|
if (IsSave.Success == false)
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = IsSave.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctnData);
|
|
if (result.Success)
|
|
{
|
|
|
|
result = MsOpLetterDAL.CreateTruckTask(bodyData, Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
//T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
//var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from op_task where TASKNO='" + le_id + "'");
|
|
//if (BLCOUNT == "0")
|
|
//{
|
|
// string sql_pre = "INSERT INTO [op_task] (GID,[TASKNO] ,[PTASKNO],[TASKTYPE],[TASKSOURCE],[TASKSTATUS],[TASKTITLE] "
|
|
// + ",[CREATEUSER] ,[CREATETIME] ,[TASKBEGINDATE] ,[COMPLETETYPE] ,[COMPLETETIME] ,[KPI],[MBLNO],[FILENO],[MAILNO],[FILEPATH],[ISPUBLIC],[OP],[BSNO],ISCOMPLETE)"
|
|
// + " SELECT NEWID(),'" + le_id + "' as [任务编号],null as [上级任务号], '待派车' as [任务类型], '操作' as [任务来源], '未开始' as [任务状态], '箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ' as [任务说明],"
|
|
// + "'" + Convert.ToString(Session["SHOWNAME"]) + "' as [发起人],GETDATE() as [录入日期],'" + bodyData.FACTRYTIME + "' as[任务开始时间], '手动' as [完成方式],null as [完成时间] ,null as [KPI值] , '" + bodyData.MBLNO + "' as [提单号], "
|
|
// + " null as [文件编号], '' as [邮件编号], '' as [电子档案路径], 1 as 是否公共,'' as 客服员,'" + bodyData.BSNO + "' as 编号,0";
|
|
// bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
//}
|
|
//else {
|
|
// string sql_pre = "update [op_task] set [TASKTITLE]='箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ', "
|
|
// + "TASKBEGINDATE='" + bodyData.FACTRYTIME + "',[TASKTYPE]='待派车(重新提交)' where TASKNO='" + le_id + "'";
|
|
// bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult CancelSubmitPcBLTruck(string opstatus, string data, string body, string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = "";
|
|
var oplettertruck = MsOpLetterDAL.GetTruckData("t.le_id='" + bodyData.LE_ID + "'");
|
|
if (oplettertruck.TRUCKSTATUS != "提交派车") {
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message ="当前状态不允许撤销提交,请调度驳回派车单!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
}
|
|
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
oplettertruck.DbOperationType = DbOperationType.DbotUpd;
|
|
oplettertruck.ModelUIStatus = "E";
|
|
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
oplettertruck.TRUCKSTATUS = "待派车";
|
|
if (oplettertruck.CLOSINGDATE == "") oplettertruck.CLOSINGDATE = null;
|
|
|
|
if (oplettertruck.OTHERFEE == "" || oplettertruck.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(oplettertruck);
|
|
if (result.Success)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
string sql_pre = "update [op_task] set [TASKTITLE]='箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ', "
|
|
+ "TASKBEGINDATE='" + bodyData.FACTRYTIME + "',[TASKTYPE]='待派车(重新提交)' where TASKNO='" + le_id + "'";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
}
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult SubmitFenPcBLTruck(string data, string body, string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var bodyctn1 = new List<MsOpLetterTruckCtn>();
|
|
var ctnstr = "";
|
|
decimal kgs = 0;
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
if (bodyctnData != null)
|
|
{
|
|
foreach (var enumValue in bodyctnData)
|
|
{
|
|
MsOpLetterTruckCtn Data = new MsOpLetterTruckCtn();
|
|
Data.CTN_ID = enumValue.CTN_ID;
|
|
Data.CTNALL = enumValue.CTNALL;
|
|
Data.LE_ID = headData.LE_ID;
|
|
Data.CTNNUM = enumValue.CTNNUM-enumValue.FENCTNNUM;
|
|
Data.KGS = enumValue.KGS - enumValue.FENKGS;
|
|
if (ctnstr == "") ctnstr = Data.CTNALL + "*" + Data.CTNNUM;
|
|
else ctnstr = ctnstr+" "+ Data.CTNALL + "*" + Data.CTNNUM;
|
|
kgs = kgs + Data.KGS;
|
|
bodyctn1.Add(Data);
|
|
|
|
}
|
|
}
|
|
bodyData.CTNS = ctnstr;
|
|
bodyData.KGS = kgs.ToString();
|
|
var ble_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctn1);
|
|
string sql_update = "UPDATE [op_task] SET [TASKTITLE]='箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ' ";
|
|
sql_update = sql_update + " WHERE TASKNO='" + ble_id + "'";
|
|
bool blZ = T_ALL_DA.GetExecuteSqlCommand(sql_update);
|
|
|
|
|
|
|
|
var le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "派车通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
bodyData.INPUTBY = Convert.ToString(Session["USERID"]);
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
var bodyctn2 = new List<MsOpLetterTruckCtn>();
|
|
ctnstr = "";
|
|
kgs = 0;
|
|
if (bodyctnData != null)
|
|
{
|
|
foreach (var enumValue in bodyctnData)
|
|
{
|
|
MsOpLetterTruckCtn Data = new MsOpLetterTruckCtn();
|
|
Data.CTN_ID = enumValue.CTN_ID;
|
|
Data.CTNALL = enumValue.CTNALL;
|
|
Data.LE_ID ="*";
|
|
Data.CTNNUM = enumValue.FENCTNNUM;
|
|
Data.KGS =enumValue.FENKGS;
|
|
if (ctnstr == "") ctnstr = Data.CTNALL + "*" + Data.CTNNUM;
|
|
else ctnstr = ctnstr + " " + Data.CTNALL + "*" + Data.CTNNUM;
|
|
kgs = kgs + Data.KGS;
|
|
bodyctn2.Add(Data);
|
|
|
|
}
|
|
}
|
|
bodyData.CTNS = ctnstr;
|
|
bodyData.KGS = kgs.ToString();
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
|
|
modb = new ModelObjectDB();
|
|
result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctn2);
|
|
if (result.Success)
|
|
{
|
|
|
|
string sql_pre = "INSERT INTO [op_task] (GID,[TASKNO] ,[PTASKNO],[TASKTYPE],[TASKSOURCE],[TASKSTATUS],[TASKTITLE] "
|
|
+ ",[CREATEUSER] ,[CREATETIME] ,[TASKBEGINDATE] ,[COMPLETETYPE] ,[COMPLETETIME] ,[KPI],[MBLNO],[FILENO],[MAILNO],[FILEPATH],[ISPUBLIC],[OP],[BSNO],ISCOMPLETE)"
|
|
+ " SELECT NEWID(),'" + le_id + "' as [任务编号],null as [上级任务号], '待派车' as [任务类型], '操作' as [任务来源], '未开始' as [任务状态], '箱型箱量:" + bodyData.CTNS + "|重量:" + Convert.ToString(bodyData.KGS) + "|工厂:" + bodyData.FACTRYNAME + " ' as [任务说明],"
|
|
+ "'" + Convert.ToString(Session["SHOWNAME"]) + "' as [发起人],GETDATE() as [录入日期], '"+ bodyData.FACTRYTIME + "' as[任务开始时间], '手动' as [完成方式],null as [完成时间] ,null as [KPI值] , '" + bodyData.MBLNO + "' as [提单号], "
|
|
+ " null as [文件编号], '' as [邮件编号], '' as [电子档案路径], 1 as 是否公共,'' as 客服员,'" + bodyData.BSNO + "' as 编号,0";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + ble_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public ContentResult PcBLTruck(string data, string body,string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = bodyData.LE_ID;
|
|
|
|
|
|
//DBResult result = null;
|
|
|
|
//if (bodyData.TRUCKFEE != "0")
|
|
// result= MsOpLetterDAL.CreateFeeBl(bodyData, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
var userid = Convert.ToString(Session["USERID"]);
|
|
var username = Convert.ToString(Session["SHOWNAME"]);
|
|
if (userid == "") userid = CookieConfig.GetCookie_UserId(Request);
|
|
if (username == "") userid = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
|
|
bodyData.TRUCK = headData.HEAD_TO;
|
|
bodyData.BSNO = headData.BSNO;
|
|
bodyData.TRUCKSTATUS = "派车中";
|
|
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
bodyData.INPUTBY = userid;
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctnData);
|
|
if (result.Success)
|
|
{
|
|
if (bodyData.TRUCKFEE != "0")
|
|
result = MsOpLetterDAL.CreateFeeBl(bodyData, userid, username);
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string sql_pre = " update op_task set [TASKDESCRIP]='车队:" + bodyData.TRUCK + "',OP='" + username + "',ISPUBLIC=0,TASKTYPE='派车中',ISCOMPLETE=1,COMPLETETIME=GETDATE() where TASKNO='" + le_id + "'";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
string sql_pre2 = " update op_letter_truck set TRUCKSTATUS='派车中' where LE_ID='" + le_id + "'";
|
|
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(sql_pre2);
|
|
|
|
#region 派车消息
|
|
string msg = "";
|
|
bool rtn = DispatchHelper.DispacthMessage(le_id, out msg);
|
|
if (!rtn)
|
|
{
|
|
return new ContentResult() { Content = JsonConvert.Serialize(new { Success = false, Message = msg }) };
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "",
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
public ContentResult CancelPcBLTruck(string data, string body, string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = bodyData.LE_ID;
|
|
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
|
|
bodyData.TRUCK = headData.HEAD_TO;
|
|
bodyData.BSNO = headData.BSNO;
|
|
bodyData.TRUCKSTATUS = "提交派车";
|
|
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
bodyData.INPUTBY = Convert.ToString(Session["USERID"]);
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctnData);
|
|
if (result.Success)
|
|
{
|
|
//if (bodyData.TRUCKFEE == "1")
|
|
result = MsOpLetterDAL.DeleteFeeBl(bodyData);
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string sql_pre = " update op_task set [TASKDESCRIP]='车队:" + bodyData.TRUCK + "',OP='',ISPUBLIC=1,TASKTYPE='待派车',ISCOMPLETE=0,COMPLETETIME=null where TASKNO='" + le_id + "'";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "",
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult DeleteLetterCtn(string data)
|
|
{
|
|
var head = JsonConvert.Deserialize<MsOpLetterTruckCtn>(data);
|
|
DBResult result = MsOpLetterDAL.DeleteTruckCtn(head, CookieConfig.GetCookie_UserId(Request));
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult FdBLTruck(string data, string body,string ctn)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterTruck>(body);
|
|
var bodyctnData = JsonConvert.Deserialize<List<MsOpLetterTruckCtn>>(ctn);
|
|
var le_id = bodyData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
var userid = Convert.ToString(Session["USERID"]);
|
|
var username = Convert.ToString(Session["SHOWNAME"]);
|
|
if (userid == "") userid = CookieConfig.GetCookie_UserId(Request);
|
|
if (username == "") userid = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
bodyData.TRUCK = headData.HEAD_TO;
|
|
bodyData.BSNO = headData.BSNO;
|
|
bodyData.TRUCKSTATUS = "已发单";
|
|
if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null;
|
|
bodyData.INPUTBY = userid;
|
|
if (bodyData.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0";
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
result = modb.Save(bodyData);
|
|
MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctnData);
|
|
if (result.Success)
|
|
{
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string sql_pre = " update op_task set OP='" + username + "',ISPUBLIC=0,TASKTYPE='派车已发单' where TASKNO='" + le_id + "'";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sql_pre);
|
|
string msg = "";
|
|
bool rtn = DispatchHelper.SendDispacthMessage(le_id, out msg);
|
|
if (!rtn)
|
|
{
|
|
return new ContentResult() { Content = JsonConvert.Serialize(new { Success = false, Message = msg }) };
|
|
}
|
|
}
|
|
}
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = true,
|
|
Message = "",
|
|
Data = MsOpLetterDAL.GetTruckData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult SaveSur(string opstatus, string data, string body)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterSur>(body);
|
|
var le_id = "";
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "电放保函";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
result = modb.Save(bodyData);
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult SaveChange(string opstatus, string data, string body)
|
|
{
|
|
var headData = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
var bodyData = JsonConvert.Deserialize<MsOpLetterChange>(body);
|
|
var le_id = "";
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
le_id = Guid.NewGuid().ToString();
|
|
headData.LE_ID = le_id;
|
|
bodyData.LE_ID = le_id;
|
|
headData.LETTERNAME = "更改通知";
|
|
headData.INPUTTIME = DateTime.Now.ToShortDateString();
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
bodyData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
bodyData.DbOperationType = DbOperationType.DbotUpd;
|
|
bodyData.ModelUIStatus = "E";
|
|
|
|
}
|
|
else
|
|
{
|
|
le_id = headData.LE_ID;
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
bodyData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
headData.UpdateTime = DateTime.Now.ToString();
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
var BSNO = headData.BSNO;
|
|
if (result.Success == true)
|
|
{
|
|
|
|
result = modb.Save(bodyData);
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpLetterDAL.GetData("LE_ID='" + le_id + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult Delete(string data)
|
|
{
|
|
var head = JsonConvert.Deserialize<MsOpLetter>(data);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Delete(head);
|
|
if (result.Success == true) { MsOpLetterDAL.DeleteDetail(head); }
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|