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.Areas.TruckMng.Models.MsWlBs; using DSWeb.MvcShipping.Models.MsOpSeae; using DSWeb.MvcShipping.Models.MsOpAire; using DSWeb.Areas.TruckMng.DAL.MsRptPcHeadEdit; using DSWeb.MvcShipping.DAL.MsSysBillNoSet; using DSWeb.EntityDA; using DSWeb.Areas.Dispatch.Helper; using System.Collections.Generic; using DSWeb.MvcShipping.DAL.MsSysParamSet; using System.Text; using System.Data; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.RptMng.Comm; using DSWeb.Areas.CommMng.Models; using DSWeb.MvcShipping.DAL.MsOpSeaeDAL; 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 ActionResult HistryYardIndex() { 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 BsYardListData(int start, int limit, string condition, string sort) { var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append("Y.LE_ID,Y.MBLNO,Y.PORTDISCHARGE,Y.VESSELVOYNO,Y.ETD,Y.PKC,Y.CNTR,Y.DESCRIPTION,Y.YARD,Y.Address,Y.Tel,Y.YARD2,Y.Address2,Y.Tel2,Y.TiXiangTime,Y.RuHuoTime,Y.FreeCtnTime,"); strSql.Append("Y.DRQ,Y.CLOSEDOCDATE,Y.ExportCustoms,Y.CustomsCode,Y.DeclarationCode,Y.REMARK,Y.CLOSINGDATE,Y.DOC,Y.CHIEF,Y.CHIEF2,Y.DOCTEL,Y.DOCFAX,Y.DOCEMAIL,Y.CLOSEVGMDATE"); strSql.Append(",B.BSNO,B.CUSTOMERNAME, B.CUSTNO, B.CNTRTOTAL, B.HBLNO,B.VESSEL, B.VOYNO, B.SALE, B.OP, B.DOC"); strSql.Append(",case B.FEESTATUS when 1 then '已锁定' else '未锁定' end as FEESTATUSREF"); strSql.Append(",B.PORTDISCHARGE,B.ACCDATE,B.CARRIER, B.BSSOURCE"); strSql.Append(" from op_letter_yard Y "); strSql.Append(" left join op_letter L on (L.LE_ID=Y.LE_ID) "); strSql.Append(" left join op_seae B on (B.BSNO=L.BSNO) "); if (!string.IsNullOrEmpty(condition)) { strSql.Append(" Where " + condition); } var sortstring = DatasetSort.Getsortstring(sort); if (!string.IsNullOrEmpty(sortstring)) { strSql.Append(" order by " + sortstring); } else { strSql.Append(" order by B.ETD DESC"); } var dbparams = new List(); var paramps_sSQL = new CustomDbParamter(); paramps_sSQL.ParameterName = "@sSQL"; paramps_sSQL.DbType = DbType.String; paramps_sSQL.Direction = ParameterDirection.Input; paramps_sSQL.Value = strSql.ToString(); dbparams.Add(paramps_sSQL); var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set"); var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true); return new ContentResult() { Content = json }; } public ContentResult SaveYard(string opstatus, string data, string body) { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(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; } bodyData.LE_ID = le_id; 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 SendToTxxp(string bsno,string carrier) { var result = MsOpLetterDAL.SendToTxxp(bsno,Convert.ToString(Session["COMPANYID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SaveTruck(string opstatus, string data, string body) { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(ctn); var bodyctn1 = new List(); 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(); 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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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 == "") username = 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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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(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) { 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(data); var bodyData = JsonConvert.Deserialize(body); var bodyctnData = JsonConvert.Deserialize>(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 SaveLSTruck(string opstatus, string data, string body, string oplb) { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var le_id = ""; var BillNo = ""; if (opstatus == "add") { le_id = Guid.NewGuid().ToString(); headData.LE_ID = le_id; bodyData.RefBillNose = le_id; headData.LETTERNAME = "派车通知"; headData.INPUTTIME = DateTime.Now.ToShortDateString(); headData.INPUTTIME = DateTime.Now.ToShortDateString(); headData.DbOperationType = DbOperationType.DbotIns; bodyData.DbOperationType = DbOperationType.DbotIns; var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 bodyData.BillNo = BillNo; bodyData.DbOperationType = DbOperationType.DbotIns; bodyData.ModelUIStatus = "I"; bodyData.UserCode = CookieConfig.GetCookie_UserCode(Request); bodyData.UserName = CookieConfig.GetCookie_UserName(Request); bodyData.OrgCode = CookieConfig.GetCookie_OrgCode(Request); bodyData.OrgName = CookieConfig.GetCookie_OrgName(Request); bodyData.LrDate = DateTime.Now.ToString(); //bodyData.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); bodyData.gId = "PC_" + Guid.NewGuid().ToString("N").ToUpper(); bodyData.PGid = bodyData.gId; if (string.IsNullOrEmpty(bodyData.GOODSCOUNT)) bodyData.GOODSCOUNT = "0"; if (string.IsNullOrEmpty(bodyData.CBM)) bodyData.CBM = "0"; if (string.IsNullOrEmpty(bodyData.Ton)) bodyData.Ton = "0"; if (string.IsNullOrEmpty(bodyData.ContainerQty)) bodyData.ContainerQty = "1"; //bodyData.MblNo = } else if (opstatus == "edit") { le_id = headData.LE_ID; BillNo = bodyData.BillNo; headData.DbOperationType = DbOperationType.DbotUpd; headData.ModelUIStatus = "E"; bodyData.DbOperationType = DbOperationType.DbotUpd; bodyData.ModelUIStatus = "E"; } else { le_id = headData.LE_ID; BillNo = bodyData.BillNo; headData.DbOperationType = DbOperationType.DbotDel; bodyData.DbOperationType = DbOperationType.DbotDel; } headData.UpdateTime = DateTime.Now.ToString(); bodyData.F_CustomerName = headData.HEAD_TO; bodyData.RefBillNo = headData.BSNO; if (oplb == "海运出口" || oplb == "空运出口") { bodyData.DstArea = bodyData.CustName; bodyData.DetiNation = bodyData.FactoryAddr; } 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 = MsRptPcHeadEditDAL.GetWFSDData("BillNo='" + BillNo + "'") }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SaveLSCtnTruck(string data, string body, string oplb) { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var ctnList = MsOpSeaeDAL.GetBodyList("BSNO='" + headData.BSNO + "'"); var first = true; var le_id = ""; var BillNo = ""; DBResult result = null; foreach (var ctn in ctnList) { if (first) { headData.DbOperationType = DbOperationType.DbotUpd; headData.ModelUIStatus = "E"; bodyData.DbOperationType = DbOperationType.DbotUpd; bodyData.ModelUIStatus = "E"; bodyData.ContainerType = ctn.CTNALL; bodyData.ContainerNo = ctn.CNTRNO; bodyData.SealNo = ctn.SEALNO; bodyData.ContainerQty = "1"; bodyData.GOODSCOUNT = ctn.PKGS.ToString(); bodyData.Ton = ctn.KGS.ToString(); bodyData.CBM = ctn.CBM.ToString(); if (string.IsNullOrEmpty(bodyData.GOODSCOUNT)) bodyData.GOODSCOUNT = "0"; if (string.IsNullOrEmpty(bodyData.CBM)) bodyData.CBM = "0"; if (string.IsNullOrEmpty(bodyData.Ton)) bodyData.Ton = "0"; if (string.IsNullOrEmpty(bodyData.ContainerQty)) bodyData.ContainerQty = "0"; first = false; } else { le_id = Guid.NewGuid().ToString(); headData.LE_ID = le_id; bodyData.RefBillNose = le_id; headData.LETTERNAME = "派车通知"; headData.INPUTTIME = DateTime.Now.ToShortDateString(); headData.INPUTTIME = DateTime.Now.ToShortDateString(); headData.DbOperationType = DbOperationType.DbotIns; bodyData.DbOperationType = DbOperationType.DbotIns; var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 bodyData.BillNo = BillNo; bodyData.DbOperationType = DbOperationType.DbotIns; bodyData.ModelUIStatus = "I"; bodyData.UserCode = CookieConfig.GetCookie_UserCode(Request); bodyData.UserName = CookieConfig.GetCookie_UserName(Request); bodyData.OrgCode = CookieConfig.GetCookie_OrgCode(Request); bodyData.OrgName = CookieConfig.GetCookie_OrgName(Request); bodyData.LrDate = DateTime.Now.ToString(); //bodyData.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); bodyData.gId = "PC_" + Guid.NewGuid().ToString("N").ToUpper(); bodyData.PGid = bodyData.gId; bodyData.ContainerType = ctn.CTNALL; bodyData.ContainerNo = ctn.CNTRNO; bodyData.SealNo = ctn.SEALNO; bodyData.ContainerQty = "1"; bodyData.GOODSCOUNT = ctn.PKGS.ToString(); bodyData.Ton = ctn.KGS.ToString(); bodyData.CBM = ctn.CBM.ToString(); if (string.IsNullOrEmpty(bodyData.GOODSCOUNT)) bodyData.GOODSCOUNT = "0"; if (string.IsNullOrEmpty(bodyData.CBM)) bodyData.CBM = "0"; if (string.IsNullOrEmpty(bodyData.Ton)) bodyData.Ton = "0"; if (string.IsNullOrEmpty(bodyData.ContainerQty)) bodyData.ContainerQty = "0"; } headData.UpdateTime = DateTime.Now.ToString(); bodyData.F_CustomerName = headData.HEAD_TO; bodyData.RefBillNo = headData.BSNO; if (oplb == "海运出口" || oplb == "空运出口") { bodyData.DstArea = bodyData.CustName; bodyData.DetiNation = bodyData.FactoryAddr; } var modb = new ModelObjectDB(); 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 }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult DeleteTruckFeeLink(string bsno,string le_id,string data) { var result = MsOpLetterDAL.DeleteTruckFeeLink(bsno,le_id,data); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, // Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request)) }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult UpdateTruckFeeLink(string bsno, string le_id, string data) { var result = MsOpLetterDAL.UpdateTruckFeeLink(bsno, le_id, data); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, // Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request)) }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SavePC(string opstatus, string data, string body, string bs, string oplb = "海运出口") { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var billData = JsonConvert.Deserialize(bs); var le_id = ""; var head = new MsWlPcHead_ADL(); 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.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0"; headData.UpdateTime = DateTime.Now.ToString(); MsOpLetterDAL.UpdateTruckStauts(le_id, "已接单"); var modb = new ModelObjectDB(); DBResult result2 = modb.Save(headData); var BSNO = headData.BSNO; if (result2.Success == true) { result2 = modb.Save(bodyData); } var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; var BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 head.BillNo = BillNo; head.DbOperationType = DbOperationType.DbotIns; head.ModelUIStatus = "I"; head.UserCode = CookieConfig.GetCookie_UserCode(Request); head.UserName = CookieConfig.GetCookie_UserName(Request); head.OrgCode = CookieConfig.GetCookie_OrgCode(Request); head.OrgName = CookieConfig.GetCookie_OrgName(Request); head.LrDate = DateTime.Now; var ctn = bodyData.CTNS; if (ctn.IndexOf("*") > 0) { head.ContainerType = ctn.Substring(0, ctn.IndexOf("*")); try { head.ContainerQty = Int32.Parse(ctn.Substring(ctn.IndexOf("*") + 1)); } catch (Exception) { } } head.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); head.VoyVeg = billData.VESSEL + " " + billData.VOYNO; head.EtDate = billData.ETD; head.MblNo = billData.MBLNO; head.YardName = bodyData.YARD; head.RtnYardName = bodyData.RETURNYARD; head.FactoryAddr = bodyData.FACTRYADDR; head.LinkMan = bodyData.FACTRYATTN; head.LinkTel = bodyData.FACTRYTEL; head.CustomerName = billData.CUSTOMERNAME; head.RefBillNo = billData.BSNO; head.RefBillNoSe = le_id; //head.MblNoSe = oplb; head.MblNoSe = billData.MBLNO; head.BsType = oplb; head.CBM = "0"; head.GOODSCOUNT = "0"; head.DGTYPE = "0"; head.PGID = head.GId; var modb2 = new ModelObjectDB(); DBResult result = modb2.Save(head); DBResult resultCost = new DBResult{ Success = result.Success, Message = "" }; string custoername = head.CustomerName; var para = MsSysParamSetDAL.GetData("PARAMNAME='CUSTOMERNAME'"); if (para.PARAMVALUE != "") custoername = para.PARAMVALUE; #region 生成陆运费 if ((result.Success == true) && (bodyData.TRUCKFEE != "0")) { CostModel cm = new CostModel(); cm.BSNO = head.GId; cm.FeeValue = Convert.ToSingle(bodyData.TRUCKFEE); cm.FeeName = "陆运费"; cm.FeeType = "1"; cm.CustomerName = custoername; cm.CustomerType = "委托单位"; cm.Remark = "海运出口派车单自动生成陆运费用"; resultCost = MsOpLetterDAL.CreateCost(cm, CookieConfig.GetCookie_UserId(Request)); var defcustname = ""; var TRUCKCREATECRFEE = MsSysParamSetDAL.GetData("PARAMNAME='TRUCKCREATECRFEE'"); if (TRUCKCREATECRFEE.PARAMVALUE == "1") { var TRUCKCREATECRFEECUST = MsSysParamSetDAL.GetData("PARAMNAME='TRUCKCREATECRFEECUST'"); defcustname = TRUCKCREATECRFEECUST.PARAMVALUE; CostModel cm2 = new CostModel(); cm2.BSNO = headData.BSNO; cm2.FeeValue = Convert.ToSingle(bodyData.TRUCKFEE); cm2.FeeName = "陆运费"; cm2.FeeType = "2"; cm2.CustomerName = defcustname; cm2.CustomerType = ""; cm2.Remark = "派车单自动生成陆运费用"; resultCost = MsOpLetterDAL.CreateCost(cm2, CookieConfig.GetCookie_UserId(Request)); } } #endregion if (resultCost.Success == true) { result.Success = true; result.Message = "生成成功"; } else { result.Success = false; result.Message = "生成过程发生错误"; } 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 SaveAirPC(string opstatus, string data, string body, string bs, string oplb = "空运出口") { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var billData = JsonConvert.Deserialize(bs); var le_id = ""; var head = new MsWlPcHead_ADL(); 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.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0"; headData.UpdateTime = DateTime.Now.ToString(); MsOpLetterDAL.UpdateTruckStauts(le_id, "已接单"); var modb = new ModelObjectDB(); DBResult result2 = modb.Save(headData); var BSNO = headData.BSNO; if (result2.Success == true) { result2 = modb.Save(bodyData); } var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; var BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 head.BillNo = BillNo; head.DbOperationType = DbOperationType.DbotIns; head.ModelUIStatus = "I"; head.UserCode = CookieConfig.GetCookie_UserCode(Request); head.UserName = CookieConfig.GetCookie_UserName(Request); head.OrgCode = CookieConfig.GetCookie_OrgCode(Request); head.OrgName = CookieConfig.GetCookie_OrgName(Request); head.LrDate = DateTime.Now; var ctn = bodyData.CTNS; if (ctn.IndexOf("*") > 0) { head.ContainerType = ctn.Substring(0, ctn.IndexOf("*")); try { head.ContainerQty = Int32.Parse(ctn.Substring(ctn.IndexOf("*") + 1)); } catch (Exception) { } } head.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); head.VoyVeg = billData.VESSEL; head.EtDate = billData.ETD; head.MblNo = billData.MBLNO; head.YardName = bodyData.YARD; head.RtnYardName = bodyData.RETURNYARD; head.FactoryAddr = bodyData.FACTRYADDR; head.LinkMan = bodyData.FACTRYATTN; head.LinkTel = bodyData.FACTRYTEL; head.CustomerName = billData.CUSTOMERNAME; head.RefBillNo = billData.BSNO; head.RefBillNoSe = le_id; head.MblNoSe = oplb; var modb2 = new ModelObjectDB(); DBResult result = modb2.Save(head); if (result.Success == true) { result.Success = true; result.Message = "生成成功"; } else { result.Success = false; result.Message = "生成过程发生错误"; } 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 SavePC_SH(string opstatus, string data, string body, string bs, string oplb = "海运出口") { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var billData = JsonConvert.Deserialize(bs); var le_id = ""; var head = new MsWlPcHead_WFSDEdit(); 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.OTHERFEE == ""|| bodyData.OTHERFEE ==null) bodyData.OTHERFEE = "0"; headData.UpdateTime = DateTime.Now.ToString(); MsOpLetterDAL.UpdateTruckStauts(le_id, "已接单"); var modb = new ModelObjectDB(); DBResult result2 = modb.Save(headData); var BSNO = headData.BSNO; if (result2.Success == true) { result2 = modb.Save(bodyData); } var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; var BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 head.BillNo = BillNo; head.DbOperationType = DbOperationType.DbotIns; head.ModelUIStatus = "I"; head.UserCode = CookieConfig.GetCookie_UserCode(Request); head.UserName = CookieConfig.GetCookie_UserName(Request); head.OrgCode = CookieConfig.GetCookie_OrgCode(Request); head.OrgName = CookieConfig.GetCookie_OrgName(Request); head.LrDate = DateTime.Now.ToString(); head.PcBillType = "1";//0集运 1散货派车单 head.gId = "PC_" + Guid.NewGuid().ToString("N").ToUpper(); var ctn = bodyData.CTNS; if (ctn.IndexOf("*") > 0) { //head.ContainerType = ctn.Substring(0, ctn.IndexOf("*")); try { head.ContainerQty = ctn.Substring(ctn.IndexOf("*") + 1); } catch (Exception) { } } head.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); head.VoyVeg = billData.VESSEL + " " + billData.VOYNO; head.EtDate = billData.ETD; head.MblNo = billData.MBLNO; //head.YardName = bodyData.YARD; //head.RtnYardName = bodyData.RETURNYARD; //head.FactoryAddr = bodyData.FACTRYADDR; head.LinkMan = bodyData.FACTRYATTN; //head.LinkTel = bodyData.FACTRYTEL; //head.RefBillNo = le_id; head.CustomerName = billData.CUSTOMERNAME; head.ContainerQty = billData.PKGS.ToString();//件数 head.Ton = billData.KGS.ToString();//重量 head.LoadCount = billData.CBM.ToString();//尺码 head.RefBillNo = billData.BSNO; head.RefBillNose = le_id; head.MblNoSe = oplb; head.LoadPlace = bodyData.FACTRYNAME; head.DstArea = bodyData.YARD; var modb2 = new ModelObjectDB(); DBResult result = modb2.Save(head); if (result.Success == true) { result.Success = true; result.Message = "生成成功"; } else { result.Success = false; result.Message = "生成过程发生错误"; } 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 SaveAirPC_SH(string opstatus, string data, string body, string bs, string oplb = "空运出口") { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(body); var billData = JsonConvert.Deserialize(bs); var le_id = ""; var head = new MsWlPcHead_WFSDEdit(); 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.OTHERFEE == "" || bodyData.OTHERFEE == null) bodyData.OTHERFEE = "0"; headData.UpdateTime = DateTime.Now.ToString(); MsOpLetterDAL.UpdateTruckStauts(le_id, "已接单"); var modb = new ModelObjectDB(); DBResult result2 = modb.Save(headData); var BSNO = headData.BSNO; if (result2.Success == true) { result2 = modb.Save(bodyData); } var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; var BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, DateTime.Now.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM")); //获取合同号 head.BillNo = BillNo; head.DbOperationType = DbOperationType.DbotIns; head.ModelUIStatus = "I"; head.UserCode = CookieConfig.GetCookie_UserCode(Request); head.UserName = CookieConfig.GetCookie_UserName(Request); head.OrgCode = CookieConfig.GetCookie_OrgCode(Request); head.OrgName = CookieConfig.GetCookie_OrgName(Request); head.LrDate = DateTime.Now.ToString(); head.PcBillType = "1";//0集运 1散货派车单 head.gId = "PC_" + Guid.NewGuid().ToString("N").ToUpper(); var ctn = bodyData.CTNS; if (ctn.IndexOf("*") > 0) { //head.ContainerType = ctn.Substring(0, ctn.IndexOf("*")); try { head.ContainerQty = ctn.Substring(ctn.IndexOf("*") + 1); } catch (Exception) { } } head.ExpDate = DateTime.Now.ToString("yyyy-MM-dd"); head.VoyVeg = billData.VESSEL; head.EtDate = billData.ETD; head.MblNo = billData.MBLNO; //head.YardName = bodyData.YARD; //head.RtnYardName = bodyData.RETURNYARD; //head.FactoryAddr = bodyData.FACTRYADDR; head.LinkMan = bodyData.FACTRYATTN; //head.LinkTel = bodyData.FACTRYTEL; //head.RefBillNo = le_id; head.CustomerName = billData.CUSTOMERNAME; head.ContainerQty = billData.PKGS.ToString();//件数 head.Ton = billData.KGS.ToString();//重量 head.LoadCount = billData.CBM.ToString();//尺码 head.RefBillNo = billData.BSNO; head.RefBillNose = le_id; head.MblNoSe = oplb; head.LoadPlace = bodyData.FACTRYNAME; head.DstArea = bodyData.YARD; var modb2 = new ModelObjectDB(); DBResult result = modb2.Save(head); if (result.Success == true) { result.Success = true; result.Message = "生成成功"; } else { result.Success = false; result.Message = "生成过程发生错误"; } 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 SaveSur(string opstatus, string data, string body) { var headData = JsonConvert.Deserialize(data); var bodyData = JsonConvert.Deserialize(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(data); var bodyData = JsonConvert.Deserialize(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 CreateLetterList(string data, string type) { var result = new DBResult(); var headList = JsonConvert.Deserialize>(data); foreach (var head in headList) { var list = MsOpLetterDAL.GetDataList("BSNO='" + head.BSNO + "' AND LETTERNAME='" + type + "'"); if (list.Count > 0) { } else { var opletter = new MsOpLetter(); opletter.HEAD_TO = head.CUSTOMERNAME; opletter.BSNO = head.BSNO; var contactlist = BasicDataRefDAL.GetInfoClientContactList("ISOPERATOR = 1 and LINKID in (select gid from[info_client] where SHORTNAME = '" + head.CUSTOMERNAME + "')"); if (contactlist != null && contactlist.Count != 0) { opletter.HEAD_ATTN = contactlist[0].SHOWNAME; opletter.HEAD_ATTNTEL = contactlist[0].TEL; opletter.HEAD_ATTNFAX = contactlist[0].FAX; } var userlist = BasicDataRefDAL.GetUserLinkRefList("u.GID='" + Convert.ToString(Session["USERID"]) + "'", Convert.ToString(Session["COMPANYID"])); if (userlist != null && userlist.Count != 0) { opletter.HEAD_FMTEL = userlist[0].Tel; opletter.HEAD_FMFAX = userlist[0].Fax; opletter.HEAD_FMEMAIL = userlist[0].Email; } opletter.INPUTBY = Convert.ToString(Session["SHOWNAME"]); var le_id = Guid.NewGuid().ToString(); opletter.LE_ID = le_id; opletter.LETTERNAME = type; opletter.INPUTTIME = DateTime.Now.ToShortDateString(); opletter.DbOperationType = DbOperationType.DbotIns; opletter.UpdateTime = DateTime.Now.ToString(); var modb = new ModelObjectDB(); result = modb.Save(opletter); if (result.Success) { if (type == "入货通知") { var bodyData = new MsOpLetterYard(); bodyData.LE_ID = opletter.LE_ID; bodyData.DbOperationType = DbOperationType.DbotIns; bodyData.VESSELVOYNO = head.VESSEL + " " + head.VOYNO; bodyData.PKC = head.PKGS + head.KINDPKGS + "|" + head.KGS + "KGS|" + head.CBM + "CBM"; bodyData.YARD = head.YARD; bodyData.YARD2 = head.YARD; bodyData.CHIEF = head.YARDATTN; bodyData.Tel = head.YARDTEL; bodyData.CHIEF2 = head.YARDATTN; bodyData.Tel2 = head.YARDTEL; bodyData.CNTR = head.CNTRTOTAL; if (!string.IsNullOrEmpty(head.YARD)) { var custlist = BasicDataRefDAL.GetCustomYardRefList("SHORTNAME='" + head.YARD + "'"); if (custlist != null && custlist.Count != 0) { bodyData.Address = custlist[0].ADDR; bodyData.Address2 = custlist[0].ADDR; } } bodyData.MBLNO = head.MBLNO; bodyData.PORTDISCHARGE = head.PORTDISCHARGE; bodyData.ETD = head.ETD; bodyData.DESCRIPTION = head.DESCRIPTION; bodyData.CLOSEDOCDATE = head.CLOSEDOCDATE; bodyData.CLOSINGDATE = head.CLOSINGDATE; bodyData.DOC = head.DOC; if (!string.IsNullOrEmpty(head.DOC)) { var doclist = BasicDataRefDAL.GetUserLinkRefList("u.SHOWNAME='" + bodyData.DOC + "'", Convert.ToString(Session["COMPANYID"])); if (doclist != null && doclist.Count != 0) { bodyData.DOCTEL = doclist[0].Tel; bodyData.DOCFAX = doclist[0].Fax; bodyData.DOCEMAIL = doclist[0].Email; } } 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; result = modb.Save(bodyData); } else if (type == "电放保函") { var bodyData = new MsOpLetterSur(); bodyData.LE_ID = opletter.LE_ID; bodyData.DbOperationType = DbOperationType.DbotIns; bodyData.MBLNO = head.MBLNO; bodyData.PORTDISCHARGE = head.PORTDISCHARGE; bodyData.PORTLOAD = head.PORTLOAD; bodyData.CONSIGNEE = head.CONSIGNEE; bodyData.VESSELVOYNO = head.VESSEL + " " + head.VOYNO; result = modb.Save(bodyData); } else if (type == "派车通知") { var bodyData = new MsOpLetterTruck(); bodyData.LE_ID = opletter.LE_ID; bodyData.DbOperationType = DbOperationType.DbotIns; bodyData.YARD = head.YARD; bodyData.CTNS = head.CNTRTOTAL; bodyData.RETURNYARD = head.YARD; bodyData.TRUCKSTATUS = "待派车"; bodyData.KGS = Convert.ToString(Convert.ToDecimal(head.KGS) / 1000); bodyData.MBLNO = head.MBLNO; bodyData.CLOSINGDATE = head.CLOSINGDATE; var yardcontactlist = BasicDataRefDAL.GetInfoClientContactList("ISOPERATOR = 1 and LINKID in (select gid from[info_client] where SHORTNAME = '" + head.YARD + "')"); if (yardcontactlist != null && yardcontactlist.Count != 0) { bodyData.YARDATTN = yardcontactlist[0].SHOWNAME; bodyData.YARDTEL = yardcontactlist[0].TEL; bodyData.RETURNATTN = yardcontactlist[0].SHOWNAME; bodyData.RETURNTEL = yardcontactlist[0].TEL; } if (bodyData.CLOSINGDATE == "") bodyData.CLOSINGDATE = null; result = modb.Save(bodyData); var opseaectnsum = MsOpSeaeDAL.GetBodyListSum("BSNO='" + head.BSNO + "'"); var bodyctn1 = new List(); foreach (var ctn in opseaectnsum) { MsOpLetterTruckCtn Data = new MsOpLetterTruckCtn(); Data.CTN_ID = ctn.CTN_ID; Data.CTNALL = ctn.CTNALL; Data.LE_ID = opletter.LE_ID; Data.CTNNUM = ctn.CTNNUM; Data.KGS = ctn.KGS; bodyctn1.Add(Data); } MsOpLetterDAL.SaveTruckCtn(bodyData, bodyctn1); } } } } var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult Delete(string data) { var head = JsonConvert.Deserialize(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) }; } public ContentResult DeleteLS(string data) { var head = JsonConvert.Deserialize(data); var isfee = MsOpLetterDAL.GetFeeCount(head.gId); if (isfee) { var jsonRespose = new JsonResponse { Success = false, Message = "此票业务存在费用,请先删除费用才能删除此票业务!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } else { var modb = new ModelObjectDB(); DBResult result = modb.Delete(head); if (result.Success == true) { MsOpLetterDAL.DeletePc(head.RefBillNose); } var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } } }