|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcContainer.Models.MsOpCtnBsCard;
|
|
|
using DSWeb.MvcContainer.DAL.MsOpCtnBsCard;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using System.Collections.Generic;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using System.Text;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using System.Data;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using System.IO;
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
|
namespace DSWeb.MvcContainer.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsOpCtnBsCardController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET:
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
|
|
|
public ActionResult CtnStatusIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CtnStatusEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult RptCtnStatus()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult ProfitIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult RepairAudit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult ClearingAudit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CtnStatusDetail()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult ReturnAudit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult ChfeeAudit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CtnStatusFee()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult RptRepair()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult RptCtnTurnOver()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition, string pricetype)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetDataList(condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), sort);
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetDataListStr(string sort, string condition, string pricetype)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnBsCardDAL.GetDataListStr(condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetDataFeeList(int start, int limit, string sort, string condition, string datetype)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetDataFeeList(condition, datetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sort);
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetDataFeeListStr(string sort, string condition, string datetype)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnBsCardDAL.GetDataFeeListStr(condition, datetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult GetRptCtnStatusData(int start, int limit,string condition, string sort, string printstr = "false")
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT VDESTPORT DESTPORT,SUM(CASE WHEN VDEST_RTCNT_TIME IS NOT NULL OR (PORTLOAD_CNT_TIME IS NULL AND ETD IS NULL) THEN 1 ELSE 0 END) AS YARDCTN,");
|
|
|
strSql.Append("SUM(CASE WHEN VDEST_RTCNT_TIME IS NOT NULL THEN 1 ELSE 0 END) AS CANUSEYARDCTN, ");
|
|
|
strSql.Append("SUM(CASE WHEN PORTLOAD_CNT_TIME IS NULL AND ETD IS NULL THEN 1 ELSE 0 END) AS PLANUSEYARDCTN,");
|
|
|
strSql.Append("(SELECT SUM(CTNNUM) FROM op_ctnapply WHERE MNGAUDITSTATUS='审核通过' and BSSTATUS<>'配箱完成' AND ADDCTNSTATUS<>'配箱完成' and PORTDISCHARGE=b.VDESTPORT) AS PLANUSECTN,");
|
|
|
strSql.Append(" SUM(CASE WHEN VDEST_RTCNT_TIME IS NULL AND VETA IS NOT NULL THEN 1 ELSE 0 END) AS ARRIVALCTN,");
|
|
|
strSql.Append("SUM(CASE WHEN VETA IS NULL AND PORTLOAD_CNT_TIME IS NOT NULL THEN 1 ELSE 0 END) AS TRANSCTN,");
|
|
|
strSql.Append("SUM(CASE WHEN VDEST_RTCNT_TIME IS NOT NULL AND CTNSTATUS='可用' and DATEDIFF (dd ,VDEST_RTCNT_TIME,GETDATE())>7 and DATEDIFF (dd ,VDEST_RTCNT_TIME,GETDATE())<=15 THEN 1 ELSE 0 END) AS CANUSEYARDCTN7, ");
|
|
|
strSql.Append("SUM(CASE WHEN VDEST_RTCNT_TIME IS NOT NULL AND CTNSTATUS='可用' and DATEDIFF (dd ,VDEST_RTCNT_TIME,GETDATE())>15 and DATEDIFF (dd ,VDEST_RTCNT_TIME,GETDATE())<=30 THEN 1 ELSE 0 END) AS CANUSEYARDCTN15, ");
|
|
|
strSql.Append("SUM(CASE WHEN VDEST_RTCNT_TIME IS NOT NULL AND CTNSTATUS='可用' and DATEDIFF (dd ,VDEST_RTCNT_TIME,GETDATE())>30 THEN 1 ELSE 0 END) AS CANUSEYARDCTN30 ");
|
|
|
|
|
|
strSql.Append(" FROM v_top_opctnbscard b ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" GROUP BY VDESTPORT ");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring + " '");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by b.VDESTPORT ");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
|
|
|
{
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "完成",
|
|
|
Data = strSql.ToString()
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
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 GetRptCtnStatusList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetRptCtnStatusList(condition, sort);
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
OpCtnBsCard head = null;
|
|
|
|
|
|
if (handle == "edit")
|
|
|
{
|
|
|
head = MsOpCtnBsCardDAL.GetData(condition, Convert.ToString(Session["USERID"]));
|
|
|
}
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new OpCtnBsCard();
|
|
|
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.INPUTBYREF = Convert.ToString(Session["SHOWNAME"]);
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string data2, string data3, string data4, bool iscreatefee = false, string feetype = "2")
|
|
|
{
|
|
|
|
|
|
var headData = JsonConvert.Deserialize<OpCtnBsCard>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", "").Replace("}", ",") + data4.Replace("{", ""));
|
|
|
|
|
|
var errorstr = "";
|
|
|
var isPost = true;
|
|
|
var ct = MsOpCtnBsCardDAL.GetRdCount("GID<>'" + headData.GID + "' AND BSNO='" + headData.BSNO + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "业务编号重复!";
|
|
|
}
|
|
|
if (headData.BSNO==""){
|
|
|
|
|
|
isPost = false;
|
|
|
errorstr = "业务编号不能为空!";
|
|
|
}
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
headData.INPUTBY = Convert.ToString(Session["USERID"]);
|
|
|
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='罐箱业务卡'", Convert.ToString(Session["COMPANYID"]));
|
|
|
//if (billnoset.BILLTYPE != "")
|
|
|
// headData.BSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.INPUTTIME.ToString().Trim(), headData.INPUTTIME.ToString().Trim());
|
|
|
//else
|
|
|
//{
|
|
|
// errorstr = "编号规则未设置,请先设置编号生成规则!";
|
|
|
// isPost = false;
|
|
|
//}
|
|
|
|
|
|
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
|
|
|
headData.MODIFYUSER= Convert.ToString(Session["USERID"]);
|
|
|
headData.MODIFYTIME= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
var GID = headData.GID;
|
|
|
|
|
|
//if (headData.PORTLOAD_CNT_TIME == "")
|
|
|
//{
|
|
|
// if (headData.ETD != "")
|
|
|
// {
|
|
|
// errorstr = "开船日期不能小于提箱日期";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
//else {
|
|
|
|
|
|
// if (headData.ETD != "" && (Convert.ToDateTime(headData.ETD) < Convert.ToDateTime(headData.PORTLOAD_CNT_TIME)))
|
|
|
// {
|
|
|
// errorstr = "开船日期不能小于提箱日期";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (headData.ETD == "")
|
|
|
{
|
|
|
if (headData.ETA != "")
|
|
|
{
|
|
|
errorstr = "开船日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.ETA != "" && (Convert.ToDateTime(headData.ETA) < Convert.ToDateTime(headData.ETD)))
|
|
|
{
|
|
|
errorstr = "到港日期不能小于开船日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
if (headData.ETA == "")
|
|
|
{
|
|
|
if (headData.DEST_CNT_TIME != "")
|
|
|
{
|
|
|
errorstr = "到港日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.DEST_CNT_TIME != "" && (Convert.ToDateTime(headData.DEST_CNT_TIME) < Convert.ToDateTime(headData.ETA)))
|
|
|
{
|
|
|
errorstr = "提箱日期不能小于到港日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
//if (headData.DEST_CNT_TIME == "")
|
|
|
//{
|
|
|
// if (headData.DEST_RTCNT_TIME != "")
|
|
|
// {
|
|
|
// errorstr = "目的港提箱日期不能为空!";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
|
|
|
// if (headData.DEST_RTCNT_TIME != "" && (Convert.ToDateTime(headData.DEST_RTCNT_TIME) < Convert.ToDateTime(headData.DEST_CNT_TIME)))
|
|
|
// {
|
|
|
// errorstr = "目的港还箱日期不能小于目的港提箱日期";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
if (headData.DEST_RTCNT_TIME == "")
|
|
|
{
|
|
|
if (headData.I_PORTLOAD_CNT_TIME != "")
|
|
|
{
|
|
|
errorstr = "目的港还箱日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.I_PORTLOAD_CNT_TIME != "" && (Convert.ToDateTime(headData.I_PORTLOAD_CNT_TIME) < Convert.ToDateTime(headData.DEST_RTCNT_TIME)))
|
|
|
{
|
|
|
errorstr = "空返提箱日期不能小于目的港还箱日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//if (headData.I_PORTLOAD_CNT_TIME == "")
|
|
|
//{
|
|
|
// if (headData.I_ETD != "")
|
|
|
// {
|
|
|
// errorstr = "空返开船日期不能小于提箱日期";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
|
|
|
// if (headData.I_ETD != "" && (Convert.ToDateTime(headData.I_ETD) < Convert.ToDateTime(headData.I_PORTLOAD_CNT_TIME)))
|
|
|
// {
|
|
|
// errorstr = "空返开船日期不能小于提箱日期";
|
|
|
// isPost = false;
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (headData.I_ETD == "")
|
|
|
{
|
|
|
if (headData.I_ETA != "")
|
|
|
{
|
|
|
errorstr = "空返开船日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.I_ETA != "" && (Convert.ToDateTime(headData.I_ETA) < Convert.ToDateTime(headData.I_ETD)))
|
|
|
{
|
|
|
errorstr = "空返到港日期不能小于开船日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
if (headData.I_ETA == "")
|
|
|
{
|
|
|
if (headData.I_DEST_CNT_TIME != "")
|
|
|
{
|
|
|
errorstr = "空返到港日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.I_DEST_CNT_TIME != "" && (Convert.ToDateTime(headData.I_DEST_CNT_TIME) < Convert.ToDateTime(headData.I_ETA)))
|
|
|
{
|
|
|
errorstr = "空返提箱日期不能小于到港日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
if (headData.I_DEST_CNT_TIME == "")
|
|
|
{
|
|
|
if (headData.I_DEST_RTCNT_TIME != "")
|
|
|
{
|
|
|
errorstr = "空返目的港提箱日期不能为空!";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.I_DEST_RTCNT_TIME != "" && (Convert.ToDateTime(headData.I_DEST_RTCNT_TIME) < Convert.ToDateTime(headData.I_DEST_CNT_TIME)))
|
|
|
{
|
|
|
errorstr = "空返目的港还箱日期不能小于目的港提箱日期";
|
|
|
isPost = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (headData.IS_RETURE_EMPTY == true)
|
|
|
{
|
|
|
if (headData.I_DEST_RTCNT_TIME != "" && (Convert.ToDateTime(headData.I_DEST_RTCNT_TIME) <= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))))
|
|
|
{
|
|
|
var vct = MsOpCtnBsCardDAL.GetRdCount("CTNNO='" + headData.CTNNO + "' and GID<>'" + headData.GID + "' AND (PORTLOAD_CNT_TIME>='" + headData.I_DEST_RTCNT_TIME + "' OR PORTLOAD_CNT_TIME IS NULL)");
|
|
|
if (vct == 0)
|
|
|
{
|
|
|
MsOpCtnBsCardDAL.UpCtnStatus(headData.CTNNO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (headData.DEST_RTCNT_TIME!=""&&(Convert.ToDateTime(headData.DEST_RTCNT_TIME) <= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))))
|
|
|
{
|
|
|
var vct = MsOpCtnBsCardDAL.GetRdCount("CTNNO='" + headData.CTNNO + "' and GID<>'" + headData.GID + "' AND (PORTLOAD_CNT_TIME>='" + headData.DEST_RTCNT_TIME + "' OR PORTLOAD_CNT_TIME IS NULL)");
|
|
|
if (vct == 0)
|
|
|
{
|
|
|
MsOpCtnBsCardDAL.UpCtnStatus(headData.CTNNO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData.IS_RETURE_EMPTY == false) {
|
|
|
|
|
|
headData.I_ETD = null;
|
|
|
headData.I_ETA = null;
|
|
|
headData.I_ARRIVALDATE = null;
|
|
|
headData.I_DEST_CNT_TIME = null;
|
|
|
headData.I_DEST_RTCNT_TIME = null;
|
|
|
headData.I_PORTLOAD_CNT_TIME = null;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.PREETA == "") headData.PREETA = null;
|
|
|
if (headData.I_ETD == "") headData.I_ETD = null;
|
|
|
if (headData.I_ETA == "") headData.I_ETA = null;
|
|
|
if (headData.PREI_ETA == "") headData.PREI_ETA = null;
|
|
|
if (headData.PORTLOADDATE == "") headData.PORTLOADDATE = null;
|
|
|
if (headData.I_ARRIVALDATE == "") headData.I_ARRIVALDATE = null;
|
|
|
if (headData.I_DEST_CNT_TIME == "") headData.I_DEST_CNT_TIME = null;
|
|
|
if (headData.I_DEST_RTCNT_TIME == "") headData.I_DEST_RTCNT_TIME = null;
|
|
|
if (headData.I_PORTLOAD_CNT_TIME == "") headData.I_PORTLOAD_CNT_TIME = null;
|
|
|
if (headData.PORTLOAD_CNT_TIME == "") headData.PORTLOAD_CNT_TIME = null;
|
|
|
if (headData.ARRIVALDATE == "") headData.ARRIVALDATE = null;
|
|
|
if (headData.DEST_CNT_TIME == "") headData.DEST_CNT_TIME = null;
|
|
|
if (headData.DEST_RTCNT_TIME == "") headData.DEST_RTCNT_TIME = null;
|
|
|
if (headData.PRE_CNT_TIME == "") headData.PRE_CNT_TIME = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
var result = modb.Save(headData);
|
|
|
if (iscreatefee && result.Success) {
|
|
|
MsOpCtnBsCardDAL.SaveFeeDR(headData, Convert.ToString(Session["USERID"]),feetype);
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsOpCtnBsCardDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult ShenReturn(string opstatus, string data, string data2, string data3, string data4, string type, string reason="")
|
|
|
{
|
|
|
|
|
|
var headData = JsonConvert.Deserialize<OpCtnBsCard>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", "").Replace("}", ",") + data4.Replace("{", ""));
|
|
|
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var GID = headData.GID;
|
|
|
if (type == "1")
|
|
|
{
|
|
|
var remarks = headData.REMARKS + " 申请返空信息: " + reason;
|
|
|
string blUpSQL = "update op_ctnbscard set AUDITSTATUS='申请返空',SHENTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',REMARKS='" + remarks + "' where GID='" + headData.GID + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
else if (type == "0")
|
|
|
{
|
|
|
string blUpSQL = "update op_ctnbscard set AUDITSTATUS='未申请',SHENTIME=NULL where GID='" + headData.GID + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success =true,
|
|
|
Message ="申请成功!",
|
|
|
Data = MsOpCtnBsCardDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
public ContentResult AuditReturn(string data, string type)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.AuditReturn(headData, type, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.DeleteOpCtnBsCard(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult SubmitAudit(string bill,string type)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.SubmitAudit(bill, type);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult Audit(string bill, string type)
|
|
|
{
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.Audit(bill, type);
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult AuditPutCtn(string data, string type)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.AuditPutCtn(bodyList, type, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult PutCtn(string data, string PutDate)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.PutCtn(bodyList,"1", PutDate);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult CancelPutCtn(string data)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.PutCtn(bodyList, "0","");
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult LockBs(string data)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.LockBs(bodyList, "1");
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult CancelLockBs(string data)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.LockBs(bodyList, "0");
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOpCtnClearingList(int start, int limit, string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetOpCtnClearingList(condition, sort);
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOpCtnClearingListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnBsCardDAL.GetOpCtnClearingListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOpCtnDeliveryList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetOpCtnDeliveryList(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOpCtnRepairList(int start, int limit,string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetOpCtnRepairList(condition, sort);
|
|
|
var list = dataList.Skip(start).Take(limit);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOpCtnRepairListStr(string condition, string sort)
|
|
|
{
|
|
|
var dataListStr = MsOpCtnBsCardDAL.GetOpCtnRepairListStr(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOpCtnRepairListImg(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpCtnBsCardDAL.GetOpCtnRepairListImg(condition, sort);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SaveOpCtnClearing(string body, string PID)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnClearing>>(body);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.SaveOpCtnClearing(bodyList, PID, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveOpCtnRepair(string body, string PID)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnRepair>>(body);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.SaveOpCtnRepair(bodyList, PID, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveOpCtnRepairImg(string body, string PID)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnRepairImg>>(body);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.SaveOpCtnRepairImg(bodyList, PID, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
public ContentResult UploadFile()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadFile"];
|
|
|
var GID = Request.Form["GID"];
|
|
|
var BSNO = Request.Form["BSNO"];
|
|
|
var type = Request.Form["type"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/MsOpFiles/" + BSNO);
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
|
|
|
var usercode = Convert.ToString(Session["USERCODE"]);
|
|
|
var partname = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
string filename = path + "\\" + partname;
|
|
|
string filenameURL = "../../UploadFiles/MsOpFiles/" + BSNO + "/" + partname;
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var message = string.Empty;
|
|
|
|
|
|
DBResult isSucess = null;
|
|
|
|
|
|
if (type == "1" || type == "2")
|
|
|
isSucess = MsOpCtnBsCardDAL.UpdateRepairFileData(filenameURL, name, GID,type);
|
|
|
else if (type == "3" || type == "4"|| type == "5"|| type == "6")
|
|
|
isSucess = MsOpCtnBsCardDAL.UpdateClearingFileData(filenameURL, name, GID, type);
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = isSucess.Success, Message = isSucess.Message, data = filename });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
public ContentResult SaveOpCtnDelivery(string body, string PID)
|
|
|
{
|
|
|
//
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpCtnDelivery>>(body);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.SaveOpCtnDelivery(bodyList, PID, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult DeleteOpCtnClearing(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnClearing>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.DeleteOpCtnClearing(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult DeleteOpCtnDelivery(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnDelivery>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.DeleteOpCtnDelivery(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult DeleteOpCtnRepair(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnRepair>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.DeleteOpCtnRepair(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteOpCtnRepairImg(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnRepairImg>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.DeleteOpCtnRepairImg(headData);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult AuditOpCtnClearing(string data,string type)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnClearing>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.AuditOpCtnClearing(headData, type, Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult AuditOpCtnRepair(string data, string type)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<OpCtnRepair>>(data);
|
|
|
|
|
|
DBResult result = MsOpCtnBsCardDAL.AuditOpCtnRepair(headData, type, Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetBsList(string bsno)
|
|
|
{
|
|
|
|
|
|
var dataList = MsOpCtnBsCardDAL.GetBsList(bsno);
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 周转率
|
|
|
|
|
|
public ContentResult GetRptCtnTurnOverData(int start, int limit, string condition,string startdate,string enddate,string sort, string printstr = "false")
|
|
|
{
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT CTNNO,SUM(DATEDIFF([day],STARTDATE,ENDDATE)) AS NOEMPTYDAY,DATEDIFF([day],'" + startdate + "','" + enddate + "') as ALLDAY,");
|
|
|
strSql.Append(" convert(decimal(10,2),convert(decimal(10,2),SUM(DATEDIFF([day],STARTDATE,ENDDATE)))/convert(decimal(10,2),DATEDIFF([day],'" + startdate + "','" + enddate + "'))*100) as TURNOVERRATE ");
|
|
|
strSql.Append(" from (SELECT CTNNO,CASE WHEN b.PORTLOAD_CNT_TIME<'" + startdate + "' THEN DATEADD(DAY,-1,'" + startdate + "') ELSE DATEADD(DAY,-8,b.PORTLOAD_CNT_TIME) END AS STARTDATE,");
|
|
|
strSql.Append(" CASE WHEN b.DEST_RTCNT_TIME>'" + enddate + "' THEN '" + enddate + "' ELSE b.DEST_RTCNT_TIME END AS ENDDATE ");
|
|
|
|
|
|
strSql.Append(" FROM op_ctnbscard b ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) X GROUP BY CTNNO ");
|
|
|
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring + " ");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by CTNNO ");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
|
|
|
{
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "完成",
|
|
|
Data = strSql.ToString()
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
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 };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 字段锁定
|
|
|
|
|
|
public ContentResult GetLockField(string condition)
|
|
|
{
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT GID,FIELDNAME");
|
|
|
strSql.Append(" FROM op_ctnapply_lock ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" order by FIELDNAME");
|
|
|
|
|
|
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
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(0, 1000, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult UpdateFieldDate(string GID, string fieldname,string update)
|
|
|
{
|
|
|
var strupdate = update;
|
|
|
if (strupdate == "") strupdate = "null";
|
|
|
if (strupdate != "null") strupdate = "'" + strupdate + "'";
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
string blUpSQL = " update op_ctnbscard set " + fieldname + "=" + strupdate + ",MODIFYTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',MODIFYUSER='" + Convert.ToString(Session["USERID"]) + "' where GID='" + GID + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
var headData = MsOpCtnBsCardDAL.GetData("GID='"+GID+"'", Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
if (fieldname == "I_DEST_RTCNT_TIME" || fieldname == "DEST_RTCNT_TIME")
|
|
|
{
|
|
|
|
|
|
if (headData.IS_RETURE_EMPTY == true)
|
|
|
{
|
|
|
if (fieldname == "I_DEST_RTCNT_TIME" && update != "" && (Convert.ToDateTime(update) <= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))))
|
|
|
{
|
|
|
var vct = MsOpCtnBsCardDAL.GetRdCount("CTNNO='" + headData.CTNNO + "' and GID<>'" + headData.GID + "' AND (PORTLOAD_CNT_TIME>='" + update + "' OR PORTLOAD_CNT_TIME IS NULL)");
|
|
|
if (vct == 0)
|
|
|
{
|
|
|
MsOpCtnBsCardDAL.UpCtnStatus(headData.CTNNO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (fieldname == "DEST_RTCNT_TIME" && update !="" && (Convert.ToDateTime(update) <= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))))
|
|
|
{
|
|
|
var vct = MsOpCtnBsCardDAL.GetRdCount("CTNNO='" + headData.CTNNO + "' and GID<>'" + headData.GID + "' AND (PORTLOAD_CNT_TIME>='" + update + "' OR PORTLOAD_CNT_TIME IS NULL)");
|
|
|
if (vct == 0)
|
|
|
{
|
|
|
MsOpCtnBsCardDAL.UpCtnStatus(headData.CTNNO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "提交成功!",
|
|
|
Data = ""
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult LockField(string GID, string fieldname)
|
|
|
{
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
string blUpSQL = "insert into op_ctnapply_lock(GID,BSNO,FIELDNAME) VALUES(NEWID(),'" + GID + "','" + fieldname + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "提交成功!",
|
|
|
Data =""
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult UnLockField(string GID, string fieldname)
|
|
|
{
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
string blUpSQL = "delete from op_ctnapply_lock where bsno='" + GID + "' and FIELDNAME='" + fieldname + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "提交成功!",
|
|
|
Data =""
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|