You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Controllers/MsOp_BLISSUEController.cs

2707 lines
93 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using System.IO;
using System.Data;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.MvcShipping.DAL.MsOp_BLISSUE;
using DSWeb.MvcShipping.Models.MsOp_BLISSUE;
using DSWeb.Areas.OA.Models.WorkFlow;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
namespace DSWeb.MvcShipping.Controllers
{
/// <summary>
/// 提单签发管理
/// </summary>
[JsonRequestBehavior]
public class MsOp_BLISSUEController : Controller
{
//
// GET: /RptMng/MsRptPcHeadQry
public ActionResult Index()
{
return View();
}
public ActionResult Index_SP ( )
{
return View();
}
public ActionResult DsIndex()
{
return View();
}
public ActionResult Edit_SP ( )
{
return View();
}
public ActionResult DeptArrears ( )
{
return View();
}
public ActionResult DeptArrearsDetail ( )
{
return View();
}
#region 提单签发
public ContentResult GetDataList ( int start, int limit, string sort, string condition )
{
var recordcount = 0;
var dataList = MsOp_BLISSUEDAL.GetDataList(condition, start,limit,out recordcount, sort, Convert.ToString(Session["COMPANYID"]));
//var list = dataList.Skip(0).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = recordcount, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition)
{
var dataListStr = MsOp_BLISSUEDAL.GetDataListStr(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = dataListStr.Message, data = dataListStr.Data });
return new ContentResult() { Content = json };
}
public ContentResult SaveList ( string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
foreach (var _d in dataList){
/*
if ( !string.IsNullOrEmpty(_d.ExpDate)){
_d.ExpDate = _d.ExpDate.Replace("T", " ");
}
if ( !string.IsNullOrEmpty(_d.EndPortDate))
{
_d.EndPortDate = _d.EndPortDate.Substring(0, 10);
}
if (!string.IsNullOrEmpty(_d.OrgCode))
{
_d.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
}*/
if (_d.GID == "" || _d.GID == "*")
{
_d.DbOperationType = DbOperationType.DbotIns;
_d.ModelUIStatus = "I";
_d.GID = PubSysDAL.GetBillNo("0404"); //获取合同号
}
else
{
_d.DbOperationType = DbOperationType.DbotUpd;
_d.ModelUIStatus = "E";
}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEmb>.ToModelObjectList(dataList);
//var _DL = ModelObjectConvert<MsWlPcHead_ADLEdit>.ToModelObjectList(DeldataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
private List<MsOp_BLISSUEmb> SaveList_P ( string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
var DoDataList=new List<MsOp_BLISSUEmb>();
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
foreach (var _d in dataList)
{
//var CT = T_ALL_DA.GetStrSQL("CT", "SELECT COUNT(*) CT FROM op_blissue WHERE BSNO='" + _d.BSNO+ "'");
//if (Convert.ToInt32(CT) == 0)
//{
// var blUpSQL = " insert into Op_BLISSUE([GID],[BSNO],[BLNO],[ISSUETYPE],[OPNAME],[OPTIME]) SELECT NEWID(),BSNO,MBLNO,ISSUETYPE,'"+ Session["SHOWNAME"].ToString() + "',GETDATE() FROM v_op_blissue_bill WHERE BSNO='"+ _d.BSNO + "'";
// bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
//}
//else
//{
// var blUpSQL = " update Op_BLISSUE SET OPTIME=GETDATE(),OPNAME='"+ Session["SHOWNAME"].ToString() + "',BLNO='"+_d.MBLNO+"' where BSNO='"+ _d.BSNO + "'";
// bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
//}
// var _data = MsOp_BLISSUEDAL.GetData(" B.BSNO='" + _d.BSNO + "' and isnull(B.MBLNO,'')<>'' ");
var _data = MsOp_BLISSUEDAL.GetData(" B.BSNO='" + _d.BSNO + "' ");
if (string.IsNullOrEmpty(_data.GID))
{
_data.DbOperationType = DbOperationType.DbotIns;
_data.ModelUIStatus = "I";
_data.GID = PubSysDAL.GetBillNo("0404"); //获取合同号
_data.PAYRMB = "0";
_data.PAYUSD = "0";
_data.OPTIME = System.DateTime.Now.ToString();
_data.OPNAME = Session["SHOWNAME"].ToString();
DoDataList.Add(_data);
}
else
{
_data.DbOperationType = DbOperationType.DbotUpd;
_data.ModelUIStatus = "E";
_data.OPTIME = System.DateTime.Now.ToString();
_data.OPNAME = Session["SHOWNAME"].ToString();
if (_d.BLNO != "")
_data.BLNO = _d.BLNO; //防止发生提单号变化
DoDataList.Add(_data);
}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEmb>.ToModelObjectList(DoDataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
return DoDataList;
}
public ContentResult Delete ( string data )
{
var head = JsonConvert.Deserialize<MsOp_BLISSUEListmb>(data);
var canbedel = (head.BLSTATUS == "录入状态" || head.BLSTATUS == "" || head.BLSTATUS == "驳回提交");
if (canbedel==false)
{
var jsonRespose = new JsonResponse { Success = false, Message = "只有录入状态/驳回提交下的特放申请才能删除!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var modb = new ModelObjectDBBill();
DBResult result = modb.Delete(head,
"delete from Op_blissuelist_detail where LINKGID='" + head.GID + "'");
//MsSysBillNoSetDAL.DeleteBsNo(head.BillNo);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
#endregion
public ContentResult GetBLListData(int start, int limit, string sort, string condition)
{
var dataList = MsOp_BLISSUEDAL.GetBillDataList(start, limit, condition, sort);
int count = MsOp_BLISSUEDAL.getTotalCount(condition);
// var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#region 部门额度
public ContentResult DeptARREARSListData(int start, int limit, string condition, string sort, string printstr)
{
var strSql = new StringBuilder();
strSql.Append("SELECT *,(MAXARREARS-DEPTTTLDR) DEPTTTLNODR from ");
strSql.Append("SELECT [GID],[DEPT],[MAXARREARS],[COMPANYID],[CREATEUSER],[CREATETIME],[REMARKS]");
strSql.Append(",isnull((select sum(TTLDR-STLTTLDR) from v_op_gain_sum where EXISTS (select 1 from v_op_blissuelist_Detail bl");
strSql.Append("where v_op_gain_sum.BSNO=bl.bsno and bl.BLSTATUS='审核通过' and bl.MNGBLSTATUS<>'审核通过' AND SALEDEPT=ob.DEPT and ");
strSql.Append("not exists (select 1 from v_op_seae_iscargo i where bl.customername=i.customername))),0) AS DEPTTTLDR");
strSql.Append(" FROM [SYS_DEPT_ARREARS] ob ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" Where " + condition);
}
strSql.Append(") as DP ");
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 DeptARREARSDetailListData(int start, int limit, string condition, string sort, string printstr)
{
var strSql = new StringBuilder();
strSql.Append("SELECT b.[BSNO],[GID],[LINKGID],[BLSTATUS],[OPNAME],[OPTIME],b.[CUSTOMERNAME],b.[SALEDEPT],[MNGBLSTATUS],(g.TTLDR-g.STLTTLDR) DEPTTTLNODR");
strSql.Append(",op.MBLNO,OP.ETD");
strSql.Append("FROM [v_op_blissuelist_Detail] b left join v_op_gain_sum g on (g.bsno=b.bsno) ");
strSql.Append("left join v_op_blissue_bill op on (op.BSNO=b.bsno) where b.BLSTATUS='审核通过' and b.MNGBLSTATUS<>'审核通过' ");
strSql.Append(" and not exists (select 1 from v_op_seae_iscargo i where b.customername=i.customername) ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" and " + condition);
}
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 GetSPList ( int start, int limit, string sort, string condition )
{
var dataList = new List<MsOp_BLISSUEListmb>();
var rangstr = MsOp_BLISSUEDAL.GetSPRangDAStr("OpBlSpList", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
if (!string.IsNullOrEmpty(rangstr))
{
if (!string.IsNullOrEmpty(condition))
{
condition = condition + " and " + rangstr;
}
else
{
condition = rangstr;
}
}
var SPISCUSTBAL = MsSysParamSetDAL.GetData("PARAMNAME='SPISCUSTBAL'");
if (SPISCUSTBAL.PARAMVALUE == "1")
{
dataList = MsOp_BLISSUEDAL.GetSPCustList(start, limit, condition, sort);
} else dataList = MsOp_BLISSUEDAL.GetSPList(start, limit, condition, sort);
int count = MsOp_BLISSUEDAL.getSpTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetSPData ( string handle, string condition )
{
MsOp_BLISSUEListmb head = null;
var list = new List<MsOp_BLISSUEListmb>();
var SPISCUSTBAL = MsSysParamSetDAL.GetData("PARAMNAME='SPISCUSTBAL'");
if (SPISCUSTBAL.PARAMVALUE == "1")
{
list = MsOp_BLISSUEDAL.GetSPCustList(0, 1, condition, "");
} else
list = MsOp_BLISSUEDAL.GetSPList(0,1,condition,"");
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new MsOp_BLISSUEListmb();
}
if (handle == "add")
{
head.OPNAME = Convert.ToString(Session["SHOWNAME"]);
head.OPTIME = System.DateTime.Now.ToShortDateString();
head.GID = "";
head.BLSTATUS = "录入状态";
head.MNGBLSTATUS = "录入状态";
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult SaveSPList ( string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
foreach (var _d in dataList)
{
/*
if ( !string.IsNullOrEmpty(_d.ExpDate)){
_d.ExpDate = _d.ExpDate.Replace("T", " ");
}
if ( !string.IsNullOrEmpty(_d.EndPortDate))
{
_d.EndPortDate = _d.EndPortDate.Substring(0, 10);
}
if (!string.IsNullOrEmpty(_d.OrgCode))
{
_d.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
}*/
if (_d.GID == "" || _d.GID == "*")
{
_d.DbOperationType = DbOperationType.DbotIns;
_d.ModelUIStatus = "I";
_d.GID = PubSysDAL.GetBillNo("0404"); //获取合同号
}
else
{
_d.DbOperationType = DbOperationType.DbotUpd;
_d.ModelUIStatus = "E";
}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEmb>.ToModelObjectList(dataList);
//var _DL = ModelObjectConvert<MsWlPcHead_ADLEdit>.ToModelObjectList(DeldataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
private List<MsOp_BLISSUEmb> SaveList_SP ( string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
var DoDataList = new List<MsOp_BLISSUEmb>();
foreach (var _d in dataList)
{
var _data = MsOp_BLISSUEDAL.GetData(" B.BSNO='" + _d.BSNO + "' and isnull(B.MBLNO,'')<>'' ");
if (_data.GID == "")
{
_d.DbOperationType = DbOperationType.DbotIns;
_d.ModelUIStatus = "I";
_d.GID = PubSysDAL.GetBillNo("0404"); //获取合同号
_d.PAYRMB = "0";
_d.PAYUSD = "0";
_d.OPTIME = System.DateTime.Now.ToString();
_d.OPNAME = Session["SHOWNAME"].ToString();
DoDataList.Add(_d);
}
else
{
_data.DbOperationType = DbOperationType.DbotUpd;
_data.ModelUIStatus = "E";
_data.OPTIME = System.DateTime.Now.ToString();
_data.OPNAME = Session["SHOWNAME"].ToString();
_data.BLNO = _d.BLNO; //防止发生提单号变化
DoDataList.Add(_data);
}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEmb>.ToModelObjectList(DoDataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
return DoDataList;
}
public ContentResult DeleteSP ( string data )
{
var head_0 = JsonConvert.Deserialize<MsOp_BLISSUEListmb>(data);
var head = new MsOp_BLISSUEListmb();
var list = MsOp_BLISSUEDAL.GetSPList(0,1," ob.GID='" + head_0.GID + "' ", "");
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new MsOp_BLISSUEListmb();
}
var canbedel = (head.BLSTATUS == "录入状态" || head.BLSTATUS == "驳回提交");
if (canbedel == false)
{
var jsonRespose = new JsonResponse { Success = false, Message = "只有录入状态下的特殊放单才能删除!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var modb = new ModelObjectDBBill();
DBResult result = modb.Delete(head,
"delete from Op_blissuelist_Detail where BSNO='" + head.GID + "'");
//MsSysBillNoSetDAL.DeleteBsNo(head.BillNo);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SaveSP (string opstatus, string data )
{
var headData = JsonConvert.Deserialize<MsOp_BLISSUEListmb>(data);
var isPost = true;
var errorstr = "";
var isuse = false;
var iscreatecustno = false;
var custno = "";
headData.OPNAME = Session["SHOWNAME"].ToString();
headData.OPTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
if (opstatus=="add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.ModelUIStatus = "I";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='特殊放单申请'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
else
{
var jsonRespose = new JsonResponse
{
Success = false,
Message = "没有 特殊放单申请 的编码规则!"
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
if (headData.GID == "")
{
if (isuse)
{
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, System.DateTime.Now.ToString(), System.DateTime.Now.ToString(), "", headData.OPNAME);//headData.OP
iscreatecustno = true;
headData.GID = custno;
}
}
else
{
var ct = MsOp_BLISSUEDAL.GetRdCount(" GID='" + headData.GID + "' ");
if (ct != 0)
{
isPost = false;
errorstr = "特殊放单申请编号";
}
}
//headData.GID = PubSysDAL.GetBillNo("0405"); //获取合同号
headData.BLSTATUS = "录入状态";
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_SEAE WHERE CUSTOMERNAME='"+headData.CUSTOMERNAME+"' AND DATEDIFF([day],ISNULL(OP_SEAE.STLDATE,OP_SEAE.ETD),GETDATE())>0 ");
if (BLCOUNT == "0")
{
headData.ISCHAOQI = "否";
}
else {
headData.ISCHAOQI = "是";
};
var result = new DBResult();
var modb = new ModelObjectRepository();
result = modb.Save(headData);
//刷新父窗口上的父节点
if (isPost)
{
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + headData.GID + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
if (iscreatecustno == true)
MsSysBillNoSetDAL.DeleteBsNo(custno);
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult GetSPDetail ( int start, int limit, string sort, string condition )
{
var dataList = MsOp_BLISSUEDAL.GetSPDetail(condition,start,limit, sort);
var list = dataList.Skip(0).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#region 提交 审核
public ContentResult SP_Start ( string USERID, string data ) //申请签入
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "录入状态" || _p.BLSTATUS == "驳回提交")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var SHOWNAME = Convert.ToString(Session["SHOWNAME"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SP_Start(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SP_StartSave(string opstatus,string USERID, string data) //申请签入
{
var headData = JsonConvert.Deserialize<MsOp_BLISSUEListmb>(data);
var isPost = true;
var errorstr = "";
var isuse = false;
var iscreatecustno = false;
var custno = "";
headData.OPNAME = Session["SHOWNAME"].ToString();
headData.OPTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.ModelUIStatus = "I";
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='特殊放单申请'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
isuse = true;
else
{
var jsonRespose2 = new JsonResponse
{
Success = false,
Message = "没有 特殊放单申请 的编码规则!"
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
if (headData.GID == "")
{
if (isuse)
{
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, System.DateTime.Now.ToString(), System.DateTime.Now.ToString(), "", headData.OPNAME);//headData.OP
iscreatecustno = true;
headData.GID = custno;
}
}
else
{
var ct = MsOp_BLISSUEDAL.GetRdCount(" GID='" + headData.GID + "' ");
if (ct != 0)
{
isPost = false;
errorstr = "特殊放单申请编号";
}
}
//headData.GID = PubSysDAL.GetBillNo("0405"); //获取合同号
headData.BLSTATUS = "录入状态";
}
else
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_SEAE WHERE CUSTOMERNAME='" + headData.CUSTOMERNAME + "' AND DATEDIFF([day],ISNULL(OP_SEAE.STLDATE,OP_SEAE.ETD),GETDATE())>0 ");
if (BLCOUNT == "0")
{
headData.ISCHAOQI = "否";
}
else
{
headData.ISCHAOQI = "是";
};
var result = new DBResult();
var modb = new ModelObjectRepository();
result = modb.Save(headData);
var _L = new List<MsOp_BLISSUEListmb>();
if (headData.BLSTATUS == "录入状态" || headData.BLSTATUS == "驳回提交")
{
_L.Add(headData);
}
else
{
}
var jsonRespose = new JsonResponse();
//var SHOWNAME = Convert.ToString(Session["SHOWNAME"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SP_Start(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SP_Back ( string USERID, string data ) //申请签入_撤回
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "提交审核")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SP_Back(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SP_AuditBack ( string USERID, string data, string REASON ) //申请签入_撤回
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提交审核" || _p.BLSTATUS == "审核通过")
{
_L.Add(_p);
}
else
{
//_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SP_AuditBack(_L, USERID, REASON);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以驳回的特殊放单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SP_Audit ( string USERID, string data ,string REASON) //申请签入_准许签入
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "提交审核")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SP_Audit(_L, USERID, REASON);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 特放复核
public ContentResult MNGSP_AuditBack(string USERID, string data) //申请签入_撤回
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.MNGBLSTATUS == "审核通过")
{
_L.Add(_p);
}
else
{
//_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.MNGSP_AuditBack(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以驳回的特殊放单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult MNGSP_Audit(string USERID, string data) //申请签入_准许签入
{
var _r1 = JsonConvert.Deserialize<List<MsOp_BLISSUEListmb>>(data);
var _L = new List<MsOp_BLISSUEListmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "审核通过")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.MNGSP_Audit(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + _L[0].GID + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 加入特殊放单
public ContentResult ADDSP ( string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
var DoDataList = new List<MsOp_BLISSUEListmb>();
foreach (var _d in dataList)
{
//var _data = MsOp_BLISSUEDAL.GetData(" vb.BSNO='" + _d.BSNO + "' and isnull(vb.MBLNO,'')<>'' ");
var _SPDate = new MsOp_BLISSUEListmb();
//if (_data.GID == "")
//{
_SPDate.DbOperationType = DbOperationType.DbotIns;
_SPDate.ModelUIStatus = "I";
_SPDate.BLSTATUS = "录入状态";
_SPDate.GID = System.Guid.NewGuid().ToString();
_SPDate.BSNO = _d.BSNO;
_SPDate.OPNAME = Session["SHOWNAME"].ToString();
_SPDate.OPTIME = System.DateTime.Now.ToString();
_SPDate.DELFLAG = "0";
DoDataList.Add(_SPDate);
/*}
//else
{
_data.DbOperationType = DbOperationType.DbotUpd;
_data.ModelUIStatus = "E";
_data.OPTIME = System.DateTime.Now.ToString();
_data.OPNAME = Session["SHOWNAME"].ToString();
_data.BLNO = _d.BLNO; //防止发生提单号变化
*/
//DoDataList.Add(_data);
//}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEListmb>.ToModelObjectList(DoDataList);
var modb = new ModelObjectRepository();
result = modb.SaveHead(_L);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult ADDSP2 ( string LINKGID, string data )
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
var DoDataList = new List<MsOp_BLISSUEList_Detailmb>();
var DoDataListDel = new List<MsOp_BLISSUEList_Detailmb>();
var headdata = MsOp_BLISSUEDAL.GetSPData(" ob.GID='" + LINKGID + "' ");
headdata.DbOperationType = DbOperationType.DbotUpd;
headdata.ModelUIStatus = "E";
foreach (var _d in dataList)
{
//var _data = MsOp_BLISSUEDAL.GetData(" vb.BSNO='" + _d.BSNO + "' and isnull(vb.MBLNO,'')<>'' ");
var _SPDate = new MsOp_BLISSUEList_Detailmb();
//if (_data.GID == "")
//{
_SPDate.DbOperationType = DbOperationType.DbotIns;
//_SPDate.ModelUIStatus = "I";
_SPDate.GID = System.Guid.NewGuid().ToString();
_SPDate.LINKGID = "";
_SPDate.BSNO = _d.BSNO;
DoDataList.Add(_SPDate);
headdata.CUSTOMERNAME = _d.CUSTOMERNAME;
headdata.STLNAME = _d.STLNAME;
headdata.SALE = _d.SALE;
if (headdata.SALEDEPT==""){
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var strDEPT = T_ALL_DA.GetStrSQL("DEPTNAME", "select top 1 DEPTNAME from VW_user where SHOWNAME='" +_d.SALE+ "'");
headdata.SALEDEPT = strDEPT;
}
// headdata.STLNAME=_d.stl
/*}
//else
{
_data.DbOperationType = DbOperationType.DbotUpd;
_data.ModelUIStatus = "E";
_data.OPTIME = System.DateTime.Now.ToString();
_data.OPNAME = Session["SHOWNAME"].ToString();
_data.BLNO = _d.BLNO; //防止发生提单号变化
*/
//DoDataList.Add(_data);
//}
}
var result = new DBResult();
var _L = ModelObjectConvert<MsOp_BLISSUEList_Detailmb>.ToModelObjectList(DoDataList);
var modb = new ModelObjectRepository();
result = modb.Save(headdata,
ModelObjectConvert<MsOp_BLISSUEList_Detailmb>.ToModelObjectList(DoDataList)
, ModelObjectConvert<MsOp_BLISSUEList_Detailmb>.ToModelObjectList(DoDataListDel)
);
var _i = MsOp_BLISSUEDAL.ResetSPAmount(LINKGID);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteDetail ( string LINKGID, string GIDList )
{
var _count = 0;
var corpcode = CookieConfig.GetCookie_OrgCode(Request);
var userid = CookieConfig.GetCookie_UserId(Request);
_count = MsOp_BLISSUEDAL.DeleteDetail(LINKGID, GIDList);
var _success = false;
if (_count > 0)
{
_success = true;
}
var _i = MsOp_BLISSUEDAL.ResetSPAmount(LINKGID);
var json = JsonConvert.Serialize(new { Success = _success, Message = "查询成功", totalCount = _count });
return new ContentResult() { Content = json };
}
#endregion
#endregion
#region 提交 审核
public ContentResult SQQR ( string USERID, string data ) //申请签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1) {
if (_p.BLSTATUS != "录入状态")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else {
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQQR(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else {
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQQR_back ( string USERID, string data ) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "待签入")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQQR_back(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQQR_Auditback ( string USERID, string data,string REASON ) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "待签入" || _p.BLSTATUS == "已签入")
{
_L.Add(_p);
}
else
{
//_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQQR_Auditback(_L, USERID,REASON);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQQR_Audit ( string USERID, string data ) //申请签入_准许签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "待签入")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQQR_Audit(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQFD ( string USERID, string data ) //申请签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "已签入")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQFD(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQFD_back ( string USERID, string data ) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "申请放单")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQFD_back(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQFD_Auditback ( string USERID, string data, string REASON ) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "申请放单" || _p.BLSTATUS == "准许放单")
{
_L.Add(_p);
}
else
{
//_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQFD_Auditback(_L, USERID, REASON);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SQFD_Audit ( string USERID, string data ) //申请签入_准许签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS != "申请放单")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.SQFD_Audit(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 签入 签出
public ContentResult ISFDTZ(string data) //签入
{
var dataList = JsonConvert.Deserialize<List<MsOp_BLISSUEmb>>(data);
var result = new DBResult();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var istz = true;
var jsonRespose = new JsonResponse();
foreach (var item in dataList)
{
var ACTNAME = T_ALL_DA.GetStrSQL("ACTNAME", "SELECT ACTNAME FROM WorkLog WHERE (ACTNAME='放单通知' or ACTNAME='取消放单通知' or ACTNAME='驳回放单通知') AND BSNO='" + item.GID + "' order by OPDATE desc ");
if (ACTNAME!= "放单通知")
{
result.Success = false;
result.Message = "操作没有通知放单,是否继续";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
result.Success = true;
result.Message = "";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult QR ( string USERID, string data,string qrdate,string reason ) //签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签入" || _p.BLSTATUS == "扣单")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.QR(_L, USERID, qrdate, Convert.ToString(Session["SHOWNAME"]), reason);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 船证签入签出
public ContentResult CZQR(string CZQRDATE, string CZQRREMARK,string data) //签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
_L.Add(_p);
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.CZQR(_L, Convert.ToString(Session["USERID"]), CZQRDATE, CZQRREMARK);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UnCZQR(string USERID, string data) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.ISVESSELPROVE == "1")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.UnCZQR(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult HQBS(string USERID, string data) //换签背书
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签出")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.HQBS(_L, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UnHQBS(string USERID, string data) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.ISVESSELPROVE == "1")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.UnHQBS(_L, USERID, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
public ContentResult QC ( string USERID, string data,string REASON,string qcdate ) //签出
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "扣单" || _p.BLSTATUS == "提单签出")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.QC(_L, USERID, REASON, qcdate, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult KD ( string USERID, string data,string type) //扣单 取消扣单
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签出")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.KD(_L,USERID, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult FDTZ ( string USERID, string data, string REASON ) //放单通知
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if ( _p.BLSTATUS == "扣单" || _p.BLSTATUS == "放单通知" || _p.BLSTATUS == "提单签出")
{
/*
result.Success = false;
result.Message = "只有录入状态的提单才能申请签入";
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};*/
}
else
{
_L.Add(_p);
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.FDTZ(_L, USERID, REASON, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult PLFDTZ(string USERID, string data) //放单通知
{
bool BLISSUENONO = false;
var BLISSUENONOPARAM = MsSysParamSetDAL.GetData("PARAMNAME='BLISSUENONO'");
if (BLISSUENONOPARAM.PARAMVALUE == "1")
{
BLISSUENONO = true;
}
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
var nostlstr = "";
foreach (var _p in _r1)
{
var isnostl=false;
if (_p.STLDATE != "")
{
var ttlnodr = _p.TTLNODR;
if (ttlnodr == "") ttlnodr = "0";
if (System.DateTime.Now >= Convert.ToDateTime(_p.STLDATE) && Convert.ToDecimal(ttlnodr) > 0)
{
isnostl=true;
}
}
else
{
var ttlnodr = _p.TTLNODR;
if (ttlnodr == "") ttlnodr = "0";
if (Convert.ToDecimal(ttlnodr) != 0)
isnostl = true;
}
if (isnostl&& BLISSUENONO)
{
nostlstr = nostlstr + _p.BLNO + ",";
}
else
{
if (_p.BLSTATUS == "扣单" || _p.BLSTATUS == "放单通知" || _p.BLSTATUS == "提单签出")
{
}
else
{
_L.Add(_p);
}
}
}
if (nostlstr != "")
{
nostlstr = " 其中提单号:" + nostlstr + "存在欠费,无法放单!";
}
var jsonRespose = new JsonResponse();
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.FDTZ(_L, USERID,"", Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message +nostlstr,
Data = nostlstr
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单" + nostlstr;
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = nostlstr
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UNFDTZ(string USERID, string data) //取消放单通知
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
_L.Add(_p);
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.UNFDTZ(_L, USERID, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult FDTZBACK(string USERID, string data) //取消放单通知
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
_L.Add(_p);
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.FDTZBACK(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以提交的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UnQR ( string USERID, string data ) //申请签入_撤回
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签入" || _p.BLSTATUS == "放单通知")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.UnQR(_L, USERID, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult QXQC ( string USERID, string data ) //取消签出
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签出")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.QXQC(_L, USERID, Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以取消签出的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult REQR ( string USERID, string data ) //重新签入
{
var _r1 = SaveList_P(data);
var _L = new List<MsOp_BLISSUEmb>();
var result = new DBResult();
foreach (var _p in _r1)
{
if (_p.BLSTATUS == "提单签出")
{
_L.Add(_p);
}
else
{
}
}
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (_L.Count > 0)
{
result = MsOp_BLISSUEDAL.REQR(_L, USERID);
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以撤回的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region
public ContentResult GGTD(string data,string status) //取消放单通知
{
var bodylist = JsonConvert.Deserialize <List<MsOp_BLISSUEmb>>(data);
var result = new DBResult();
var jsonRespose = new JsonResponse();
//var USERID=Convert.ToString(Session["USERID"]);
if (bodylist.Count > 0)
{
result = MsOp_BLISSUEDAL.GGTD(bodylist,status, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
}
else
{
result.Success = false;
result.Message = "没有可以更改的提单";
jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
public ContentResult SaveLog ( string data )
{
var headData = JsonConvert.Deserialize<WorkLogmb>(data);
headData.GID = System.Guid.NewGuid().ToString(); //获取合同号
headData.OP = Session["SHOWNAME"].ToString();
var result = new DBResult();
var modb = new ModelObjectRepository();
result = modb.Save(headData);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetBLINFO(string BSNO)
{
var dataList = MsOp_BLISSUEDAL.GetBLINFO(BSNO);
var list = dataList.Skip(0).Take(999);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLINFO2 ( string BSNO )
{
var dataList = MsOp_BLISSUEDAL.GetBLINFO2(BSNO);
var list = dataList.Skip(0).Take(999);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBLINFOLIST(int start, int limit, string sort, string CUSTNAME,string SALE)
{
var dataList = MsOp_BLISSUEDAL.GetBLINFOLIST(CUSTNAME, SALE);
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 };
}
#region 特殊放单附件
public ContentResult GetFileList ( string PID )
{
var dataList = MsOp_BLISSUEDAL.GetUpLoadFileList("PID='" + PID + "'");
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult SaveFile ( string bsno, string body )
{
int iResult = 0;
var bodyList = JsonConvert.Deserialize<List<DSWeb.Areas.TruckMng.Models.MsUpLoadFile>>(body);
var result = new DBResult();
if (bodyList != null)
{
iResult = MsOp_BLISSUEDAL.SaveFileList(bodyList, bsno);
}
if (iResult == 1)
{
result.Success = true;
result.Message = "更新成功!";
}
else if (iResult == 0)
{
result.Success = false;
result.Message = "出现错误,未更新!";
}
else if (iResult == -1)
{
result.Success = false;
result.Message = "有异常,插入失败!";
}
else if (iResult == -2)
{
result.Success = false;
result.Message = "插入异常,事务已回滚成功!";
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
[HttpPost]
public ContentResult UploadFile ( )
{
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 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["LoadImage"];
var fileGID = Request.Form["fileGid"];
if (file == null)
{
jsonRespose.Success = false;
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
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) };
}
string ext = Path.GetExtension(file.FileName).ToLower();
if (ext == ".asp" || ext == ".aspx")
{
jsonRespose.Success = false;
jsonRespose.Message = "不允许上传ASP或ASPX文件";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var path = Server.MapPath("../../UploadFiles/MsDriver");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var size = file.ContentLength;
var name = Path.GetFileName(file.FileName);
var usercode = CookieConfig.GetCookie_UserCode(Request);
string fn = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
string filename = path + "\\" + fn;
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;
var filename2 = "../../UploadFiles/MsDriver/" + fn;
var isSucess = MsOp_BLISSUEDAL.UpdateFileData(Request,filename, filename2, fileGID, out message);
if (!isSucess)
{
jsonRespose.Success = false;
jsonRespose.Message = message;
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功!", data = filename });
return new ContentResult() { Content = json };
}
catch (Exception e)
{
jsonRespose.Success = false;
jsonRespose.Message = "上传文件出错,请确认文件正确性";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult DeleteUploadFile ( string data )
{
int iResult = 0;
var bodyList = data;
var result = new DBResult();
if (bodyList != "" || bodyList != null)
{
iResult = MsOp_BLISSUEDAL.DeleteUploadFile(bodyList);
}
if (iResult == 1)
{
result.Success = true;
result.Message = "删除成功!";
}
else if (iResult == 0)
{
result.Success = false;
result.Message = "出现错误,未删除!";
}
else if (iResult == -1)
{
result.Success = false;
result.Message = "有异常,删除失败!";
}
else if (iResult == -2)
{
result.Success = false;
result.Message = "删除异常,事务已回滚成功!";
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}