diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSaleRptController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSaleRptController.cs new file mode 100644 index 00000000..033fe4e4 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSaleRptController.cs @@ -0,0 +1,335 @@ +using System; +using System.Linq; +using System.Web.Mvc; +using DSWeb.MvcShipping.DAL.MsOpSaleRptDAL; +using DSWeb.MvcShipping.Models.MsOpSaleRpt; +using DSWeb.MvcShipping.Helper; +using DSWeb.MvcShipping.Comm.Cookie; +using HcUtility.Comm; +using HcUtility.Core; +using System.Collections.Generic; +using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; +using DSWeb.EntityDA; +using DSWeb.Models; +using DSWeb.Attributes; +using DSWeb.MvcShipping.Models.MsSysBillNoSet; +using DSWeb.MvcShipping.DAL.MsSysBillNoSet; +using DSWeb.MvcShipping.Models.MsCodeServiceFeeTemplate; +using System.IO; +using System.Data; +using System.Data.OleDb; +using DSWeb.MvcShipping.DAL.MsInfoClient; +using DSWeb.MvcShipping.DAL.MsSysParamSet; +using System.Web.Configuration; +using DSWeb.MvcShipping.DAL.MsCodeOpServiceDAL; +using System.Text; +using DSWeb.Areas.CommMng.DAL; +using DSWeb.Areas.RptMng.Comm; +using DSWeb.SoftMng.Filter; +using DSWeb.MvcShipping.Models.MsOpPlan; +using DSWeb.MvcShipping.DAL.MsCodeCtnEdi; +using DSWeb.MvcShipping.Models.CodeCtnEdi; +using Renci.SshNet.Common; + +namespace DSWeb.MvcShipping.Controllers +{ + [JsonRequestBehavior] + public class MsOpSaleRptController : Controller + { + public ActionResult Index() + { + return View(); + } + + public ActionResult Edit() + { + return View(); + } + public ActionResult ModifyEdit() + { + return View(); + } + public ActionResult ModifyHisEdit() + { + return View(); + } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + public ContentResult GetDataList(int start, int limit, string sort, string condition) + { + var dataList = MsOpSaleRptDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); + var list = dataList.Skip(start).Take(limit); + var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); + return new ContentResult() { Content = json }; + } + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + public ContentResult GetDataListStr(string sort, string condition) + { + var dataListStr = MsOpSaleRptDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); + var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr }); + return new ContentResult() { Content = json }; + } + + //public ContentResult GetDataListSum(int start, int limit, string sort, string condition) + //{ + // var dataList = MsOpSeaePreDAL.GetDataListSum(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort); + // var list = dataList.Skip(start).Take(limit); + // var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); + // return new ContentResult() { Content = json }; + //} + [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 + public ContentResult GetData(string handle, string condition) + { + MsOpSaleRpt head = null; + if (handle == "edit") + { + head = MsOpSaleRptDAL.GetData(condition); + } + if (head == null) + { + head = new MsOpSaleRpt(); +// head.OP = Convert.ToString(Session["SHOWNAME"]); + // head.CREATEUSER + } + + + var json = JsonConvert.Serialize( + new { Success = true, Message = "查询成功", data = head }); + return new ContentResult() { Content = json }; + } + + + public ContentResult SaveDetail(string body) + { + var bodyList = JsonConvert.Deserialize>(body); + + DBResult result = MsOpSaleRptDAL.SaveDetail(bodyList, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"])); + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + public ContentResult Save(string opstatus, string data) + { + if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + } + // + T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); + var headData = JsonConvert.Deserialize(data); + var isPost = true; + var errorstr = ""; + var iscreatecustno = false; + + ////分公司代码 + //if (headData.CORPID == "" || headData.CORPID == null) + //{ + // headData.CORPID = Convert.ToString(Session["COMPANYID"]); + //} + + //分公司代码 + if (headData.BSNO == "" || headData.BSNO == null) + { + headData.BSNO = "topseaepre" + Guid.NewGuid().ToString().Replace("-",""); + } + + var ct = MsOpSaleRptDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "'"); + if (ct != 0) + { + var jsonRespose = new JsonResponse { Success = false, Message = "主提单号不允许重复!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + // + if (headData.ETD == "") headData.ETD = null; + + string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq"); + // + if (opstatus == "add") + { + headData.DbOperationType = DbOperationType.DbotIns; + // + + headData.CREATEUSER = Convert.ToString(Session["USERID"]);//创建人 + headData.CREATETIME = DateTime.Parse(rq);//创建时间 + headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人 + headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间 + } + else if (opstatus == "edit") + { + headData.DbOperationType = DbOperationType.DbotUpd; + headData.ModelUIStatus = "E"; + // + headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次操作人 + headData.MODIFIEDTIME = DateTime.Parse(rq);//最后一次操作时间 + } + else + { + headData.DbOperationType = DbOperationType.DbotDel; + } + //if (headData.CTNNUM == null) { headData.CTNNUM = 0; } + + + + + if (isPost) + { + var modb = new ModelObjectDB(); + DBResult result = modb.Save(headData); + var BSNO = headData.BSNO; + + + + var jsonRespose = new JsonResponse + { + Success = result.Success, + Message = result.Message, + Data = MsOpSaleRptDAL.GetData("BSNO='" + BSNO + "'") + }; + 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 Delete(string data) + { + if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + } + // + var head = JsonConvert.Deserialize(data); + var BSNO = head.BSNO; + var modb = new ModelObjectDB(); + DBResult result = modb.Delete(head); + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + // + + + public ContentResult DeleteList(string data) + { + if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + } + // + DBResult result = new DBResult(); + var headList = JsonConvert.Deserialize>(data); + if (headList != null) + { + foreach (var enumValue in headList) + { + var modb = new ModelObjectDB(); + result = modb.Delete(enumValue); + } + } + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + + public ContentResult NewData() + { + 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 result = MsOpSaleRptDAL.NewData(Convert.ToString(Session["USERID"])); + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + public ContentResult SubmitAudit() + { + 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 result = MsOpSaleRptDAL.SubmitAudit(Convert.ToString(Session["USERID"])); + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + + public ContentResult LockList(string data,string type="1") + { + if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + } + // + T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); + DBResult result = new DBResult(); + var headList = JsonConvert.Deserialize>(data); + if (headList != null) + { + foreach (var enumValue in headList) + { + if (type == "1") + { + var blUpSQL = " update op_sale_rpt set RPTSTATUS='锁定' where GID='" + enumValue.GID + "'"; + bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); + } + else { + var blUpSQL = " update op_sale_rpt set RPTSTATUS='发布' where GID='" + enumValue.GID + "'"; + bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); + } + } + } + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + + public ContentResult CancelSubList(string data) + { + if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "") + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + } + // + T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); + DBResult result = new DBResult(); + var headList = JsonConvert.Deserialize>(data); + if (headList != null) + { + foreach (var enumValue in headList) + { + var blUpSQL = " update op_sale_rpt set RPTSTATUS='未发布' where GID='" + enumValue.GID + "'"; + bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); + + } + } + + var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } + } + + +} + diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index 55e9bccb..34c05c5e 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -69,6 +69,7 @@ using DSWeb.Areas.MvcShipping.Models.Message.VGM; using DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount; using DSWeb.MvcShipping.DAL.MsCodeCtnEdi; using DSWeb.Areas.MvcShipping.DAL.DJYORDER_CONTRACTNO; +using System.Runtime.Remoting; //using DSWeb.Common.Helper; @@ -16050,7 +16051,7 @@ namespace DSWeb.MvcShipping.Controllers } } - public ContentResult BookShippingOrderList(string data, string type) + public ContentResult BookShippingOrderList(string data, string type,string portype="ALL") { var headData = JsonConvert.Deserialize>(data); var errstr = ""; @@ -16063,13 +16064,38 @@ namespace DSWeb.MvcShipping.Controllers thirdpartyaccount = MsSysThirdPartyAccountDAL.GetData(" THIRDPARTY='大简云'"); var YZOPID = thirdpartyaccount.ACCOUNT; + if (string.IsNullOrEmpty(YZUSERKEY)|| string.IsNullOrEmpty(YZUSERPASS) || string.IsNullOrEmpty(YZOPID)) + { + var jsonRespose2 = new JsonResponse { Success = false, Message ="运踪接口Key和密钥及操作员信息不能为空"}; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + + + } + + var YZCUSTNAME = MsSysParamSetDAL.GetData("PARAMNAME='YZCUSTNAME'").PARAMVALUE; var CarrierList = MsCodeCtnEdiDAL.GetCustList("EDINAME='DJY'", ""); var YZURLS = MsSysParamSetDAL.GetData("PARAMNAME='YZURLS'").PARAMVALUE; + if (string.IsNullOrEmpty(YZURLS)) + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "运踪接口地址不能为空" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + + + } + string YZRTURL = MsSysParamSetDAL.GetData("PARAMNAME='YZRTURL'").PARAMVALUE; string YZRTUSER = MsSysParamSetDAL.GetData("PARAMNAME='YZRTUSER'").PARAMVALUE; string YZRTPSW = MsSysParamSetDAL.GetData("PARAMNAME='YZRTPSW'").PARAMVALUE; + if (string.IsNullOrEmpty(YZRTURL) || string.IsNullOrEmpty(YZRTUSER) || string.IsNullOrEmpty(YZRTPSW)) + { + var jsonRespose2 = new JsonResponse { Success = false, Message = "运踪回推接口Key和密钥及地址信息不能为空" }; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; + + + } + var result = new DBResult(); T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); @@ -16079,51 +16105,78 @@ namespace DSWeb.MvcShipping.Controllers foreach (var enumValue in headData) { - var BSNO = enumValue.BSNO; - var MsOpSeaeYunZongBs = new MsOpSeaeYunZongBsNew(); - MsOpSeaeYunZongBs.BusinessId = enumValue.BSNO; - MsOpSeaeYunZongBs.MBLNO = enumValue.MBLNO; - MsOpSeaeYunZongBs.AlertEmail = YZCUSTNAME; - MsOpSeaeYunZongBs.CARRIER = enumValue.CARRIER; - var carrier = CarrierList.Find(x => x.CTN == enumValue.CARRIER); - if (carrier != null) - { - if (!string.IsNullOrEmpty(carrier.EDICODE)) - MsOpSeaeYunZongBs.CARRIERID = carrier.EDICODE; - else - errstr = errstr + "船公司:" + enumValue.CARRIER + " 没有设置代码"; + if (enumValue.IsBookingYDW && (type == "1")) + { + } else { - errstr = errstr + "船公司:" + enumValue.CARRIER + " 没有设置代码"; - } - MsOpSeaeYunZongBs.YARD = enumValue.YARD; - if (enumValue.PORTLOADID == "CNTAO") - { - var YARD = CarrierList.Find(x => x.CTN == enumValue.YARD); - if (YARD != null) - { - if (!string.IsNullOrEmpty(YARD.EDICODE)) - MsOpSeaeYunZongBs.YardCode = YARD.EDICODE; - else errstr = errstr + "场站:" + enumValue.YARD + " 没有设置代码"; - } - else + var BSNO = enumValue.BSNO; + var MsOpSeaeYunZongBs = new MsOpSeaeYunZongBsNew(); + MsOpSeaeYunZongBs.BusinessId = enumValue.BSNO; + MsOpSeaeYunZongBs.MBLNO = enumValue.MBLNO; + MsOpSeaeYunZongBs.AlertEmail = YZCUSTNAME; + if (type == "1") { - errstr = errstr + "场站:" + enumValue.YARD + " 没有设置代码"; + if (portype == "AFTER" || portype == "ALL") + { + MsOpSeaeYunZongBs.CARRIER = enumValue.CARRIER; + var carrier = CarrierList.Find(x => x.CTN == enumValue.CARRIER); + if (carrier != null) + { + if (!string.IsNullOrEmpty(carrier.EDICODE)) + MsOpSeaeYunZongBs.CARRIERID = carrier.EDICODE; + else + errstr = errstr + "船公司:" + enumValue.CARRIER + " 没有设置代码"; + + } + else + { + errstr = errstr + "船公司:" + enumValue.CARRIER + " 没有设置代码"; + + } + MsOpSeaeYunZongBs.isBook = true; + } + if (portype == "BEFORE" || portype == "ALL") + { + + MsOpSeaeYunZongBs.YARD = enumValue.YARD; + if (enumValue.PORTLOADID == "CNTAO") + { + var YARD = CarrierList.Find(x => x.CTN == enumValue.YARD); + if (YARD != null) + { + if (!string.IsNullOrEmpty(YARD.EDICODE)) + MsOpSeaeYunZongBs.YardCode = YARD.EDICODE; + else errstr = errstr + "场站:" + enumValue.YARD + " 没有设置代码"; + } + else + { + errstr = errstr + "场站:" + enumValue.YARD + " 没有设置代码"; + + } + MsOpSeaeYunZongBs.IsFrontPort = true; + } + else + { + MsOpSeaeYunZongBs.IsFrontPort = false; + } + } + } + else { + MsOpSeaeYunZongBs.CARRIER = enumValue.CARRIER; + MsOpSeaeYunZongBs.CARRIERID = enumValue.CARRIER; + MsOpSeaeYunZongBs.YARD = enumValue.YARD; + MsOpSeaeYunZongBs.YardCode = enumValue.YARD; + MsOpSeaeYunZongBs.isBook = true; + MsOpSeaeYunZongBs.IsFrontPort = true; } - MsOpSeaeYunZongBs.IsFrontPort = true; - } - else - { - MsOpSeaeYunZongBs.IsFrontPort = false; + MsOpSeaeYunZongBsList.Add(MsOpSeaeYunZongBs); } - MsOpSeaeYunZongBs.isBook = true; - - MsOpSeaeYunZongBsList.Add(MsOpSeaeYunZongBs); } if (!string.IsNullOrEmpty(errstr)) { diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSaleRpt/MsOpSaleRptDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSaleRpt/MsOpSaleRptDAL.cs new file mode 100644 index 00000000..3132a1ef --- /dev/null +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSaleRpt/MsOpSaleRptDAL.cs @@ -0,0 +1,559 @@ +using System; +using System.Data; +using System.Data.Common; +using System.Collections.Generic; +using System.Text; +using DSWeb.MvcShipping.Models.MsOpSaleRpt; +using Microsoft.Practices.EnterpriseLibrary.Data; +using DSWeb.EntityDA; +using DSWeb.Areas.CommMng.Models; +using HcUtility.Comm; +using HcUtility.Core; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using DSWeb.MvcShipping.Models.CodeCtnEdi; +using com.sun.tools.@internal.xjc.reader.gbind; + +namespace DSWeb.MvcShipping.DAL.MsOpSaleRptDAL +{ + public class MsOpSaleRptDAL + { + #region Inquery DataList + static public List GetDataList(string strCondition, string userid, string usercode, string companyid, string sort = null) + { + var rangstr = ""; +// GetRangDAStr("index", userid, usercode, companyid); + if (!string.IsNullOrEmpty(rangstr)) + { + if (!string.IsNullOrEmpty(strCondition)) + { + strCondition = strCondition + " and " + rangstr; + } + else + { + strCondition = rangstr; + } + } + // + String strSql = "SELECT [GID],[BSNO],[MBLNO],[CUSTOMERNAME],[ACCDATE],[OP],[SALE],[ETD],[REMARK],[RMBDR],[USDDR],[STLRMBDR],[STLUSDDR],[BALRMBDR],[BALUSDDR],[TTLBALDR],[CREATETIME],[MODIFIEDTIME]" + + ",PLANDATE,RPTSTATUS,(select top 1 showname from [user] where GID=op_sale_rpt.CREATEUSER) as CREATEUSER,(select top 1 showname from [user] where GID=op_sale_rpt.MODIFIEDUSER) as MODIFIEDUSER" + + " FROM op_sale_rpt "; + if (!string.IsNullOrEmpty(strCondition)) + { + strSql += " where " + strCondition; + } + var sortstring = DatasetSort.Getsortstring(sort); + if (!string.IsNullOrEmpty(sortstring)) + { + strSql += " order by " + sortstring; + } + else + { + strSql += " order by ETD desc"; + } + return SetData(strSql); + } + + static public string GetDataListStr(string strCondition, string userid, string usercode, string companyid, string sort = null) + { + var rangstr = ""; + + if (!string.IsNullOrEmpty(rangstr)) + { + if (!string.IsNullOrEmpty(strCondition)) + { + strCondition = strCondition + " and " + rangstr; + } + else + { + strCondition = rangstr; + } + } + // + String strSql = "SELECT [GID],[BSNO],[MBLNO],[CUSTOMERNAME],[ACCDATE],[OP],[SALE],[ETD],[REMARK],[RMBDR],[USDDR],[STLRMBDR],[STLUSDDR],[BALRMBDR],[BALUSDDR],[TTLBALDR],[CREATETIME],[MODIFIEDTIME]" + + ",PLANDATE,RPTSTATUS,(select top 1 showname from [user] where GID=op_sale_rpt.CREATEUSER) as CREATEUSER,(select top 1 showname from [user] where GID=op_sale_rpt.MODIFIEDUSER) as MODIFIEDUSER" + + " FROM op_sale_rpt "; + if (!string.IsNullOrEmpty(strCondition)) + { + strSql += " where " + strCondition; + } + var sortstring = DatasetSort.Getsortstring(sort); + if (!string.IsNullOrEmpty(sortstring)) + { + strSql += " order by " + sortstring; + } + else + { + strSql += " order by ETD desc"; + } + return strSql.ToString(); + } + + static public MsOpSaleRpt GetData(string condition) + { + String strSql = "SELECT [GID],[BSNO],[MBLNO],[CUSTOMERNAME],[ACCDATE],[OP],[SALE],[ETD],[REMARK],[RMBDR],[USDDR],[STLRMBDR],[STLUSDDR],[BALRMBDR],[BALUSDDR],[TTLBALDR],[CREATETIME],[MODIFIEDTIME]" + + ",PLANDATE,RPTSTATUS,(select top 1 showname from [user] where GID=op_sale_rpt.CREATEUSER) as CREATEUSER,(select top 1 showname from [user] where GID=op_sale_rpt.MODIFIEDUSER) as MODIFIEDUSER" + + " FROM op_sale_rpt "; + if (!string.IsNullOrEmpty(condition)) + { + strSql += " where " + condition; + } + var list=SetData(strSql); + if (list.Count > 0) + { + return list[0]; + } + return new MsOpSaleRpt(); + } + + + + + private static List SetData(String strSql) + { + var headList = new List(); + Database db = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + { + while (reader.Read()) + { + MsOpSaleRpt data = new MsOpSaleRpt(); + #region Set DB data to Object + data.GID = Convert.ToString(reader["GID"]); + data.BSNO = Convert.ToString(reader["BSNO"]); + data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]); + data.MBLNO = Convert.ToString(reader["MBLNO"]); + if (reader["ETD"] != DBNull.Value) + data.ETD = Convert.ToDateTime(reader["ETD"]).ToString("yyyy-MM-dd"); + if (reader["PLANDATE"] != DBNull.Value) + data.PLANDATE = Convert.ToDateTime(reader["PLANDATE"]).ToString("yyyy-MM-dd"); + data.RPTSTATUS = Convert.ToString(reader["RPTSTATUS"]); + + data.OP = Convert.ToString(reader["OP"]); + data.ACCDATE = Convert.ToString(reader["ACCDATE"]); + data.SALE = Convert.ToString(reader["SALE"]); + data.REMARK = Convert.ToString(reader["REMARK"]); + if (reader["RMBDR"] != DBNull.Value) + data.RMBDR = Convert.ToDecimal(reader["RMBDR"]); + if (reader["USDDR"] != DBNull.Value) + data.USDDR = Convert.ToDecimal(reader["USDDR"]); + if (reader["STLRMBDR"] != DBNull.Value) + data.STLRMBDR = Convert.ToDecimal(reader["STLRMBDR"]); + if (reader["STLUSDDR"] != DBNull.Value) + data.STLUSDDR = Convert.ToDecimal(reader["STLUSDDR"]); + if (reader["BALRMBDR"] != DBNull.Value) + data.BALRMBDR = Convert.ToDecimal(reader["BALRMBDR"]); + if (reader["BALUSDDR"] != DBNull.Value) + data.BALUSDDR = Convert.ToDecimal(reader["BALUSDDR"]); + if (reader["TTLBALDR"] != DBNull.Value) + data.TTLBALDR = Convert.ToDecimal(reader["TTLBALDR"]); + + data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]); + if (reader["CREATETIME"] != DBNull.Value) + data.CREATETIME = Convert.ToDateTime(reader["CREATETIME"]); + data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]); + if (reader["MODIFIEDTIME"] != DBNull.Value) + data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]); + + + #endregion + headList.Add(data); + } + reader.Close(); + } + return headList; + } + + + #endregion + + static public List GetNewDataList() + { + String strSql = "SELECT *,(select top 1 PLANDATE from op_sale_rpt where BSNO=v_noday_fee.BSNO ORDER BY CREATETIME DESC) PLANDATE FROM v_noday_fee WHERE DATEDIFF([day],STLDATE,GETDATE())>0 "; + + return SetNewData(strSql); + } + private static List SetNewData(String strSql) + { + var headList = new List(); + Database db = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + { + while (reader.Read()) + { + MsOpSaleRpt data = new MsOpSaleRpt(); + #region Set DB data to Object + data.BSNO = Convert.ToString(reader["BSNO"]); + data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]); + data.MBLNO = Convert.ToString(reader["MBLNO"]); + if (reader["ETD"] != DBNull.Value) + data.ETD = Convert.ToDateTime(reader["ETD"]).ToString("yyyy-MM-dd"); + if (reader["PLANDATE"] != DBNull.Value) + data.PLANDATE = Convert.ToDateTime(reader["PLANDATE"]).ToString("yyyy-MM-dd"); + + data.OP = Convert.ToString(reader["OP"]); + data.ACCDATE = Convert.ToString(reader["ACCDATE"]); + data.SALE = Convert.ToString(reader["SALE"]); + if (reader["RMBDR"] != DBNull.Value) + data.RMBDR = Convert.ToDecimal(reader["RMBDR"]); + if (reader["USDDR"] != DBNull.Value) + data.USDDR = Convert.ToDecimal(reader["USDDR"]); + if (reader["STLRMBDR"] != DBNull.Value) + data.STLRMBDR = Convert.ToDecimal(reader["STLRMBDR"]); + if (reader["STLUSDDR"] != DBNull.Value) + data.STLUSDDR = Convert.ToDecimal(reader["STLUSDDR"]); + if (reader["BALRMBDR"] != DBNull.Value) + data.BALRMBDR = Convert.ToDecimal(reader["BALRMBDR"]); + if (reader["BALUSDDR"] != DBNull.Value) + data.BALUSDDR = Convert.ToDecimal(reader["BALUSDDR"]); + if (reader["TTLBALDR"] != DBNull.Value) + data.TTLBALDR = Convert.ToDecimal(reader["TTLBALDR"]); + + + + #endregion + headList.Add(data); + } + reader.Close(); + } + return headList; + } + public static DBResult NewData(string userid) + { + var result = new DBResult(); + + + var headList = GetNewDataList(); + Database db = DatabaseFactory.CreateDatabase(); + + using (var conn = db.CreateConnection()) + { + conn.Open(); + var tran = conn.BeginTransaction(); + + try + { + + var cmdInsert = + db.GetSqlStringCommand( + @"insert into op_sale_rpt ([GID],[BSNO],[MBLNO],[CUSTOMERNAME],[ACCDATE],[OP],[SALE],[ETD],[RMBDR],[USDDR],[STLRMBDR],[STLUSDDR] + ,[BALRMBDR],[BALUSDDR],[TTLBALDR],[CREATEUSER],[CREATETIME],[PLANDATE],[RPTSTATUS]) + values (NEWID(),@BSNO,@MBLNO,@CUSTOMERNAME,@ACCDATE,@OP,@SALE,@ETD,@RMBDR,@USDDR,@STLRMBDR,@STLUSDDR + ,@BALRMBDR,@BALUSDDR,@TTLBALDR,@CREATEUSER,GETDATE(),@PLANDATE,'未发布') "); + + + if (headList!=null&& headList.Count != 0) + { + foreach (var enumValue in headList) { + + cmdInsert.Parameters.Clear(); + db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO); + db.AddInParameter(cmdInsert, "@MBLNO", DbType.String, enumValue.MBLNO); + db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, enumValue.CUSTOMERNAME); + db.AddInParameter(cmdInsert, "@ACCDATE", DbType.String, enumValue.ACCDATE); + db.AddInParameter(cmdInsert, "@OP", DbType.String, enumValue.OP); + db.AddInParameter(cmdInsert, "@SALE", DbType.String, enumValue.SALE); + db.AddInParameter(cmdInsert, "@ETD", DbType.String, enumValue.ETD); + db.AddInParameter(cmdInsert, "@RMBDR", DbType.Decimal, enumValue.RMBDR); + db.AddInParameter(cmdInsert, "@USDDR", DbType.Decimal, enumValue.USDDR); + db.AddInParameter(cmdInsert, "@STLRMBDR", DbType.Decimal, enumValue.STLRMBDR); + db.AddInParameter(cmdInsert, "@STLUSDDR", DbType.Decimal, enumValue.STLUSDDR); + db.AddInParameter(cmdInsert, "@BALRMBDR", DbType.Decimal, enumValue.BALRMBDR); + db.AddInParameter(cmdInsert, "@BALUSDDR", DbType.Decimal, enumValue.BALUSDDR); + db.AddInParameter(cmdInsert, "@TTLBALDR", DbType.Decimal, enumValue.TTLBALDR); + db.AddInParameter(cmdInsert, "@CREATEUSER", DbType.String, userid); + if (enumValue.PLANDATE != null&& enumValue.PLANDATE!="") + db.AddInParameter(cmdInsert, "@PLANDATE", DbType.String, enumValue.PLANDATE); + else + db.AddInParameter(cmdInsert, "@PLANDATE", DbType.String, null); + + db.ExecuteNonQuery(cmdInsert, tran); + + } + } + + + tran.Commit(); + + result.Success = true; + result.Message = "保存成功"; + + return result; + } + catch (Exception e) + { + tran.Rollback(); + + result.Success = false; + result.Message = "保存出现错误,请重试或联系系统管理员"+e.Message; + + return result; + } + } + } + + + + + public static DBResult SubmitAudit(string userid) + { + var result = new DBResult(); + + + Database db = DatabaseFactory.CreateDatabase(); + using (var conn = db.CreateConnection()) + { + conn.Open(); + var tran = conn.BeginTransaction(); + + try + { + + + + var cmdUpdate = + db.GetSqlStringCommand( + @"update op_sale_rpt set RPTSTATUS='发布',MODIFIEDTIME=GETDATE(),MODIFIEDUSER='" + userid + "' where RPTSTATUS='未发布' "); + + + cmdUpdate.Parameters.Clear(); + db.ExecuteNonQuery(cmdUpdate, tran); + + + + tran.Commit(); + } + catch (Exception) + { + tran.Rollback(); + + result.Success = false; + result.Message = "保存出现错误,请重试或联系系统管理员"; + + return result; + } + } + + result.Success = true; + result.Message = "保存成功" + result.Message; + + return result; + } + public static DBResult SaveDetail(List bodyList,string userid, string companyid) + { + var result = new DBResult(); + + + Database db = DatabaseFactory.CreateDatabase(); + using (var conn = db.CreateConnection()) + { + conn.Open(); + var tran = conn.BeginTransaction(); + + try + { + + + + var cmdUpdate = + db.GetSqlStringCommand( + @"update op_sale_rpt set PLANDATE=@PLANDATE,REMARK=@REMARK,MODIFIEDTIME=GETDATE(),MODIFIEDUSER='"+ userid + "' where GID=@GID "); + + if (bodyList != null) + { + foreach (var enumValue in bodyList) + { + + + + cmdUpdate.Parameters.Clear(); + db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.GID); + if (enumValue.PLANDATE=="") + db.AddInParameter(cmdUpdate, "@PLANDATE", DbType.String,null); + else + db.AddInParameter(cmdUpdate, "@PLANDATE", DbType.String, enumValue.PLANDATE); + db.AddInParameter(cmdUpdate, "@REMARK", DbType.String, enumValue.REMARK); + + db.ExecuteNonQuery(cmdUpdate, tran); + + } + } + + + + tran.Commit(); + } + catch (Exception e) + { + tran.Rollback(); + + result.Success = false; + result.Message = "保存出现错误,请重试或联系系统管理员"+e.Message; + + return result; + } + } + + result.Success = true; + result.Message = "保存成功" + result.Message; + + return result; + } + + + #region 判断编码是否有重复 + static public int GetRdCount(string strCondition) + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(" Count(BSNO) AS CT "); + strSql.Append(" from op_seae_pre "); + if (strCondition.Trim() != String.Empty) + { + strSql.Append(" where " + strCondition); + } + var ct=0; + Database db = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + { + while (reader.Read()) + { + + ct = Convert.ToInt16(reader["CT"]); + + } + reader.Close(); + } + return ct; + } + #endregion + + + + + + #region Rang权限范围 + public static string GetRangDAStr(string tb, string userid, string username, string companyid) + { + string str = ""; + var strSql = new StringBuilder(); + strSql.Append("SELECT"); + strSql.Append(" VISIBLERANGE,OPERATERANGE,AUTHORITYID"); + strSql.Append(" from VW_User_Authority"); + strSql.Append(" where [NAME]='modOpOtherList' and USERID='" + userid + "' and ISDELETE=0"); + + string visiblerange = "4"; + string operaterange = "4"; + string AUTHORITYID = ""; + + Database db = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + { + while (reader.Read()) + { + visiblerange = Convert.ToString(reader["VISIBLERANGE"]); + operaterange = Convert.ToString(reader["OPERATERANGE"]); + AUTHORITYID = Convert.ToString(reader["AUTHORITYID"]); + break; + } + reader.Close(); + } + if (visiblerange == "4") + { + str = " (OP='" + username + "' OR CREATEUSER='" + userid + "' OR SALE='" + username + "' OR CUSTSERVICE='" + username + "')"; + } + else if (visiblerange == "3") + { + str = " (OP='" + username + "' OR CREATEUSER='" + userid + "' OR SALE='" + username + "' OR CUSTSERVICE='" + username + "')"; + } + else if (visiblerange == "2") + { + var rangeDa = new RangeDA(); + var deptname = rangeDa.GetDEPTNAME(userid); + str = " (OP in (select showname from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "'))" + + " OR CREATEUSER in (select GID from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')))"; + } + else if (visiblerange == "1") + { + str = " (UPPER(op_other.Corpid)='" + companyid + "' or op_other.SALECORPID='" + companyid + "') "; + } + else if (visiblerange == "5") + { + if (tb == "index") + { + var userstr = new StringBuilder(); + userstr.Append(" select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1"); + Database userdb = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString())) + { + str = ""; + while (reader.Read()) + { + if (str == "") + { + str = " (op_other.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or op_other.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "' "; + } + else + { + str = str + " or op_other.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or op_other.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "'"; + }; + } + str = str + ")"; + reader.Close(); + } + } + else + { + str = " (UPPER(op_other.Corpid)='" + companyid + "') "; + } + + } + else if (visiblerange == "6") + { + if (tb == "index") + { + var opstr = ""; + var userstr = new StringBuilder(); + userstr.Append(" select OPID,(select SHOWNAME from [user] where GID=user_authority_range_op.OPID) SHOWNAME from user_authority_range_op where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1"); + Database userdb = DatabaseFactory.CreateDatabase(); + using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString())) + { + + while (reader.Read()) + { + + + if (opstr == "") + { + opstr = " ('" + Convert.ToString(reader["SHOWNAME"]) + "'"; + } + else + { + opstr = opstr + ",'" + Convert.ToString(reader["SHOWNAME"]) + "'"; + }; + } + + if (opstr != "") opstr = opstr + ")"; + reader.Close(); + } + if (opstr == "") opstr = "('" + username + "')"; + str = " (OP in " + opstr + " or CREATEUSER in " + opstr + " or CUSTSERVICE IN " + opstr + " or SALE IN " + opstr + " )"; + + } + else + { + str = " (UPPER(op_other.Corpid)='" + companyid + "') "; + } + + } + + else if (visiblerange == "0") + { + str = " 1=1 "; + } + return str; + } + #endregion + + + } +} diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs index b03053cd..99e37d2e 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs @@ -39430,7 +39430,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } #endregion } - icount = icount + 1; +// icount = icount + 1; r.WriteLine("UNT+" + icount.ToString() + "+" + bsno + "'"); r.WriteLine("UNZ+" + headData.Count.ToString() + "+" + bsno + "'"); r.Close(); diff --git a/DSWeb/Areas/MvcShipping/Models/MsOpSaleRpt/MsOpSaleRpt.cs b/DSWeb/Areas/MvcShipping/Models/MsOpSaleRpt/MsOpSaleRpt.cs new file mode 100644 index 00000000..be8c42de --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Models/MsOpSaleRpt/MsOpSaleRpt.cs @@ -0,0 +1,136 @@ +using System; +using HcUtility.Core; +using Newtonsoft.Json; + +namespace DSWeb.MvcShipping.Models.MsOpSaleRpt +{ + [JsonObject] + public class MsOpSaleRpt : ModelObjectBillHead + { + #region 属性 + private string _GID = "topseaepre" + Guid.NewGuid().ToString();//业务编号 + /// + /// 业务唯一编号 + /// + [ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)] + public string GID + { + get { return _GID; } + set { _GID = value; } + } + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string BSNO { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string MBLNO{ get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string CUSTOMERNAME { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string ACCDATE { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string OP { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string SALE { get; set; } + [ModelDB] + public string PLANDATE { get; set; } + [ModelDB] + public string RPTSTATUS { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string ETD { get; set; } + [ModelDB] + public string REMARK { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal RMBDR { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal USDDR { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal STLRMBDR { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal STLUSDDR { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal BALRMBDR { get; set; } + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal BALUSDDR { get; set; } + + + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public decimal TTLBALDR { get; set; } + + private string _createuser = ""; + /// + /// 创建人 + /// + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public string CREATEUSER + { + get { return _createuser; } + set { _createuser = value; } + } + + public string CREATEUSERREF { get; set; } + + private DateTime _createtime = DateTime.Now; + /// + /// 创建时间 + /// + [ModelDB(MDBType = ModelDBOprationType.Insert)] + public DateTime CREATETIME + { + get { return _createtime; } + set { _createtime = value; } + } + + private string _modifieduser = ""; + /// + /// 最后一次操作人 + /// + [ModelDB] + public string MODIFIEDUSER + { + get { return _modifieduser; } + set { _modifieduser = value; } + } + public string MODIFIEDUSERREF { get; set; } + + private DateTime _modifiedtime = DateTime.Now; + /// + /// 最后一次操作时间 + /// + [ModelDB] + public DateTime MODIFIEDTIME + { + get { return _modifiedtime; } + set { _modifiedtime = value; } + } + + + #endregion + + public MsOpSaleRpt() + { + TableName = "op_sale_rpt"; + } + + override public string GetBillNoFieldName() + { + return "BSNO"; + } + } + + + + + + +} diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpSaleRpt/Index.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpSaleRpt/Index.aspx new file mode 100644 index 00000000..e61bb8b8 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Views/MsOpSaleRpt/Index.aspx @@ -0,0 +1,33 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/MvcShipping/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + + + + + + + + + + +
+
diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/Index.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/Index.js new file mode 100644 index 00000000..a8f35577 --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/Index.js @@ -0,0 +1,31 @@ +Ext.BLANK_IMAGE_URL = '../../TruckMng/Content/Images/s.gif'; +var panelIndex = null; +Ext.onReady(function () { + Ext.QuickTips.init(); + Ext.form.Field.prototype.msgTarget = 'side'; + + panelIndex = new window.Shipping.MsOpSaleRptIndex({ + layout: 'border' + }); + + var view = new Ext.Viewport({ + layout: 'border', + renderTo: 'viewport', + border: false, + items: [{ + region: 'center', + layout: 'fit', + items: [panelIndex] + }] + }); + + +}); + +function OprationSwap() { + return panelIndex.OprationSwap(); +} + +function AddNewRecord(record) { + panelIndex.AddNewRecord(record); +} diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptIndex.js new file mode 100644 index 00000000..ce73023a --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptIndex.js @@ -0,0 +1,1053 @@ +Ext.namespace('Shipping'); + +Shipping.MsOpSaleRptIndex = function (config) { + Ext.applyIf(this, config); + this.initUIComponents(); + window.Shipping.MsOpSaleRptIndex.superclass.constructor.call(this); +}; + +Ext.extend(Shipping.MsOpSaleRptIndex, Ext.Panel, { + PageSize: 30, + OprationStatus: null, //仅当弹出界面时使用 + SelectedRecord: null, + sqlcontext: '', + selectbsno: '', + sortfield: '', + sortdire: '', + + + initUIComponents: function () { + this.formname = "formMsOpSaleRptIndex"; //页面名称 + //定义数据集 + + this.AMOUNT = 0; + this.REMARK =''; + this.OTREMARK = ''; + this.BsNo = ''; + this.modOpSaleRptAdd =0; + + this.storePLList = Ext.create('Ext.data.Store', { + model: 'MsOpSaleRpt' + }); + + this.storeList = Ext.create('Ext.data.Store', { + pageSize: this.PageSize, + model: 'MsOpSaleRpt', + remoteSort: true, + proxy: { + type: 'ajax', + url: '/MvcShipping/MsOpSaleRpt/GetDataList', + reader: { + id: 'BSNO', + root: 'data', + totalProperty: 'totalCount' + } + } + }); + + Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { + width: 50 + }); + + _thisSaleRpt = this; + + this.Pagenum = Ext.create('Ext.form.field.Number', { + name: 'bottles', + fieldLabel: '每页记录数', + labelAlign: 'right', + value: this.PageSize, + maxValue: 100000, + width: 180, + minValue: 0, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == e.ENTER) { + _this.onRefreshClick(); + } + } + } + }); + + this.initgirdcolums = [{ + sortable: true, + dataIndex: 'GID', + header: '业务编号', + hidden: true, + width: 80 + }, { + sortable: true, + dataIndex: 'BSNO', + header: '业务编号', + hidden: true, + width: 80 + }, { + sortable: true, + dataIndex: 'RPTSTATUS', + header: '状态', + width: 80 + }, { + sortable: true, + dataIndex: 'CUSTOMERNAME', + header: '客户名称', + width: 80 + }, { + sortable: true, + dataIndex: 'MBLNO', + header: '主提单号', + width: 80 + }, { + sortable: true, + dataIndex: 'ACCDATE', + header: '会计期间', + width: 80 + }, { + sortable: true, + dataIndex: 'SALE', + header: '销售', + width: 80 + }, { + sortable: true, + dataIndex: 'ETD', + header: '开船日期', + width: 80 + }, { + sortable: true, + dataIndex: 'REMARK', + header: '备注', + width: 200, //'备注', + editor: { + xtype: 'textfield', + selectOnFocus: true, + enableKeyEvents: true + }, + width: 150 + }, { + sortable: true, + dataIndex: 'PLANDATE', + header: '计划回收时间', + allowBlank: false, + editor: { + xtype: 'datefield', + format: 'Y-m-d', + selectOnFocus: true + }, + renderer: Ext.util.Format.dateRenderer('Y-m-d'), + width: 120 + }, { + sortable: true, + dataIndex: 'RMBDR', + header: 'RMB应收', + width: 80 + }, { + sortable: true, + dataIndex: 'USDDR', + header: 'USD应收', + width: 80 + }, { + sortable: true, + dataIndex: 'STLRMBDR', + header: 'RMB已收', + width: 80 + }, { + sortable: true, + dataIndex: 'STLUSDDR', + header: 'USD已收', + width: 80 + }, { + sortable: true, + dataIndex: 'BALRMBDR', + header: 'RMB未收', + width: 80 + }, { + sortable: true, + dataIndex: 'BALUSDDR', + header: 'USD未收', + width: 80 + }, { + sortable: true, + dataIndex: 'TTLBALDR', + header: '未收合计', + width: 80 + }, { + sortable: true, + dataIndex: 'CREATEUSER', + header: '创建人', + width: 80 + }, { + sortable: true, + dataIndex: 'CREATETIME', + header: '创建日期', + width: 80 + }, { + sortable: true, + dataIndex: 'MODIFIEDUSER', + header: '修改人', + width: 80 + }, { + sortable: true, + dataIndex: 'MODIFIEDTIME', + header: '修改日期', + width: 80 + } + ]; + + this.girdcolums = this.initgirdcolums; + + + this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { + clicksToEdit: 1 + }); + + //定义Grid + this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); + + + this.gridList = new Ext.grid.GridPanel({ + store: this.storeList, + enableHdMenu: false, + region: 'center', + loadMask: { msg: "数据加载中,请稍等..." }, + trackMouseOver: true, + disableSelection: false, + selModel: this.GridCheckBoxModel, + plugins: [this.cellEditing], + + columns: this.girdcolums, + viewConfig: { + enableTextSelection: true, //允许复制数据 + autoFill: true + }, + // paging bar on the bottom + bbar: [Ext.create('Ext.PagingToolbar', { + store: this.storeList, + displayInfo: true, + displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', + emptyMsg: "没有数据" + }), this.Pagenum] + }); + + /////////////以下部分为获取存储的gridpanel显示样式 + this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 + this.girdcolums.unshift(new Ext.grid.RowNumberer()); + this.gridList.reconfigure(this.storeList, this.girdcolums); + //////////////////////////// + + this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) { + //this.SelectedRecord = record; + //this.OprationStatus = 'edit'; + //DsOpenEditWin('/MvcShipping/MsOpOther/Edit', record.data.BSNO); + this.BsNo = record.data.BSNO; + }, this); + + this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { + this.sortfield = column.dataIndex; + this.sortdire = direction; + }, this); + + this.cellEditing.on('beforeedit', function (editor, e) { + return this.cellEditingBeforeEdit(editor, e); + }, this); + + //#region formSearch 查询条件 + + + + + + //客户加载_委托单位 + this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.CustomRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' } + }); +// this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); + //委托单位 + this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '客户名称', + store: this.storeCustCode, + forceSelection: true, + queryMode: 'remote', + minChars: 1, + queryParam: 'CODENAME', + name: 'CUSTOMERNAME', + valueField: 'CustName', + displayField: 'CodeAndName', + enableKeyEvents: true, + listeners: { + //specialkey: function (field, e) { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _thisSaleRpt.onRefreshClick(); + } + } + } + }); + + + this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { + model: 'DsShipping.ux.UserRefModel', + proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } + }); + this.storeOpCode.load(); + this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '销售', //'揽货人', + store: this.storeOpCode, + name: 'SALE', + valueField: 'UserName', + displayField: 'CodeAndName' + }); + + + this.storeRPTSTATUS = Ext.create('Ext.data.Store', { + fields: ['FSTATUS', 'NAME'] + }); + this.storeRPTSTATUS.add({ "FSTATUS": "未发布", "NAME": "未发布"}); + this.storeRPTSTATUS.add({ "FSTATUS": "发布", "NAME": "发布" }); + this.storeRPTSTATUS.add({ "FSTATUS": "锁定", "NAME": "锁定" }); + + this.comboxRPTSTATUS = Ext.create('DsExt.ux.RefTableCombox', { + fieldLabel: '状态', + store: this.storeRPTSTATUS, + valueField: 'FSTATUS', + displayField: 'NAME', + forceSelection: true, + name: 'RPTSTATUS', + value: '', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _thisSaleRpt.onRefreshClick(); + } + } + } + }); + + + + this.formSearch = Ext.widget('form', { + frame: true, + region: 'center', + bodyPadding: 5, + fieldDefaults: { + margins: '2 2 2 2', + labelAlign: 'right', + flex: 1, + labelWidth: 90, + msgTarget: 'qtip' + }, + + items: [{ + xtype: 'container', + defaultType: 'textfield', + layout: 'anchor', + defaults: { + anchor: '100%' + }, + items: [{ + xtype: 'container', + layout: 'hbox', + defaultType: 'textfield', + items: [this.comboxRPTSTATUS,{ + fieldLabel: '从会计期间', + format: 'Y-m', + xtype: 'datefield', + name: 'FRACCDATE', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _thisSaleRpt.onRefreshClick(); + } + } + } + }, { + fieldLabel: '至', + format: 'Y-m', + xtype: 'datefield', + name: 'TOACCDATE', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _thisSaleRpt.onRefreshClick(); + } + } + } + }, this.comboxCustCode,{ + fieldLabel: '主提单号', + name: 'MBLNO', + enableKeyEvents: true, + listeners: { + keyup: function (field, e) { + if (e.getKey() == e.ENTER) { + _thisSaleRpt.onRefreshClick(); + } + } + } + }, this.comboxSALE, { + xtype: 'button', + width: 90, + text: "查询", + iconCls: "btnrefresh", + handler: function (button, event) { + this.onRefreshClick(button, event); + }, + scope: this + }] + }] + }] + }); + //#endregion formSearch + + //查询工具条 + this.panelBtn = new Ext.Panel({ + region: "north", + tbar: [{ + text: '导入', //"EXCEL模板导出", + iconCls: "btnexportexcel", + id: 'btnexportexcel', + + handler: function (button, event) { + _thisSaleRpt.onImportBillClick(); + + }, + scope: this + }, { + text: "删除", + iconCls: "btndelete", + id: 'btndelete', + handler: function (button, event) { + this.onDeleteListClick(button, event); + }, scope: this + }, '-', { + id: 'btnSubmitAudit', + text: '发布', + tooltip: '发布', + handler: function (button, event) { + this.onSubmitAuditClick(); + }, + scope: this + }, '-', { + id: 'btnLock', + text: '锁定', + tooltip: '锁定', + handler: function (button, event) { + this.onLockClick(); + }, + scope: this + }, { + text: "保存", + iconCls: "btnsave", + id: 'btnsave', + + handler: function (button, event) { + this.onPostDetailClick(button, event); + }, + scope: this + }, + '-', { + text: "保存列表样式", + id: "btntest", + menu: [ + { text: "保存", + handler: function (button, event) { + this.girdcolums = DsTruck.SaveGridPanel(USERID, _thisSaleRpt.formname, _thisSaleRpt.gridList.columns, _thisSaleRpt.girdcolums, 1, true); + } + }, { text: "初始化", + handler: function (menu, event) { + _thisSaleRpt.girdcolums = DsTruck.SaveGridPanel(USERID, _thisSaleRpt.formname, _thisSaleRpt.gridList.columns, _thisSaleRpt.initgirdcolums, 1, true); + } + }], + scope: this + }, '-', + { + text: "打印", + iconCls: 'btnprint', + menu: [ + { text: "全部", + handler: function (menu, event) { + _thisSaleRpt.Print(); + } + }, { text: "选择打印", + handler: function (menu, event) { + _thisSaleRpt.PrintSelect(); + } + }], + + scope: this + }, { + text: "导出EXCEL", + handler: function (button, event) { + GridExportExcelPage(_thisSaleRpt.gridList); + + } + }] + }); + + + this.panelTop = new Ext.Panel({ + layout: "border", + region: "north", + height: 65, + items: [this.formSearch, this.panelBtn] + }); + + + + + + + + Ext.apply(this, { + items: [this.panelTop, this.gridList] + }); + + //this.sqlcontext = ""; + + //this.storeList.load({ + // params: { start: 0, limit: this.PageSize, sort: '', condition: _thisSaleRpt.sqlcontext }, + // waitMsg: "正在查询数据...", + // scope: this + //}); + + this.storeList.on('beforeload', function (store) { + Ext.apply(store.proxy.extraParams, { condition: _thisSaleRpt.sqlcontext }); + }, this); + + + + //签单方式 + Ext.Ajax.request({ + waitMsg: '', + url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', + params: { + modulename: "modOpSaleRptAdd" + }, + callback: function (options, success, response) { + if (success) { + var result = Ext.JSON.decode(response.responseText); + if (result.Success != true) { + + var btnEdit = Ext.getCmp('btnexportexcel'); + btnEdit.setVisible(false); + var btnEdit = Ext.getCmp('btndelete'); + btnEdit.setVisible(false); + var btnEdit = Ext.getCmp('btnSubmitAudit'); + btnEdit.setVisible(false); + var btnEdit = Ext.getCmp('btnLock'); + btnEdit.setVisible(false); + var btnEdit = Ext.getCmp('btnsave'); + btnEdit.setVisible(true); + _thisSaleRpt.sqlcontext = " SALE='" + SHOWNAME + "'"; + + } else { + + _thisSaleRpt.modOpSaleRptAdd = 1; + var btnEdit = Ext.getCmp('btnexportexcel'); + btnEdit.setVisible(true); + var btnEdit = Ext.getCmp('btndelete'); + btnEdit.setVisible(true); + var btnEdit = Ext.getCmp('btnSubmitAudit'); + btnEdit.setVisible(true); + var btnEdit = Ext.getCmp('btnLock'); + btnEdit.setVisible(true); + var btnEdit = Ext.getCmp('btnsave'); + btnEdit.setVisible(false); + + } + } else { + + } + }, + scope: this + }); + + + }, //end initUIComponents + + onRefreshClick: function (button, event) { + var sql = this.getCondition(); + this.sqlcontext = sql; + this.PageSize = this.Pagenum.getValue(); + + this.storeList.pageSize = this.PageSize; + this.storeList.load({ + params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, + waitMsg: "正在查询数据...", + scope: this + }); + }, + + onDsQuery: function () { + //var girdcolums = this.gridList.getColumnMode(); + var sql = this.sqlcontext; + this.PageSize = this.Pagenum.getValue(); + + this.storeList.pageSize = this.PageSize; + this.storeList.load({ + params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, + waitMsg: "正在查询数据...", + scope: this + }); + + }, + + + onPostDetailClick: function (button, event) { + + var bodyDrChFeeDatas = []; + var i; + + + for (i = 0; i < this.storeList.getCount(); i += 1) { + var member = this.storeList.getAt(i); + var PLANDATE = member.data.PLANDATE; + if (PLANDATE != '') + PLANDATE = Ext.util.Format.date(PLANDATE, 'Y-m-d'); + member.data.PLANDATE = PLANDATE; + bodyDrChFeeDatas.push(member); + + }; + var jsonChFeeBody = ConvertGIDRecordsToJson(bodyDrChFeeDatas); + + + + Ext.Msg.wait('正在保存数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在保存数据...', + url: '/MvcShipping/MsOpSaleRpt/SaveDetail', + scope: this, + params: { + body: jsonChFeeBody + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + + this.onRefreshClick(); + + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ + title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + }, //end save + + onSubmitAuditClick: function () { + + + Ext.MessageBox.confirm('提示', '确定发布所有未发布的业务吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在提交数据...'); + Ext.Ajax.request({ + waitMsg: '正在提交数据...', + url: '/MvcShipping/MsOpSaleRpt/SubmitAudit', + + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _thisSaleRpt.onRefreshClick(); + Ext.Msg.show({ title: '提示', msg: '发布成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + + }, + onDeleteListClick: function (button, event) { + var selections = this.gridList.getSelectionModel().getSelection(); + if (selections.length == 0) { + Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + var reg = new RegExp("<", "g"); //创建正则RegExp对象 + var stringObj = ""; + var bodyAddDatas = []; + var icount = 0; + for (var i = 0; i < selections.length; i++) { + var rec = selections[i]; + var isdelete = true; + if (rec.data.RPTSTATUS != '未发布') { + Ext.Msg.show({ title: '警告', msg: '已发布,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + isdelete = false; + return; + } + + if (isdelete) { + + bodyAddDatas.push(rec); + icount = icount + 1; + } + } + + + + Ext.MessageBox.confirm('提示', "确实要删除选中的【" + icount.toString() + "】票业务吗?", function (btn) { + if (btn == 'yes') { + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + Ext.Msg.wait('正在删除....'); + Ext.Ajax.request({ + waitMsg: '正在删除....', + url: '/MvcShipping/MsOpSaleRpt/DeleteList', + params: { + data: jsonbodyAddDatas + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _thisSaleRpt.storeList.reload(); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title:'错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title:'警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + + + }, + + onLockClick: function (button, event) { + var selections = this.gridList.getSelectionModel().getSelection(); + if (selections.length == 0) { + Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + var reg = new RegExp("<", "g"); //创建正则RegExp对象 + var stringObj = ""; + var bodyAddDatas = []; + var icount = 0; + for (var i = 0; i < selections.length; i++) { + var rec = selections[i]; + var isdelete = true; + if (rec.data.RPTSTATUS != '发布') { + Ext.Msg.show({ title: '警告', msg: '当前状态不允许锁定!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); + isdelete = false; + return; + } + + if (isdelete) { + + bodyAddDatas.push(rec); + icount = icount + 1; + } + } + + + + Ext.MessageBox.confirm('提示', "确实要锁定选中的【" + icount.toString() + "】票业务吗?", function (btn) { + if (btn == 'yes') { + + var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); + Ext.Msg.wait('正在锁定....'); + Ext.Ajax.request({ + waitMsg: '正在锁定....', + url: '/MvcShipping/MsOpSaleRpt/LockList', + params: { + data: jsonbodyAddDatas + }, + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _thisSaleRpt.storeList.reload(); + Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + + + }, + onClearSql: function () { + var form = this.formSearch.getForm(); + form.reset(); + }, //onDeleteClick + + + //#region EXCEL导入 + + onImportBillClick: function () { + Ext.MessageBox.confirm('提示', '确定引入超期欠费的业务吗?', function (btn) { + if (btn == 'yes') { + Ext.Msg.wait('正在引入数据...'); + Ext.Ajax.request({ + waitMsg: '正在引入数据...', + url: '/MvcShipping/MsOpSaleRpt/NewData', + callback: function (options, success, response) { + if (success) { + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + _thisSaleRpt.onRefreshClick(); + Ext.Msg.show({ title: '提示', msg: '引入成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + } + else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } + }, + failure: function (response, options) { + Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + }, + success: function (response, options) { + }, + scope: this + }); //end Ext.Ajax.request + } + }, this); + }, + + //#endregion + cellEditingBeforeEdit: function (editor, e) { + + var RPTSTATUS = e.record.get('RPTSTATUS'); + var canedit = true; + if (RPTSTATUS!= '发布') { + Ext.Msg.show({ title:'提示', msg:'当前状态不允许修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改! + canedit = false; + } + return canedit; + + }, + getCondition: function () { + var form = this.formSearch.getForm(); + if (!form.isValid()) { + Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); + return ''; + } + + var sql = ''; + + if (_thisSaleRpt.modOpSaleRptAdd == '0') { + sql = " SALE='" + SHOWNAME + "'" + } + + + var MBLNO = form.findField('MBLNO').getValue(); + sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'"); + + + //会计期间 + var FRACCDATE = form.findField('FRACCDATE').getRawValue(); + sql = sql + getAndConSql(sql, FRACCDATE, "(ACCDATE>='" + FRACCDATE + "' OR OLDACCDATE>='" + FRACCDATE + "')"); + + var TOACCDATE = form.findField('TOACCDATE').getRawValue(); + sql = sql + getAndConSql(sql, TOACCDATE, "(ACCDATE<='" + TOACCDATE + "' OR OLDACCDATE<='" + TOACCDATE + "')"); + + + var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); + sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'"); + + var SALE = form.findField('SALE').getValue(); + sql = sql + getAndConSql(sql, SALE, "SALE= '" + SALE + "'"); + + var RPTSTATUS = form.findField('RPTSTATUS').getValue(); + sql = sql + getAndConSql(sql, RPTSTATUS, "RPTSTATUS= '" + RPTSTATUS + "'"); + + + + + return sql; + }, + OprationSwap: function () { + var ret = new Array(); + ret[0] = this.OprationStatus; + ret[1] = this.storeList; + ret[2] = this.SelectedRecord; + ret[3] = this.selectbsno; + ret[4] = 'op_plan'; + ret[5] = this.storePLList; + return ret; + }, + onExportClick: function (button, event) { + + if (this.storeList.getCount() == 0) { + return; + } + + var sortstr = ''; + + Ext.Msg.wait('正在组织数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在组织数据...', + url: '/MvcShipping/MsOpSaleRpt/GetDataListStr', + //(int start, int limit, string sort, string condition, int billtype) + scope: this, + params: { + start: 0, + limit: 10000000, + sort: sortstr, + condition: _thisSaleRpt.sqlcontext, + billtype: 0 + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnstr = jsonresult.data; + var condition = jsonresult.Message; + if (condition != '') condition = ' where ' + condition; + var sql1 = returnstr; + sql1 = sql1.replace(/\+/g, "@@@") + if (sql1 != '') { + + GridExportBySql(sql1, this.formname, '收费计划列表.xls'); + } + + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ + title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + }, + + Print: function () { + + if (this.storeList.getCount() == 0) { + return; + } + + Ext.Msg.wait('正在组织数据, 请稍侯..'); + Ext.Ajax.request({ + waitMsg: '正在组织数据...', + url: '/MvcShipping/MsOpSaleRpt/GetDataListStr', + scope: this, + params: { + condition: _thisSaleRpt.sqlcontext, + printstr: 'true' + }, + callback: function (options, success, response) { + if (success) { + Ext.MessageBox.hide(); + var jsonresult = Ext.JSON.decode(response.responseText); + if (jsonresult.Success) { + var returnstr = jsonresult.data; + var printType = 'MSOPPLANLIST'; + var sql1 = returnstr; + var sql2 = ""; + var sql3 = ""; + var sql4 = ""; + var sql5 = ""; + var sql6 = ""; + + PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); + + } else { + Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); + } + } else { + Ext.Msg.show({ title: '请重试', + msg: '服务器响应出错', + icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK + }); + } + } + }); + }, + + + PrintSelect: function () { + + + if (this.storeList.getCount() == 0) { + return; + } + var selectedRecords = []; + var storeadd = null; + selectedRecords = this.GridCheckBoxModel.selected.items; + + + if (selectedRecords.length == 0) { + Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + return; + } + + var sortstr = ''; + + if (this.sortfield != '' && this.sortdire != '') { + + sortstr = this.sortfield + ' ' + this.sortdire; + } + + if (sortstr == "") sortstr = "SFNO " + + var feeGidSql = ''; + for (var i = 0; i < selectedRecords.length; i++) { + var record = selectedRecords[i]; + var feeGId = "'" + record.get('BSNO') + "'"; + if (feeGidSql == '') { + feeGidSql = feeGId; + } else { + feeGidSql = feeGidSql + "," + feeGId; + } + }; + + var bsno = '11111'; + var selections = this.gridList.getSelectionModel().getSelection(); + if (selections.length != 0) { + var record = selections[0]; + bsno = record.data.BSNO; + } + + var printType = 'MSOPPLANLISTSELECT'; + var sql1 = "select * from op_salerpt WHERE BSNO IN (" + feeGidSql + ") order by " + sortstr; + var sql2 = "select * from op_plan where BSNO='" + bsno + "'"; + var sql3 = ""; + var sql4 = ""; + var sql5 = ""; + var sql6 = ""; + + PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); + } +}); + + diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptModel.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptModel.js new file mode 100644 index 00000000..8f466f0c --- /dev/null +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSaleRpt/MsOpSaleRptModel.js @@ -0,0 +1,30 @@ +Ext.define('MsOpSaleRpt', { + extend: 'Ext.data.Model', + idProperty: 'GID', + fields: [ + { name: 'GID', type: 'string' }, // 业务编号 + { name: 'BSNO', type: 'string' }, // 业务编号 + { name: 'MBLNO', type: 'string' }, + { name: 'CUSTOMERNAME', type: 'string' }, // 委托单位 + { name: 'ACCDATE', type: 'string' }, // 会计期间 + { name: 'ETD', type: 'string' }, + { name: 'SALE', type: 'string' }, // 揽货人 + { name: 'PLANDATE', type: 'string' }, // + { name: 'RPTSTATUS', type: 'string' }, // + { name: 'REMARK', type: 'string' }, + { name: 'RMBDR', type: 'number' }, // + { name: 'RMBCR', type: 'number' }, // + { name: 'STLRMBDR', type: 'number' }, // + { name: 'STLRMBCR', type: 'number' }, // + { name: 'BALRMBDR', type: 'number' }, // + { name: 'BALRMBCR', type: 'number' }, // + { name: 'TTLBALDR', type: 'number' }, // + { name: 'CREATEUSER', type: 'string' }, // 创建人 + { name: 'CREATEUSERREF', type: 'string' }, // 创建人 + { name: 'CREATETIME', type: 'string' }, // 创建时间, dateFormat: 'Y-m-d H:i:s' + { name: 'MODIFIEDUSER', type: 'string' }, // 最后一次操作人 + {name: 'MODIFIEDTIME', type: 'string' } + + ] +}); + diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js index 6286b96f..e0ab3c6e 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js @@ -3001,14 +3001,24 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { text: '运踪订阅', //"退舱", menu: [ { - text: '确认订阅', //"确认退舱", + text: '确认订阅(港前+港后)', //"确认退舱", handler: function (menu, event) { - _this.onBookShippingOrderClick('1'); + _this.onBookShippingOrderClick('1','ALL'); + } + }, { + text: '确认订阅(仅港前)', //"确认退舱", + handler: function (menu, event) { + _this.onBookShippingOrderClick('1','BEFORE'); + } + }, { + text: '确认订阅(仅港后)', //"确认退舱", + handler: function (menu, event) { + _this.onBookShippingOrderClick('1', 'AFTER'); } }, { text: '取消订阅', //"取消退舱", handler: function (menu, event) { - _this.onBookShippingOrderClick('0'); + _this.onBookShippingOrderClick('0','ALL'); } }] } @@ -16519,7 +16529,7 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { this.PluginCover.loadCoverWithBSNO(bsno); }, - onBookShippingOrderClick: function (type) { + onBookShippingOrderClick: function (type,porttype) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianXuanZeYeWu, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //请先选择要退舱的业务 @@ -16570,7 +16580,8 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { url: '/MvcShipping/MsOpSeae/BookShippingOrderList', params: { data: jsonbodyAddDatas, - type: type + type: type, + portype: porttype }, callback: function (options, success, response) { if (success) { diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsRptLhRptList/MsRptLhRptListIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsRptLhRptList/MsRptLhRptListIndex.js index be1984c5..302dde10 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsRptLhRptList/MsRptLhRptListIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsRptLhRptList/MsRptLhRptListIndex.js @@ -1384,7 +1384,7 @@ Ext.extend(Shipping.MsRptLhRptListIndex, Ext.Panel, { remoteSort: true, proxy: { type: 'ajax', - timeout: 120000, + timeout: 1200000, url: '/MvcShipping/MsRptLhRptList/LhRptListBsData', reader: { id: '', @@ -1608,6 +1608,8 @@ Ext.extend(Shipping.MsRptLhRptListIndex, Ext.Panel, { sortable: true, dataIndex: 'HKDAYS', text: '实际收款结算天数', + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, + //text:'业务来源', width: 120 @@ -1615,6 +1617,8 @@ Ext.extend(Shipping.MsRptLhRptListIndex, Ext.Panel, { sortable: true, dataIndex: 'HKDAYSCR', text: '实际付款结算天数', + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, + //text:'业务来源', width: 120 @@ -1622,6 +1626,8 @@ Ext.extend(Shipping.MsRptLhRptListIndex, Ext.Panel, { sortable: true, dataIndex: 'ZYDAYS', text: '实际资金占用天数', + renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; }, + //text:'业务来源', width: 120 diff --git a/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs b/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs index 2fd2f770..25c0a4e2 100644 --- a/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs +++ b/DSWeb/Areas/TruckMng/Controllers/PcHeadEdit_WFSDController.cs @@ -380,7 +380,7 @@ namespace DSWeb.Areas.TruckMng.Controllers } } - if (string.IsNullOrEmpty(headData.BillNo)) + if (string.IsNullOrEmpty(headData.BillNo)|| headData.BillNo=="*") { var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运'", Convert.ToString(Session["COMPANYID"])); billnoset.BILLTYPE = "0111"; diff --git a/DSWeb/DSWeb.csproj b/DSWeb/DSWeb.csproj index ca55b6b5..dec33064 100644 --- a/DSWeb/DSWeb.csproj +++ b/DSWeb/DSWeb.csproj @@ -2495,6 +2495,9 @@ + + + @@ -3678,6 +3681,7 @@ + @@ -8413,6 +8417,7 @@ + @@ -8461,6 +8466,7 @@ + @@ -8521,6 +8527,7 @@ +