|
|
|
|
|
using System;
|
|
|
using System.Data;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Text;
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.Mvc;
|
|
|
using System.IO;
|
|
|
using System.Data.SqlClient;
|
|
|
using System.Data.Common;
|
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using HcUtility.Comm;
|
|
|
using WebSqlHelper;
|
|
|
using DotNet4.Utilities;
|
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpApply;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOp_BLISSUE;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.OA.Models.WorkFlow;
|
|
|
using DSWeb.Areas.OA.Controllers;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using DSWeb.Areas.Account.Models.MsOpBill;
|
|
|
using DSWeb.Areas.TruckMng.Models; //附件类
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using static DSWeb.Areas.CommMng.DAL.BasicDataRefDAL;
|
|
|
|
|
|
namespace DSWeb.Areas.MvcShipping.DAL.MsOp_BLISSUE
|
|
|
{
|
|
|
public partial class MsOp_BLISSUEDAL
|
|
|
{
|
|
|
#region 提单列表
|
|
|
|
|
|
static public List<MsOp_BLISSUEmb> GetDataList ( string strCondition,int start,int limit,out int recordcount, string sort="",string corpid="")
|
|
|
{
|
|
|
//var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
//if (!string.IsNullOrEmpty(rangstr))
|
|
|
//{
|
|
|
// if (!string.IsNullOrEmpty(strCondition))
|
|
|
// {
|
|
|
// strCondition = strCondition + " and " + rangstr;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strCondition = rangstr;
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
//合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select ob.GID,B.BSNO,B.mblno BLNO,B.HBLNO ");
|
|
|
strSql.Append(" ,B.OPTYPE ZDFD ");
|
|
|
strSql.Append(" ,ob.BLNAME,ob.BLSTATUS,ob.BLORDERNO ");
|
|
|
strSql.Append(" ,B.ISSUETYPE,B.ISSUEPLACE ");
|
|
|
strSql.Append(" ,ob.OPNAME,ob.OPTIME,ob.BSINKNO,ob.ISVESSELPROVE,ob.VESSELPROVETIME,ob.VESSELPROVEREMARK ");
|
|
|
strSql.Append(" ,ob.REMARK,ob.DELFLAG,ob.EXPRESSCORP,ob.EXPRESSNO,ob.ISADD,dbo.trimdate(ob.PUTSINGLETIME) PUTSINGLETIME ");
|
|
|
strSql.Append(" ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD,sp.SPREMARK SPREMARK,sp.ISCHAOQI,sp.MNGBLSTATUS ");
|
|
|
strSql.Append(" ,CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=B.CUSTOMERNAME and BSNO<>B.BSNO)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER ");
|
|
|
// strSql.Append(" ,CASE WHEN isnull(bf.CUSTOMERNAME,'')='' THEN '无' ELSE '有' END CUSTCARGOAFTER ");
|
|
|
strSql.Append(" ,B.BLTYPE,B.CUSTNO,B.customername,B.sale ");
|
|
|
strSql.Append(" ,(select top 1 acctype from info_client_accdate where LINKGID=(select top 1 gid from info_client where SHORTNAME=B.customername) ");
|
|
|
strSql.Append(" and BGNDATE<=B.ETD and ENDDATE>B.ETD and (isnull(SALE,'')='' or SALE=B.SALE)) acctype ");
|
|
|
strSql.Append(" ,dbo.trimdate(B.ETD) ETD,dbo.trimdate(B.STLDATE) STLDATE,B.CARRIER,B.VESSEL,B.VOYNO,B.OP,B.CUSTSERVICE,B.PORTLOAD,B.PORTDISCHARGE,B.DOC ");
|
|
|
strSql.Append(" ,B.BLISSUESTATUS ");
|
|
|
strSql.Append(" ,sp.BLSTATUS TSFD ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,B.STLDATE) XYTS ");
|
|
|
strSql.Append(" ,datediff(day,B.STLDATE,getdate()) cqts ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,getdate()) SJTS ");
|
|
|
strSql.Append(" ,g.RMBDR-g.STLRMBDR RMBNODR ");
|
|
|
strSql.Append(" ,g.USDDR-g.STLUSDDR USDNODR ");
|
|
|
strSql.Append(" ,g.TTLDR-g.STLTTLDR TTLNODR ");
|
|
|
strSql.Append(" ,g.TTLDR TTLDR ");
|
|
|
strSql.Append(" ,B.OPLBNAME,B.STLNAME,B.ISGAIQIAN ");
|
|
|
strSql.Append(" ,(case when (select COUNT(*) from worklog where bsno=ob.GID and ACTNAME='提单签入')>0 then 1 else 0 end) ISQR,ob.QRDATE,ob.QCDATE ");
|
|
|
strSql.Append(" from v_op_blissue_bill B ");
|
|
|
strSql.Append(" left join op_blissue ob on ob.BSNO=B.BSNO ");
|
|
|
strSql.Append(" left join v_op_gain_sum_ttl g on g.BSNO=B.BSNO ");
|
|
|
// strSql.Append(" left join v_op_seae_iscargo bf on (bf.CUSTOMERNAME=B.CUSTOMERNAME and bf.BSNO<>B.BSNO) ");
|
|
|
strSql.Append(" left join v_op_blissuelist_Detail sp on sp.BSNO=B.BSNO ");
|
|
|
//2018年2月8日15:57:08 鼎世 李进举 提单管理不显示iscancel=1,2的数据
|
|
|
strSql.Append(" where (B.OPTYPE='主票' and B.iscancel<>1 and B.iscancel<>2 and B.MBLNO<>'' or (B.OPTYPE='分票' and B.HBLNO<>'') ) ");
|
|
|
if (!string.IsNullOrEmpty(corpid))
|
|
|
strSql.Append(" AND CORPID='" + corpid + "'");
|
|
|
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
|
|
|
|
PagedQuaryParam pp = new PagedQuaryParam();
|
|
|
|
|
|
pp.strSql = strSql.ToString();
|
|
|
pp.start = start;
|
|
|
pp.limit = limit;
|
|
|
pp.strCondition = strCondition;
|
|
|
pp.defaultsortstr = "ETD desc";
|
|
|
pp.sortstring = sortstring;
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(strCondition))
|
|
|
//{
|
|
|
// strSql.Append(" and " + strCondition.Replace("~",""));//str.Replace("b","**");
|
|
|
//}
|
|
|
//var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
//if (!string.IsNullOrEmpty(sortstring))
|
|
|
//{
|
|
|
// strSql.Append(" order by " + sortstring);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// // strSql.Append(" order by ob.OPTIME desc ");
|
|
|
// strSql.Append(" order by B.ETD desc ");
|
|
|
|
|
|
//}
|
|
|
|
|
|
var result = PagedQuaryStr(pp);
|
|
|
|
|
|
recordcount = PagedCount(pp);
|
|
|
|
|
|
return SetData(result);
|
|
|
}
|
|
|
|
|
|
static public DBResult GetDataListStr(string strCondition, string sort, string corpid = "")
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
//合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select ob.GID,B.BSNO,B.mblno BLNO,B.HBLNO ");
|
|
|
strSql.Append(" ,B.OPTYPE ZDFD ");
|
|
|
strSql.Append(" ,ob.BLNAME,ob.BLSTATUS,ob.BLORDERNO ");
|
|
|
strSql.Append(" ,B.ISSUETYPE,B.ISSUEPLACE ");
|
|
|
strSql.Append(" ,ob.OPNAME,ob.OPTIME,ob.BSINKNO,ob.ISVESSELPROVE,ob.VESSELPROVETIME,ob.VESSELPROVEREMARK ");
|
|
|
strSql.Append(" ,ob.REMARK,ob.DELFLAG,ob.EXPRESSCORP,ob.EXPRESSNO,ob.ISADD,dbo.trimdate(ob.PUTSINGLETIME) PUTSINGLETIME ");
|
|
|
strSql.Append(" ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD,sp.SPREMARK SPREMARK,sp.ISCHAOQI,sp.MNGBLSTATUS ");
|
|
|
strSql.Append(" ,CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=B.CUSTOMERNAME and BSNO<>B.BSNO)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER ");
|
|
|
// strSql.Append(" ,CASE WHEN isnull(bf.CUSTOMERNAME,'')='' THEN '无' ELSE '有' END CUSTCARGOAFTER ");
|
|
|
strSql.Append(" ,B.BLTYPE,B.CUSTNO,B.customername,B.sale ");
|
|
|
strSql.Append(" ,(select top 1 acctype from info_client_accdate where LINKGID=(select top 1 gid from info_client where SHORTNAME=B.customername) ");
|
|
|
strSql.Append(" and BGNDATE<=B.ETD and ENDDATE>B.ETD and (isnull(SALE,'')='' or SALE=B.SALE)) acctype ");
|
|
|
strSql.Append(" ,dbo.trimdate(B.ETD) ETD,dbo.trimdate(B.STLDATE) STLDATE,B.CARRIER,B.VESSEL,B.VOYNO,B.OP,B.CUSTSERVICE,B.PORTLOAD,B.PORTDISCHARGE,B.DOC ");
|
|
|
strSql.Append(" ,B.BLISSUESTATUS ");
|
|
|
strSql.Append(" ,sp.BLSTATUS TSFD ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,B.STLDATE) XYTS ");
|
|
|
strSql.Append(" ,datediff(day,B.STLDATE,getdate()) cqts ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,getdate()) SJTS ");
|
|
|
strSql.Append(" ,g.RMBDR-g.STLRMBDR RMBNODR ");
|
|
|
strSql.Append(" ,g.USDDR-g.STLUSDDR USDNODR ");
|
|
|
strSql.Append(" ,g.TTLDR-g.STLTTLDR TTLNODR ");
|
|
|
strSql.Append(" ,g.TTLDR TTLDR ");
|
|
|
strSql.Append(" ,B.OPLBNAME,B.STLNAME,B.ISGAIQIAN ");
|
|
|
strSql.Append(" ,(case when (select COUNT(*) from worklog where bsno=ob.GID and ACTNAME='提单签入')>0 then 1 else 0 end) ISQR,ob.QRDATE,ob.QCDATE ");
|
|
|
strSql.Append(" from v_op_blissue_bill B ");
|
|
|
strSql.Append(" left join op_blissue ob on ob.BSNO=B.BSNO ");
|
|
|
strSql.Append(" left join v_op_gain_sum_ttl g on g.BSNO=B.BSNO ");
|
|
|
// strSql.Append(" left join v_op_seae_iscargo bf on (bf.CUSTOMERNAME=B.CUSTOMERNAME and bf.BSNO<>B.BSNO) ");
|
|
|
strSql.Append(" left join v_op_blissuelist_Detail sp on sp.BSNO=B.BSNO ");
|
|
|
//2018年2月8日15:57:08 鼎世 李进举 提单管理不显示iscancel=1,2的数据
|
|
|
strSql.Append(" where (B.OPTYPE='主票' and B.iscancel<>1 and B.iscancel<>2 and B.MBLNO<>'' or (B.OPTYPE='分票' and B.HBLNO<>'') )");
|
|
|
if (!string.IsNullOrEmpty(corpid))
|
|
|
strSql.Append(" AND CORPID='" + corpid + "'");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" and " + strCondition.Replace("~", ""));//str.Replace("b","**");
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by OPTIME desc ");
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Data = strSql.ToString();
|
|
|
result.Message = strCondition;
|
|
|
return result;
|
|
|
}
|
|
|
static public MsOp_BLISSUEmb GetData ( string condition )
|
|
|
{
|
|
|
var recordcount = 0;
|
|
|
var list = GetDataList(condition,0,1,out recordcount);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new MsOp_BLISSUEmb();
|
|
|
}
|
|
|
|
|
|
private static List<MsOp_BLISSUEmb> SetData ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<MsOp_BLISSUEmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
SqlCommand cmd = new SqlCommand();
|
|
|
cmd.CommandText = strSql.ToString();
|
|
|
cmd.CommandTimeout = 120000; //要加这一句
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(cmd))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOp_BLISSUEmb data = new MsOp_BLISSUEmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.BLNO = Convert.ToString(reader["BLNO"]);
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);
|
|
|
data.ZDFD = Convert.ToString(reader["ZDFD"]);
|
|
|
data.BLNAME = Convert.ToString(reader["BLNAME"]);
|
|
|
data.BLSTATUS = Convert.ToString(reader["BLSTATUS"]);
|
|
|
data.BLORDERNO = Convert.ToString(reader["BLORDERNO"]);
|
|
|
data.ISSUETYPE = Convert.ToString(reader["ISSUETYPE"]);
|
|
|
data.ISSUEPLACE = Convert.ToString(reader["ISSUEPLACE"]);
|
|
|
data.OPNAME = Convert.ToString(reader["OPNAME"]);
|
|
|
data.OPTIME = Convert.ToString(reader["OPTIME"]);
|
|
|
data.BSINKNO = Convert.ToString(reader["BSINKNO"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.DELFLAG = Convert.ToString(reader["DELFLAG"]);
|
|
|
data.EXPRESSCORP = Convert.ToString(reader["EXPRESSCORP"]);
|
|
|
data.EXPRESSNO = Convert.ToString(reader["EXPRESSNO"]);
|
|
|
data.ISADD = Convert.ToString(reader["ISADD"]);
|
|
|
data.PUTSINGLETIME = Convert.ToString(reader["PUTSINGLETIME"]);
|
|
|
data.PUTSINGLE = Convert.ToString(reader["PUTSINGLE"]);
|
|
|
data.PAYTIME = Convert.ToString(reader["PAYTIME"]);
|
|
|
data.PAYRMB = Convert.ToString(reader["PAYRMB"]);
|
|
|
data.PAYUSD = Convert.ToString(reader["PAYUSD"]);
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);
|
|
|
data.ACCTYPE = Convert.ToString(reader["ACCTYPE"]);
|
|
|
if (data.ACCTYPE == "") data.ACCTYPE = "现结买单";
|
|
|
data.ETD = Convert.ToString(reader["ETD"]);
|
|
|
data.STLDATE = Convert.ToString(reader["STLDATE"]);
|
|
|
data.STLNAME = Convert.ToString(reader["STLNAME"]);
|
|
|
if (data.STLNAME == "") data.STLNAME = "现结买单";
|
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);
|
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);
|
|
|
data.VOYNO = Convert.ToString(reader["VOYNO"]);
|
|
|
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);
|
|
|
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]);
|
|
|
data.OP = Convert.ToString(reader["OP"]);
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);
|
|
|
data.BLISSUESTATUS = Convert.ToString(reader["BLISSUESTATUS"]);
|
|
|
data.TSFD = Convert.ToString(reader["TSFD"]);
|
|
|
data.XYTS = Convert.ToString(reader["XYTS"]);
|
|
|
data.CQTS = Convert.ToString(reader["CQTS"]);
|
|
|
data.SJTS = Convert.ToString(reader["SJTS"]);
|
|
|
data.RMBNODR = Convert.ToString(reader["RMBNODR"]);
|
|
|
data.USDNODR = Convert.ToString(reader["USDNODR"]);
|
|
|
data.TTLNODR = Convert.ToString(reader["TTLNODR"]);
|
|
|
data.TTLDR = Convert.ToString(reader["TTLDR"]);
|
|
|
data.OPLBNAME = Convert.ToString(reader["OPLBNAME"]);
|
|
|
data.SPREMARK = Convert.ToString(reader["SPREMARK"]);
|
|
|
data.ISVESSELPROVE = Convert.ToString(reader["ISVESSELPROVE"]);
|
|
|
data.VESSELPROVETIME = Convert.ToString(reader["VESSELPROVETIME"]);
|
|
|
data.VESSELPROVEREMARK = Convert.ToString(reader["VESSELPROVEREMARK"]);
|
|
|
data.ISQR = Convert.ToString(reader["ISQR"]);
|
|
|
data.ISCHAOQI = Convert.ToString(reader["ISCHAOQI"]);
|
|
|
data.MNGBLSTATUS = Convert.ToString(reader["MNGBLSTATUS"]);
|
|
|
data.CUSTCARGOAFTER = Convert.ToString(reader["CUSTCARGOAFTER"]);
|
|
|
data.QRDATE = Convert.ToString(reader["QRDATE"]);
|
|
|
data.QCDATE = Convert.ToString(reader["QCDATE"]);
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);
|
|
|
data.ISGAIQIAN = Convert.ToString(reader["ISGAIQIAN"]);
|
|
|
data.DOC = Convert.ToString(reader["DOC"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 业务信息
|
|
|
|
|
|
static public List<MsOpBill> GetBillDataList(int start, int limit, string strCondition, string sort = null, bool all = false)
|
|
|
{
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(@"SELECT * from (SELECT row_number() over (");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by ETD,MBLNO");
|
|
|
}
|
|
|
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append(" BSNO,BSSTATUS,FEESTATUS,ACCDATE,MBLNO,HBLNO,CUSTNO,CUSTOMNO");
|
|
|
strSql.Append(",CUSTOMERNAME");
|
|
|
strSql.Append(",VESSEL,VOYNO,ETD,PORTLOAD");
|
|
|
strSql.Append(",PORTDISCHARGE,INPUTBY,OP,CUSTSERVICE");
|
|
|
strSql.Append(",DOC,SALE,ENTERP,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CNTRTOTAL,PKGS,CBM,KGS,REMARK");
|
|
|
strSql.Append(",(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF");
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(op_seae.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(op_seae.BSNO) CRFEESTATUS");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS+' '+ CONVERT(varchar(100),COMPTIME, 20) FROM OP_STATUS WHERE BSNO=op_seae.BSNO AND STTYPE='2' ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
|
|
|
|
|
|
|
|
|
strSql.Append(" from op_seae ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>={0} and t.num<={1} order by t.num ", start, start + limit)); //
|
|
|
|
|
|
return SetBillData(strSql);
|
|
|
}
|
|
|
|
|
|
public static int getTotalCount(string strCondition)
|
|
|
{
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("select count(*) ");
|
|
|
strSql.Append(" from op_seae ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
int cnt = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
cnt = Convert.ToInt32(reader[0]);
|
|
|
}
|
|
|
}
|
|
|
return cnt;
|
|
|
}
|
|
|
|
|
|
private static List<MsOpBill> SetBillData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<MsOpBill>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand();
|
|
|
cmd.CommandText = strSql.ToString();
|
|
|
cmd.CommandTimeout = 120000; //要加这一句
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(cmd))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpBill data = new MsOpBill();
|
|
|
#region Set DB data to Object
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
if (reader["ETD"] != DBNull.Value)
|
|
|
data.ETD = Convert.ToString(reader["ETD"]);
|
|
|
data.ACCDATE = Convert.ToString(reader["ACCDATE"]);
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);
|
|
|
data.VOYNO = Convert.ToString(reader["VOYNO"]);
|
|
|
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);
|
|
|
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]);
|
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);
|
|
|
data.OP = Convert.ToString(reader["OP"]);
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);
|
|
|
data.DOC = Convert.ToString(reader["DOC"]);
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);
|
|
|
data.ENTERP = Convert.ToString(reader["ENTERP"]);
|
|
|
data.BSSOURCE = Convert.ToString(reader["BSSOURCE"]);
|
|
|
data.BSSOURCEDETAIL = Convert.ToString(reader["BSSOURCEDETAIL"]);
|
|
|
if (reader["CUSTOMSNUM"] != DBNull.Value)
|
|
|
data.CUSTOMSNUM = Convert.ToInt16(reader["CUSTOMSNUM"]);
|
|
|
data.PKGS = Convert.ToString(reader["PKGS"]);
|
|
|
data.CBM = Convert.ToString(reader["CBM"]);
|
|
|
data.KGS = Convert.ToString(reader["KGS"]);
|
|
|
if (reader["BSSTATUS"] != DBNull.Value)
|
|
|
data.BSSTATUS = Convert.ToBoolean(reader["BSSTATUS"]);
|
|
|
data.FEESTATUS = Convert.ToBoolean(reader["FEESTATUS"]);
|
|
|
data.BSSTATUSREF = Convert.ToString(reader["BSSTATUSREF"]);// 业务状态
|
|
|
data.FEESTATUSREF = Convert.ToString(reader["FEESTATUSREF"]);// 费用状态
|
|
|
data.DRFEESTATUS = getfeestatus(Convert.ToString(reader["DRFEESTATUS"]));
|
|
|
data.CRFEESTATUS = getfeestatus(Convert.ToString(reader["CRFEESTATUS"]));
|
|
|
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);//集装箱全部内容
|
|
|
data.OPSTATUS = Convert.ToString(reader["OPSTATUS"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
public static string getfeestatus(string feestatusint)
|
|
|
{
|
|
|
var result = "";
|
|
|
if (feestatusint == "0:")
|
|
|
{
|
|
|
return "审核通过";
|
|
|
}
|
|
|
else if (feestatusint == "1:")
|
|
|
{
|
|
|
return "录入状态";
|
|
|
}
|
|
|
else if (feestatusint == "2:")
|
|
|
{
|
|
|
return "提交审核";
|
|
|
}
|
|
|
else if (feestatusint == "8:")
|
|
|
{
|
|
|
return "部分结算";
|
|
|
}
|
|
|
else if (feestatusint == "9:")
|
|
|
{
|
|
|
return "结算完毕";
|
|
|
}
|
|
|
else if (feestatusint == "")
|
|
|
{
|
|
|
return "未录入";
|
|
|
}
|
|
|
else if (feestatusint == "3:")
|
|
|
{
|
|
|
return "申请修改";
|
|
|
}
|
|
|
else if (feestatusint == "4:")
|
|
|
{
|
|
|
return "申请删除";
|
|
|
}
|
|
|
else if (feestatusint == "6:")
|
|
|
{
|
|
|
return "驳回提交";
|
|
|
}
|
|
|
else if (feestatusint == "7:")
|
|
|
{
|
|
|
return "驳回申请";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("9:") > -1)
|
|
|
{
|
|
|
return "部分结算";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("0:") > -1)
|
|
|
{
|
|
|
return "部分审核";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("2:") > -1)
|
|
|
{
|
|
|
return "部分提交";
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 特殊放单申请
|
|
|
|
|
|
static public List<MsOp_BLISSUEListmb> GetSPList(int start, int limit, string strCondition, string sort)
|
|
|
{ //合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(@"SELECT * from (SELECT row_number() over (");
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by OPTIME desc ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
|
|
|
strSql.Append(" ob.GID,ob.BLSTATUS,(select top 1 BLSTATUS from op_blissue where bsno=ob.BSNO) BL_BLSTATUS");
|
|
|
strSql.Append(" ,ob.BSNO,ob.OPNAME,dbo.trimdate(ob.OPTIME) OPTIME,ob.REMARK,ob.SPREMARK,ob.ISCHAOQI,ob.COMMITREMARK,");
|
|
|
strSql.Append(" CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=ob.CUSTOMERNAME)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER,ob.STLNAME,ob.SALEDEPT,ob.ISDEPTARREARS,ob.MNGBLSTATUS ");
|
|
|
strSql.Append(" ,ob.CUSTOMERNAME,g.MBLNO,g.HBLNO,g.ETD,g.VESSEL,g.VOYNO,ob.SALE,g.OP ");
|
|
|
strSql.Append(" ,convert(bigint ,ob.TimeMark) as TimeMark,ob.RMBNODR,ob.USDNODR,ob.TTLNODR ");
|
|
|
strSql.Append(" ,isnull(dp.MAXARREARS,0) MAXARREARS,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.SALEDEPT and ");
|
|
|
strSql.Append(" not exists (select 1 from v_op_seae_iscargo i where bl.customername=i.customername))),0) AS DEPTTTLNODR ");
|
|
|
strSql.Append(" from op_blissuelist ob ");
|
|
|
strSql.Append(" left join v_op_blissue_bill g on g.bsno=ob.bsno ");
|
|
|
strSql.Append(" left join workflow_using wu on wu.bsno=ob.GID ");
|
|
|
strSql.Append(" left join SYS_DEPT_ARREARS dp on dp.DEPT=ob.SALEDEPT ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));//str.Replace("b","**");
|
|
|
}
|
|
|
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>={0} and t.num<={1} order by t.num", start, start + limit)); //
|
|
|
|
|
|
return SetSPData(strSql);
|
|
|
}
|
|
|
|
|
|
static public List<MsOp_BLISSUEListmb> GetSPCustList(int start, int limit, string strCondition, string sort)
|
|
|
{ //合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(@"SELECT * from (SELECT row_number() over (");
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by OPTIME desc ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
|
|
|
strSql.Append(" ob.GID,ob.BLSTATUS,(select top 1 BLSTATUS from op_blissue where bsno=ob.BSNO) BL_BLSTATUS");
|
|
|
strSql.Append(" ,ob.BSNO,ob.OPNAME,dbo.trimdate(ob.OPTIME) OPTIME,ob.REMARK,ob.SPREMARK,ob.ISCHAOQI,ob.COMMITREMARK,");
|
|
|
strSql.Append(" CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=ob.CUSTOMERNAME)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER,ob.STLNAME,ob.SALEDEPT,ob.ISDEPTARREARS,ob.MNGBLSTATUS ");
|
|
|
strSql.Append(" ,ob.CUSTOMERNAME,g.MBLNO,g.HBLNO,g.ETD,g.VESSEL,g.VOYNO,ob.SALE,g.OP ");
|
|
|
strSql.Append(" ,convert(bigint ,ob.TimeMark) as TimeMark,ob.RMBNODR,ob.USDNODR,ob.TTLNODR ");
|
|
|
strSql.Append(" ,isnull(dp.ALLOWAMOUNT,0) MAXARREARS,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 CUSTOMERNAME=ob.CUSTOMERNAME and ");
|
|
|
strSql.Append(" not exists (select 1 from v_op_seae_iscargo i where bl.customername=i.customername))),0) AS DEPTTTLNODR ");
|
|
|
strSql.Append(" from op_blissuelist ob ");
|
|
|
strSql.Append(" left join v_op_blissue_bill g on g.bsno=ob.bsno ");
|
|
|
strSql.Append(" left join workflow_using wu on wu.bsno=ob.GID ");
|
|
|
strSql.Append(" left join v_info_client_accdate dp on dp.CUSTOMERNAME=ob.CUSTOMERNAME AND dp.BGNDATE<=ob.OPTIME AND dp.ENDDATE>=ob.OPTIME ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));//str.Replace("b","**");
|
|
|
}
|
|
|
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>={0} and t.num<={1} order by t.num", start, start + limit)); //
|
|
|
|
|
|
return SetSPData(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
public static int getSpTotalCount(string strCondition, string userid, string usercode, string companyid)
|
|
|
{
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("select count(*) ");
|
|
|
strSql.Append(" from op_blissuelist ob ");
|
|
|
strSql.Append(" left join v_op_blissue_bill g on g.bsno=ob.bsno ");
|
|
|
strSql.Append(" left join workflow_using wu on wu.bsno=ob.GID ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition.Replace("~", ""));//str.Replace("b","**");
|
|
|
}
|
|
|
int cnt = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
cnt = Convert.ToInt32(reader[0]);
|
|
|
}
|
|
|
}
|
|
|
return cnt;
|
|
|
}
|
|
|
|
|
|
static public MsOp_BLISSUEListmb GetSPData ( string condition )
|
|
|
{
|
|
|
var _t = "";
|
|
|
var list = GetSPList(0,1,condition, _t);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
|
|
|
return new MsOp_BLISSUEListmb();
|
|
|
}
|
|
|
|
|
|
private static List<MsOp_BLISSUEListmb> SetSPData ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<MsOp_BLISSUEListmb>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOp_BLISSUEListmb data = new MsOp_BLISSUEListmb();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.BLSTATUS = Convert.ToString(reader["BLSTATUS"]);
|
|
|
data.MNGBLSTATUS = Convert.ToString(reader["MNGBLSTATUS"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.OPNAME = Convert.ToString(reader["OPNAME"]);
|
|
|
data.OPTIME = Convert.ToString(reader["OPTIME"]);
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);
|
|
|
data.ETD = Convert.ToString(reader["ETD"]);
|
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);
|
|
|
data.VOYNO = Convert.ToString(reader["VOYNO"]);
|
|
|
data.RMBNODR = Convert.ToString(reader["RMBNODR"]);
|
|
|
data.USDNODR = Convert.ToString(reader["USDNODR"]);
|
|
|
data.TTLNODR = Convert.ToString(reader["TTLNODR"]);
|
|
|
data.BL_BLSTATUS = Convert.ToString(reader["BL_BLSTATUS"]);
|
|
|
data.TimeMark = Convert.ToDecimal(reader["TimeMark"]);
|
|
|
data.SPREMARK = Convert.ToString(reader["SPREMARK"]);
|
|
|
data.CUSTCARGOAFTER = Convert.ToString(reader["CUSTCARGOAFTER"]);
|
|
|
data.STLNAME = Convert.ToString(reader["STLNAME"]);
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);
|
|
|
data.OP = Convert.ToString(reader["OP"]);
|
|
|
data.SALEDEPT = Convert.ToString(reader["SALEDEPT"]);
|
|
|
data.MAXARREARS = Convert.ToString(reader["MAXARREARS"]);
|
|
|
data.DEPTTTLNODR = Convert.ToString(reader["DEPTTTLNODR"]);
|
|
|
data.DEPTTTLDR =Convert.ToString(Convert.ToDecimal(data.MAXARREARS) - Convert.ToDecimal(data.DEPTTTLNODR));
|
|
|
data.ISDEPTARREARS = "否";
|
|
|
if (data.BLSTATUS == "审核通过" && data.MNGBLSTATUS != "审核通过"&&data.CUSTCARGOAFTER=="无") {
|
|
|
if (data.MAXARREARS != "0") data.ISDEPTARREARS = "是";
|
|
|
}
|
|
|
|
|
|
data.ISCHAOQI = Convert.ToString(reader["ISCHAOQI"]);
|
|
|
data.COMMITREMARK = Convert.ToString(reader["COMMITREMARK"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
//特殊放单申请明细
|
|
|
static public List<MsOp_BLISSUEmb> GetSPDetail ( string strCondition,int start,int limit, string sort )
|
|
|
{ //合同信息/商品信息
|
|
|
var strSql = new StringBuilder();
|
|
|
/*
|
|
|
strSql.Append(" select obd.GID,op_seae.BSNO,op_seae.mblno BLNO,op_seae.HBLNO ");
|
|
|
strSql.Append(" ,(case when op_seae.bsno=op_seae.masterno then '主提单' else '分单' END) ZDFD ");
|
|
|
strSql.Append(" ,ob.BLNAME,ob.BLSTATUS,ob.BLORDERNO ");
|
|
|
strSql.Append(" ,(select top 1 ISSUETYPE from op_seae where bsno=op_seae.bsno) ISSUETYPE ");
|
|
|
strSql.Append(" ,ob.OPNAME,ob.OPTIME,ob.BSINKNO ");
|
|
|
strSql.Append(" ,ob.REMARK,ob.DELFLAG,ob.EXPRESSCORP,ob.EXPRESSNO,ob.ISADD,dbo.trimdate(ob.PUTSINGLETIME) PUTSINGLETIME ");
|
|
|
strSql.Append(" ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD ");
|
|
|
strSql.Append(" ,op_seae.BLTYPE,op_seae.CUSTNO,op_seae.customername,op_seae.sale ");
|
|
|
strSql.Append(" ,(select top 1 acctype from info_client_accdate where LINKGID=(select top 1 gid from info_client where SHORTNAME=op_seae.customername) ");
|
|
|
strSql.Append(" and BGNDATE<=op_seae.ETD and ENDDATE>op_seae.ETD and (isnull(SALE,'')='' or SALE=op_seae.SALE)) acctype ");
|
|
|
strSql.Append(" ,op_seae.ETD,op_seae.STLDATE,op_seae.CARRIER,op_seae.VESSEL,op_seae.VOYNO,op_seae.OP,op_seae.BLISSUESTATUS ");
|
|
|
strSql.Append(" ,(case when (select count(*) from op_blissuelist where bsno=op_seae.BSNO)>0 then '特殊放单' ELSE '' end) TSFD ");
|
|
|
strSql.Append(" ,DATEDIFF(day,op_seae.ETD,op_seae.STLDATE) XYTS ");
|
|
|
strSql.Append(" ,datediff(day,op_seae.STLDATE,getdate()) cqts ");
|
|
|
strSql.Append(" ,DATEDIFF(day,op_seae.ETD,getdate()) SJTS ");
|
|
|
strSql.Append(" ,(select RMBNODR from v_op_bill_gain where bsno=op_seae.bsno) RMBNODR ");
|
|
|
strSql.Append(" ,(select USDNODR from v_op_bill_gain where bsno=op_seae.bsno) USDNODR ");
|
|
|
strSql.Append(" ,(select TTLNODR from v_op_bill_gain where bsno=op_seae.bsno) TTLNODR ");
|
|
|
strSql.Append(" from op_seae ");
|
|
|
strSql.Append(" left join op_blissue ob on ob.BSNO=op_seae.BSNO ");
|
|
|
strSql.Append(" left join op_blissuelist_Detail obd on obd.BSNO=op_seae.BSNO ");
|
|
|
strSql.Append(" where isnull(op_seae.MBLNO,'')<>'' ");
|
|
|
strSql.Append(" ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD,sp.SPREMARK SPREMARK,sp.ISCHAOQI,sp.MNGBLSTATUS ");
|
|
|
strSql.Append(" ,CASE WHEN(select COUNT(*) from v_op_seae_iscargo where CUSTOMERNAME=ob.CUSTOMERNAME)>0 THEN '有' ELSE '无' END CUSTCARGOAFTER ");
|
|
|
*
|
|
|
*
|
|
|
*
|
|
|
*
|
|
|
*
|
|
|
*/
|
|
|
strSql.Append(" select obd.GID,B.BSNO,B.mblno BLNO,B.HBLNO ");
|
|
|
strSql.Append(" ,B.OPTYPE ZDFD ");
|
|
|
strSql.Append(" ,ob.BLNAME,ob.BLSTATUS,ob.BLORDERNO ");
|
|
|
strSql.Append(" ,B.ISSUETYPE,B.ISSUEPLACE ");
|
|
|
strSql.Append(" ,ob.OPNAME,ob.OPTIME,ob.BSINKNO,ob.ISVESSELPROVE,ob.VESSELPROVETIME,ob.VESSELPROVEREMARK ");
|
|
|
strSql.Append(" ,ob.REMARK,ob.DELFLAG,ob.EXPRESSCORP,ob.EXPRESSNO,ob.ISADD,dbo.trimdate(ob.PUTSINGLETIME) PUTSINGLETIME ");
|
|
|
strSql.Append(" ,ob.PUTSINGLE,ob.PAYTIME,ob.PAYRMB,ob.PAYUSD,obd.SPREMARK SPREMARK,'' ISCHAOQI,'' MNGBLSTATUS,'' CUSTCARGOAFTER ");
|
|
|
strSql.Append(" ,B.BLTYPE,B.CUSTNO,B.customername,B.sale ");
|
|
|
strSql.Append(" ,(select top 1 acctype from info_client_accdate where LINKGID=(select top 1 gid from info_client where SHORTNAME=B.customername) ");
|
|
|
strSql.Append(" and BGNDATE<=B.ETD and ENDDATE>B.ETD and (isnull(SALE,'')='' or SALE=B.SALE)) acctype ");
|
|
|
strSql.Append(" ,dbo.trimdate(B.ETD) ETD,dbo.trimdate(B.STLDATE) STLDATE,B.CARRIER,B.VESSEL,B.VOYNO,B.OP ,B.CUSTSERVICE,B.PORTLOAD,B.PORTDISCHARGE,B.DOC");
|
|
|
strSql.Append(" ,B.BLISSUESTATUS ");
|
|
|
strSql.Append(" ,obd.BLSTATUS TSFD ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,B.STLDATE) XYTS ");
|
|
|
strSql.Append(" ,datediff(day,B.STLDATE,getdate()) cqts ");
|
|
|
strSql.Append(" ,DATEDIFF(day,B.ETD,getdate()) SJTS ");
|
|
|
strSql.Append(" ,g.RMBDR-g.STLRMBDR RMBNODR ");
|
|
|
strSql.Append(" ,g.USDDR-g.STLUSDDR USDNODR ");
|
|
|
strSql.Append(" ,g.TTLDR-g.STLTTLDR TTLNODR ");
|
|
|
strSql.Append(" ,g.TTLDR TTLDR ");
|
|
|
strSql.Append(" ,B.OPLBNAME,B.STLNAME,0 ISQR,ob.QRDATE,ob.QCDATE,B.ISGAIQIAN ");
|
|
|
strSql.Append(" from v_op_blissue_bill B ");
|
|
|
strSql.Append(" left join op_blissue ob on ob.BSNO=B.BSNO ");
|
|
|
strSql.Append(" left join v_op_blissuelist_Detail obd on obd.BSNO=B.BSNO ");
|
|
|
strSql.Append(" left join v_op_gain_sum_ttl g on g.BSNO=B.BSNO ");
|
|
|
strSql.Append(" where isnull(B.MBLNO,'')<>'' ");
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(strCondition))
|
|
|
//{
|
|
|
// strSql.Append(" and " + strCondition.Replace("~", ""));//str.Replace("b","**");
|
|
|
//}
|
|
|
//var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
//if (!string.IsNullOrEmpty(sortstring))
|
|
|
//{
|
|
|
// strSql.Append(" order by " + sortstring);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// strSql.Append(" order by ob.OPTIME desc ");
|
|
|
//}
|
|
|
|
|
|
PagedQuaryParam pp = new PagedQuaryParam();
|
|
|
|
|
|
pp.strSql = strSql.ToString();
|
|
|
pp.start = start;
|
|
|
pp.limit = limit;
|
|
|
pp.strCondition = strCondition;
|
|
|
pp.defaultsortstr = "OPTIME desc";
|
|
|
pp.sortstring = sort;
|
|
|
|
|
|
var result = PagedQuaryStr(pp);
|
|
|
|
|
|
return SetData(result);
|
|
|
}
|
|
|
|
|
|
static public int DeleteDetail ( string LINKGID, string GIDList )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
if (GIDList != "")
|
|
|
{
|
|
|
strSql.Append(" delete from op_blissuelist_detail where GID in(" + GIDList + ") ");
|
|
|
strSql.Append(" update op_blissuelist set CustomerName='',SALEDEPT='',STLNAME='' where (select count(*) from op_blissuelist_detail where linkgid=op_blissuelist.GID)=0 ");
|
|
|
}
|
|
|
|
|
|
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
return _count;
|
|
|
}
|
|
|
|
|
|
static public int ResetSPAmount ( string GID )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(" update OP_BLISSUEList set RMBNODR= ");
|
|
|
strSql.Append(" (select sum(RMBDR-STLRMBDR) RMBNODR from v_op_gain_sum_ttl ");
|
|
|
strSql.Append(" where bsno in(select bsno from OP_BLISSUEList_detail where linkgid='"+GID+"')), ");
|
|
|
strSql.Append(" USDNODR= ");
|
|
|
strSql.Append(" (select sum(USDDR-STLUSDDR) USDNODR from v_op_gain_sum_ttl ");
|
|
|
strSql.Append(" where bsno in(select bsno from OP_BLISSUEList_detail where linkgid='"+GID+"')), ");
|
|
|
strSql.Append(" TTLNODR= ");
|
|
|
strSql.Append(" (select sum(TTLDR-STLTTLDR) TTLNODR from v_op_gain_sum_ttl ");
|
|
|
strSql.Append(" where bsno in(select bsno from OP_BLISSUEList_detail where linkgid='" + GID + "')) ");
|
|
|
strSql.Append(" where GID='"+GID+"' ");
|
|
|
var _count = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
_count = db.ExecuteNonQuery(CommandType.Text, strSql.ToString());
|
|
|
|
|
|
return _count;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
//判断特殊放单单号是否重复
|
|
|
static public int GetRdCount ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT Count(GID) AS CT from Op_BLISSUEList (NOLOCK) ");
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
#region 审核流程
|
|
|
|
|
|
#region 新_签入
|
|
|
public static DBResult QR ( List<MsOp_BLISSUEmb> _List, string USERID,string qrdate,string username,string reason ) //签入
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, _bill.GID, USERID);
|
|
|
/*
|
|
|
if (WorkResult.Success == true)
|
|
|
{*/
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='提单签入',QRDATE='" + qrdate + "' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var CT = T_ALL_DA.GetStrSQL("CT", "SELECT ISNULL(SUM(CASE ACTNAME WHEN '提单签入' THEN 1 ELSE 0 END),0) CT FROM WorkLog WHERE (ACTNAME='提单签入' OR ACTNAME='取消签入') AND BSNO='" + _bill.GID + "'");
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "提单签入";
|
|
|
if (reason != "") reason = "_" + reason;
|
|
|
log.REMARK = (Convert.ToInt32(CT) + 1).ToString() + "次签入"+ reason;
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS='提单签入' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='提单签入' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='提单签入' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
var blUpSQL = db.GetSqlStringCommand("insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','提单签入','提单签入','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')");
|
|
|
db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
var blUpSQL2 = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP,REMARK) values(NEWID(),'" + _bill.BSNO + "','提单签入',1,'" + qrdate + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','"+username+"','"+ log.REMARK + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL2, tran);
|
|
|
|
|
|
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
//DataSet dsHSCODE = T_ALL_DA.GetAllSQL("SELECT MBLNO,(SELECT TOP 1 GID FROM [user] where SHOWNAME=V_OP_BS.OP) OPID FROM V_OP_BS WHERE BSNO='" + _bill.BSNO + "'");
|
|
|
//if (dsHSCODE != null)
|
|
|
//{
|
|
|
// if (dsHSCODE.Tables[0].Rows.Count > 0)
|
|
|
// {
|
|
|
// var Msgdata = new SYSMessagemb();
|
|
|
// Msgdata.GID = Guid.NewGuid().ToString();
|
|
|
// Msgdata.NAME = "SALEORDER";
|
|
|
// Msgdata.DESCRIPTION = "提单签入";
|
|
|
// Msgdata.MESSAGECONTENT = "提单号:" + dsHSCODE.Tables[0].Rows[0]["MBLNO"].ToString() + "已签入";
|
|
|
// Msgdata.RECEIVER = dsHSCODE.Tables[0].Rows[0]["OPID"].ToString();
|
|
|
// Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
// Msgdata.ISREAD = "0";
|
|
|
// Msgdata.READCOUNT = "0";
|
|
|
// Msgdata.TYPE = "0";
|
|
|
// Msgdata.TASKURL = "";
|
|
|
// Msgdata.TASKID = _bill.BSNO;
|
|
|
// Msgdata.NUMBER = "0";
|
|
|
// Msgdata.RECVTYPE = "2";
|
|
|
// Msgdata.DbOperationType = DbOperationType.DbotIns;
|
|
|
// Msgdata.ModelUIStatus = "I";
|
|
|
|
|
|
// var Msgmodb = new ModelObjectRepository();
|
|
|
// Msgmodb.Save(Msgdata);
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult UnQR ( List<MsOp_BLISSUEmb> _List, string USERID,string username) //签入_撤回
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
//if (WorkResult.Success == true)
|
|
|
//{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS=(case when (select count(1) from worklog where BSNO=@GID and actname='放单通知')>0 then '放单通知' "
|
|
|
+ " else '' end),QRDATE='' where GID=@GID and BLSTATUS ='提单签入' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "取消签入";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS='' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','取消提单签入','取消提单签入','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// result.Success = false;
|
|
|
// result.Message = "提交错误!";
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult CZQR(List<MsOp_BLISSUEmb> _List, string USERID, string CZQRDATE, string CZQRREMARK) //签入
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, _bill.GID, USERID);
|
|
|
/*
|
|
|
if (WorkResult.Success == true)
|
|
|
{*/
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set ISVESSELPROVE=1,VESSELPROVETIME='" + CZQRDATE + "',VESSELPROVEREMARK='" + CZQRREMARK + "' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "船证签入";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
/*}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult UnCZQR(List<MsOp_BLISSUEmb> _List, string USERID) //签入_撤回
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
//if (WorkResult.Success == true)
|
|
|
//{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set ISVESSELPROVE='0',VESSELPROVETIME=null,VESSELPROVEREMARK='' where GID=@GID and ISVESSELPROVE='1' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "船证取消签入";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// result.Success = false;
|
|
|
// result.Message = "提交错误!";
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#region
|
|
|
public static DBResult GGTD(List<MsOp_BLISSUEmb> _List,string status, string USERID, string username) //签入
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='"+ status + "' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "'"+status+"'";
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS='"+ status + "' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='"+ status + "' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='"+ status + "' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
var blUpSQL = db.GetSqlStringCommand("insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','"+ status + "','"+ status + "','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')");
|
|
|
db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
var blUpSQL2 = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + _bill.BSNO + "','"+ status + "',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + username + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL2, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 换签背书
|
|
|
|
|
|
public static DBResult HQBS ( List<MsOp_BLISSUEmb> _List, string USERID,string username) //申请签入_驳回
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='换签(背书)' where GID=@GID and BLSTATUS not in ('扣单') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "换签(背书)";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS='换签(背书)' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='换签(背书)' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='换签(背书)' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','换签背书','换签背书','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static DBResult UnHQBS(List<MsOp_BLISSUEmb> _List, string USERID,string username) //申请签入_驳回
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='提单签入' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "取消换签(背书)";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS='提单签入' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='提单签入' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='提单签入' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','取消换签背书','取消换签背书','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
public static DBResult QC ( List<MsOp_BLISSUEmb> _List, string USERID, string REASON,string qcdate,string username ) //申请签入_驳回
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='提单签出',QCDATE='" + qcdate + "' where GID=@GID and BLSTATUS not in ('扣单') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var CT = T_ALL_DA.GetStrSQL("CT", "SELECT ISNULL(SUM(CASE ACTNAME WHEN '提单签出' THEN 1 ELSE 0 END),0) CT FROM WorkLog WHERE (ACTNAME='提单签出' OR ACTNAME='取消签出') AND BSNO='" + _bill.GID + "'");
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
// log.REMARK = REASON;
|
|
|
log.ACTNAME = "提单签出";
|
|
|
if (REASON != "") REASON = "_" + REASON;
|
|
|
log.REMARK = (Convert.ToInt32(CT) + 1).ToString() + "次签出"+REASON;
|
|
|
SaveLog(log, USERID);
|
|
|
var cmdupdate2 = db.GetSqlStringCommand( " update op_seae set BLISSUESTATUS='提单签出' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='提单签出' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='提单签出' where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
var blUpSQL = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP,REMARK) values(NEWID(),'" + _bill.BSNO + "','提单签出',1,'" + qcdate + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','"+username+"','"+ log.REMARK + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','提单签出','提单签出','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult KD ( List<MsOp_BLISSUEmb> _List, string USERID,string username ) //
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='扣单' where GID=@GID and BLSTATUS ='签出' ");
|
|
|
if (_bill.BLSTATUS == "扣单")
|
|
|
{
|
|
|
cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS="
|
|
|
+ " (case when (select count(1) from worklog where BSNO=@GID and actname='放单通知')>0 then '放单通知' "
|
|
|
+ " else case when (select count(1) from worklog where BSNO=@GID and actname='提单签入')>0 then '提单签入' "
|
|
|
+ " else '' end end) where GID=@GID ");
|
|
|
}
|
|
|
else {
|
|
|
cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='扣单' where GID=@GID ");
|
|
|
}
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
if (_bill.BLSTATUS == "扣单")
|
|
|
{
|
|
|
log.ACTNAME = "取消扣单";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
log.ACTNAME = "扣单";
|
|
|
}
|
|
|
SaveLog(log, USERID);
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS=(SELECT BLSTATUS FROM op_blissue WHERE BSNO=@BSNO) where BSNO=@BSNO "
|
|
|
+ "update op_seae_billmanage set BLISSUESTATUS=(SELECT BLSTATUS FROM op_blissue WHERE BSNO=@BSNO) where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS=(SELECT BLSTATUS FROM op_blissue WHERE BSNO=@BSNO) where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
var blUpSQL2 = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + _bill.BSNO + "','"+ log.ACTNAME + "',1,GETDATE(),'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + username + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL2, tran);
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','扣单','扣单','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult FDTZ ( List<MsOp_BLISSUEmb> _List, string USERID,string REASON,string username ) //申请签入_驳回
|
|
|
{
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='放单通知' where GID=@GID "
|
|
|
+" update op_seae set BLISSUESTATUS='放单通知' where BSNO=@BSNO "
|
|
|
+ " update op_aire set BLISSUESTATUS='放单通知' where BSNO=@BSNO "
|
|
|
+ " update op_airi set BLISSUESTATUS='放单通知' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='放单通知' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='放单通知' where BSNO=@BSNO2 ");
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.REMARK = REASON;
|
|
|
log.ACTNAME = "放单通知";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
var blUpSQL2 = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + _bill.BSNO + "','放单通知',1,GETDATE(),'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + username + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL2, tran);
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','放单通知','放单通知','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult UNFDTZ(List<MsOp_BLISSUEmb> _List, string USERID,string username) //申请签入_驳回
|
|
|
{
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS="
|
|
|
+ " (case when (select count(1) from worklog where BSNO=@GID and actname='提单签入')>0 then '提单签入' "
|
|
|
+ " else '' end) where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "取消放单通知";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
var blUpSQL2 = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + _bill.BSNO + "','取消放单通知',1,GETDATE(),'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + username + "')");
|
|
|
db.ExecuteNonQuery(blUpSQL2, tran);
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','取消提单签出','取消提单签出','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员"+e.Message;
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult FDTZBACK(List<MsOp_BLISSUEmb> _List, string USERID) //申请签入_驳回
|
|
|
{
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='驳回放单通知' where GID=@GID "
|
|
|
+ " update op_seae set BLISSUESTATUS='驳回放单通知' where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS='驳回放单通知' where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS='驳回放单通知' where BSNO=@BSNO2 ");
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "驳回放单通知";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult QXQC ( List<MsOp_BLISSUEmb> _List, string USERID,string username ) //取消签出
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
//if (WorkResult.Success == true)
|
|
|
//{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS="
|
|
|
+ " (case when (select count(1) from worklog where BSNO=@GID and actname='放单通知')>0 then '放单通知' "
|
|
|
+ " else case when (select count(1) from worklog where BSNO=@GID and actname='提单签入')>0 then '提单签入' "
|
|
|
+ " else '' end end),QCDATE='' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "取消签出";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','取消提单签出','取消提单签出','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// result.Success = false;
|
|
|
// result.Message = "提交错误!";
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult REQR ( List<MsOp_BLISSUEmb> _List, string USERID ) //重新签入
|
|
|
{
|
|
|
//var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
//if (WorkResult.Success == true)
|
|
|
//{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='提单签入' where GID=@GID and BLSTATUS ='提单签出' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "重新签入";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
var cmdupdate2 = db.GetSqlStringCommand(" update op_seae set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO "
|
|
|
+ " update op_seae_billmanage set BLISSUESTATUS=(select blstatus from op_blissue where bsno=@BSNO) where AS_ID=@BSNO3 "
|
|
|
+ " update op_seai set BLISSUESTATUS==(select blstatus from op_blissue where bsno=@BSNO) where BSNO=@BSNO2 ");
|
|
|
cmdupdate2.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO2", DbType.String, _bill.BSNO);
|
|
|
db.AddInParameter(cmdupdate2, "@BSNO3", DbType.String, _bill.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// result.Success = false;
|
|
|
// result.Message = "提交错误!";
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 签入
|
|
|
public static DBResult SQQR ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签入
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, _bill.GID, USERID,_bill.MBLNO,_bill.GID,"");
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='待签入' where GID=@GID and BLSTATUS ='录入状态' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "申请签入";
|
|
|
|
|
|
SaveLog(log,USERID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SQQR_back ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签入_撤回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='录入状态' where GID=@GID and BLSTATUS ='待签入' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SQQR_Auditback ( List<MsOp_BLISSUEmb> _List, string USERID, string REASON ) //申请签入_驳回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo(WorkFlowName, _bill.GID, USERID,REASON);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='录入状态' where GID=@GID and BLSTATUS in ('待签入','已签入') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SQQR_Audit ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签入_驳回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_IN";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo(WorkFlowName, _bill.GID, USERID,_bill.MBLNO);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='已签入' where GID=@GID and BLSTATUS ='待签入' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 特殊放单 审核流程
|
|
|
|
|
|
public static DBResult SP_Start ( List<MsOp_BLISSUEListmb> _List, string USERID ) //签入
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_SP";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, _bill.GID, USERID,_bill.MBLNO,_bill.GID,"");
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
if (WorkResult.islast != true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='提交审核',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='"+USERID+"') where GID=@GID and BLSTATUS in('录入状态','驳回提交') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单申请提交";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='审核通过' where GID=@GID and BLSTATUS in('录入状态','驳回提交') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单申请自动通过";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
//var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + _bill.BSNO + "','提单签出','提单签出','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
//db.ExecuteNonQuery(blUpSQL, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = WorkResult.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SP_Back ( List<MsOp_BLISSUEListmb> _List, string USERID ) //签入_撤回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_SP";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='录入状态',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS ='提交审核' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单申请 撤回";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SP_Audit ( List<MsOp_BLISSUEListmb> _List, string USERID, string REASON ) //申请签入_驳回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_SP";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo(WorkFlowName, _bill.GID, USERID,_bill.MBLNO);
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
if (WorkResult.islast != true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='提交审核',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS in('提交审核') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单审核";
|
|
|
log.REMARK = REASON;
|
|
|
SaveLog(log, USERID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='审核通过',SPREMARK='"+REASON+"' where GID=@GID and BLSTATUS in('提交审核') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
//var cmdUpdate = db.GetSqlStringCommand(
|
|
|
// @"if (select bsno from op_blissue where bsno='" + _bill.BSNO + "') is null insert into op_close values(newid(),'" + bsno + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
// + "','" + Convert.ToString(Session["SHOWNAME"]) + "',null,'') else update op_close set BSCLOSETIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
// + "',BSCLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "' where BSNO='" + bsno + "' ");
|
|
|
|
|
|
//db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
//放单通知
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.REMARK = REASON;
|
|
|
log.ACTNAME = "特殊放单审核完成";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SP_AuditBack ( List<MsOp_BLISSUEListmb> _List, string USERID, string REASON ) //
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_SP";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo(WorkFlowName, _bill.GID, USERID,REASON);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set BLSTATUS='驳回提交',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单申请 驳回";
|
|
|
log.REMARK = REASON;
|
|
|
SaveLog(log, USERID);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 特放复核
|
|
|
public static DBResult MNGSP_Audit(List<MsOp_BLISSUEListmb> _List, string USERID) //申请签入_驳回
|
|
|
{
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set MNGBLSTATUS='审核通过' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
//var cmdUpdate = db.GetSqlStringCommand(
|
|
|
// @"if (select bsno from op_blissue where bsno='" + _bill.BSNO + "') is null insert into op_close values(newid(),'" + bsno + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
// + "','" + Convert.ToString(Session["SHOWNAME"]) + "',null,'') else update op_close set BSCLOSETIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
// + "',BSCLOSEOP='" + Convert.ToString(Session["SHOWNAME"]) + "' where BSNO='" + bsno + "' ");
|
|
|
|
|
|
//db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
//放单通知
|
|
|
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单复核完成";
|
|
|
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult MNGSP_AuditBack(List<MsOp_BLISSUEListmb> _List, string USERID) //
|
|
|
{
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissuelist set MNGBLSTATUS='驳回提交' where GID=@GID ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
var log = new WorkLogmb();
|
|
|
log.BSNO = _bill.GID;
|
|
|
log.ACTNAME = "特殊放单复核驳回";
|
|
|
SaveLog(log, USERID);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 申请正常放单
|
|
|
public static DBResult SQFD ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签出
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_FD";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, _bill.GID, USERID,_bill.MBLNO,_bill.GID,"");
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='申请放单',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS ='已签入' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SQFD_back ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签出_撤回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_FD";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, _bill.GID, USERID);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='已签入',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS ='申请放单' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SQFD_Auditback ( List<MsOp_BLISSUEmb> _List, string USERID, string REASON ) //申请签出_驳回
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_FD";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo(WorkFlowName, _bill.GID, USERID, REASON);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='已签入',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS in ('申请放单','准许放单') ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult SQFD_Audit ( List<MsOp_BLISSUEmb> _List, string USERID ) //申请签出_通过
|
|
|
{
|
|
|
var WorkFlowName = "MsOp_BLISSUE_FD";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
var result = new DBResult();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var _bill in _List)
|
|
|
{
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo(WorkFlowName, _bill.GID, USERID,_bill.MBLNO);
|
|
|
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update op_blissue set BLSTATUS='准许放单',OPTIME=getdate(),OPNAME=(select showname from [USER] where gid='" + USERID + "') where GID=@GID and BLSTATUS ='申请放单' ");
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
//db.AddInParameter(cmdupdate, "@AUDITDATE", DbType.String, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
db.AddInParameter(cmdupdate, "@GID", DbType.String, _bill.GID);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "提交成功";
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
//return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public static ContentResult SaveLog ( WorkLogmb data,string USERID )
|
|
|
{
|
|
|
var headData = data;//JsonConvert.Deserialize<WorkLogmb>(data);
|
|
|
|
|
|
|
|
|
headData.GID = System.Guid.NewGuid().ToString();
|
|
|
headData.OP = USERID ;
|
|
|
headData.OPDATE = System.DateTime.Now.ToString();
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.ModelUIStatus = "I";
|
|
|
|
|
|
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) };
|
|
|
}
|
|
|
|
|
|
#region 获取提单的放单相关信息
|
|
|
static public List<BLINFOmb> GetBLINFO(string BSNO)
|
|
|
{ //合同信息/商品信息
|
|
|
|
|
|
var BLISSUENOSHEN = MsSysParamSetDAL.GetData("PARAMNAME='BLISSUENOSHEN'");
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select vb.CUSTOMERNAME,(select ISSP from info_client where shortname=vb.CUSTOMERNAME) ISSP ");
|
|
|
strSql.Append(" ,C.ACCTYPE ,(g.RMBDR-g.STLRMBDR) RMBNODR,(g.USDDR-g.STLUSDDR) USDNODR,(g.TTLDR-g.STLTTLDR)TTLNODR , ");
|
|
|
strSql.Append(" isnull(dbo.trimdate(vb.stldate),'') stldate , CN.RMBNODR RMBNODR_All,CN.USDNODR USDNODR_All,CN.TTLNODR TTLNODR_All ");
|
|
|
strSql.Append(" , CN.ZLRMBNODR ZLRMBNODR_All,CN.ZLUSDNODR ZLUSDNODR_All,CN.ZLTTLNODR ZLTTLNODR_All ");
|
|
|
strSql.Append(" ,ISNULL(C.ALLOWAMOUNT,0) ALLOWAMOUNT,'' WFDHT,vb.SALE,vb.OPLBNAME,vb.ETD ");
|
|
|
strSql.Append(" from v_OP_bs VB ");
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" left join v_op_gain_sum_shen g on g.BSNO=vb.bsno left join V_Client_ACCDATE C ON (C.SHORTNAME=VB.CUSTOMERNAME and vb.ETD between c.BGNDATE and c.ENDDATE) ");
|
|
|
strSql.Append(" left join V_CUSTOMER_NODR_shen CN ON (CN.CUSTOMERNAME=VB.CUSTOMERNAME)");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" left join v_op_gain_sum g on g.BSNO=vb.bsno left join V_Client_ACCDATE C ON (C.SHORTNAME=VB.CUSTOMERNAME and vb.ETD between c.BGNDATE and c.ENDDATE) ");
|
|
|
strSql.Append(" left join V_CUSTOMER_NODR CN ON (CN.CUSTOMERNAME=VB.CUSTOMERNAME)");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BSNO))
|
|
|
{
|
|
|
// strSql.Append(" where vb.MBLNO='" + MBLNO +"'");//str.Replace("b","**");
|
|
|
if (!string.IsNullOrEmpty(BSNO))
|
|
|
{
|
|
|
strSql.Append(" where vb.BSNO in( " + BSNO + " )");//str.Replace("b","**");
|
|
|
}
|
|
|
}
|
|
|
return SetBLINFO(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<BLINFOmb> SetBLINFO(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<BLINFOmb>();
|
|
|
//var _nomsg = "";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
BLINFOmb data = new BLINFOmb();
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
#region Set DB data to Object
|
|
|
|
|
|
#region 结费类型
|
|
|
data.结费类型 = "";
|
|
|
if (reader["ISSP"] != DBNull.Value)
|
|
|
{
|
|
|
if (Convert.ToBoolean(reader["ISSP"]))
|
|
|
{
|
|
|
data.结费类型 = "注意:该客户是特批放单客户!" + "\n";
|
|
|
}
|
|
|
}
|
|
|
if (Convert.ToString(reader["ACCTYPE"]).Trim() == "")
|
|
|
{
|
|
|
data.结费类型 = data.结费类型 + "客户结费类型为:现结买单";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
data.结费类型 = data.结费类型 + "客户结费类型为:" + Convert.ToString(reader["ACCTYPE"]);
|
|
|
}
|
|
|
if (Convert.ToString(reader["ACCTYPE"]) == "约定天数")
|
|
|
{
|
|
|
//data.结费类型 = data.结费类型 + Convert.ToString(reader["stldays"]) + "天 ";
|
|
|
//string CUSTOMERNAME, string OPLBNAME, string BUSDATE, string SALE
|
|
|
var CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
var OPLBNAME = Convert.ToString(reader["OPLBNAME"]);
|
|
|
var BUSDATE = Convert.ToString(reader["ETD"]);
|
|
|
var SALE = Convert.ToString(reader["SALE"]);
|
|
|
|
|
|
data.结费类型 = data.结费类型 + MsInfoClientDAL.GetSTLDAYS(CUSTOMERNAME, OPLBNAME, BUSDATE, SALE).STLDAYS + "天 ";
|
|
|
}
|
|
|
data.结费类型 = data.结费类型 + ",结算日期为 " + Convert.ToString(reader["stldate"]) + "";
|
|
|
data.STLDATE = Convert.ToString(reader["stldate"]);
|
|
|
#endregion
|
|
|
|
|
|
#region 该业务是否 欠费超期
|
|
|
//var TTLNODR=0M;
|
|
|
if (reader["TTLNODR"] != DBNull.Value)
|
|
|
data.TTLNODR = data.TTLNODR + Convert.ToDecimal(reader["TTLNODR"]);
|
|
|
//var RMBNODR=0M;
|
|
|
if (reader["RMBNODR"] != DBNull.Value)
|
|
|
data.RMBNODR = data.RMBNODR + Convert.ToDecimal(reader["RMBNODR"]);
|
|
|
//var USDNODR=0M;
|
|
|
if (reader["USDNODR"] != DBNull.Value)
|
|
|
data.USDNODR = data.USDNODR + Convert.ToDecimal(reader["USDNODR"]);
|
|
|
#endregion
|
|
|
|
|
|
#region 累计欠费
|
|
|
data.TTLNODR_All = 0M;
|
|
|
if (reader["TTLNODR_All"] != DBNull.Value)
|
|
|
data.TTLNODR_All = Convert.ToDecimal(reader["TTLNODR_All"]);
|
|
|
|
|
|
data.RMBNODR_All = 0M;
|
|
|
if (reader["RMBNODR_All"] != DBNull.Value)
|
|
|
data.RMBNODR_All = Convert.ToDecimal(reader["RMBNODR_All"]);
|
|
|
|
|
|
data.USDNODR_All = 0M;
|
|
|
if (reader["USDNODR_All"] != DBNull.Value)
|
|
|
data.USDNODR_All = Convert.ToDecimal(reader["USDNODR_All"]);
|
|
|
|
|
|
data.ZLTTLNODR_All = 0M;
|
|
|
if (reader["ZLTTLNODR_All"] != DBNull.Value)
|
|
|
data.ZLTTLNODR_All = Convert.ToDecimal(reader["ZLTTLNODR_All"]);
|
|
|
|
|
|
data.ZLRMBNODR_All = 0M;
|
|
|
if (reader["ZLRMBNODR_All"] != DBNull.Value)
|
|
|
data.ZLRMBNODR_All = Convert.ToDecimal(reader["ZLRMBNODR_All"]);
|
|
|
|
|
|
data.ZLUSDNODR_All = 0M;
|
|
|
if (reader["ZLUSDNODR_All"] != DBNull.Value)
|
|
|
data.ZLUSDNODR_All = Convert.ToDecimal(reader["ZLUSDNODR_All"]);
|
|
|
|
|
|
|
|
|
var Rate_All = 0M;
|
|
|
if (data.TTLNODR_All > 0 && data.USDNODR_All > 0)
|
|
|
{
|
|
|
Rate_All = (data.TTLNODR_All - data.RMBNODR_All) / data.USDNODR_All;
|
|
|
}
|
|
|
var _Rate_All = Rate_All.ToString("#0.0000");
|
|
|
|
|
|
data.累计欠费 = data.InfoText + "累计未结算费用:"
|
|
|
+ "USD" + Convert.ToString(data.USDNODR_All)
|
|
|
+ " RMB" + Convert.ToString(data.RMBNODR_All)
|
|
|
+ ",合计" + Convert.ToString(data.TTLNODR_All);
|
|
|
|
|
|
var ALLOWAMOUNT = 0M;
|
|
|
if (reader["ALLOWAMOUNT"] != DBNull.Value)
|
|
|
ALLOWAMOUNT = Convert.ToDecimal(reader["ALLOWAMOUNT"]);
|
|
|
data.信用额度 = "信用额度:" + ALLOWAMOUNT;
|
|
|
|
|
|
if (ALLOWAMOUNT > data.TTLNODR_All)
|
|
|
{
|
|
|
data.IS累计欠费 = "no";
|
|
|
data.信用额度 = data.信用额度 + " 额度范围内";
|
|
|
}
|
|
|
|
|
|
else
|
|
|
{
|
|
|
if (data.TTLNODR_All != 0)
|
|
|
{
|
|
|
data.IS累计欠费 = "yes";
|
|
|
data.信用额度 = data.信用额度 + " <已超额>";
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
//headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
|
|
|
|
|
|
#region Set DB data to Object
|
|
|
#region 该业务欠费是否超期
|
|
|
|
|
|
var Rate = 0M;
|
|
|
if (data.TTLNODR > 0 && data.USDNODR > 0)
|
|
|
{
|
|
|
Rate = (data.TTLNODR - data.RMBNODR) / data.USDNODR;
|
|
|
}
|
|
|
var _Rate = Rate.ToString("#0.0000");
|
|
|
data.欠费超期 = "未结算费用:"
|
|
|
+ "USD" + Convert.ToString(data.USDNODR)
|
|
|
+ " RMB" + Convert.ToString(data.RMBNODR)
|
|
|
+ ",合计" + Convert.ToString(data.TTLNODR);
|
|
|
if (Rate != 0M)
|
|
|
{
|
|
|
data.欠费超期 = data.欠费超期 + "(" + _Rate + ")";
|
|
|
}
|
|
|
data.超期欠费 = "";
|
|
|
if (data.ZLTTLNODR_All != 0)
|
|
|
{
|
|
|
data.超期欠费 = "超期欠费:"
|
|
|
+ "USD" + Convert.ToString(data.ZLUSDNODR_All)
|
|
|
+ " RMB" + Convert.ToString(data.ZLRMBNODR_All)
|
|
|
+ ",合计" + Convert.ToString(data.ZLTTLNODR_All);
|
|
|
|
|
|
}
|
|
|
|
|
|
//data.欠费超期 = data.欠费超期 + "\n";
|
|
|
|
|
|
//data.欠费超期 = data.欠费超期 + "付款日期:" + data.STLDATE;
|
|
|
if (data.STLDATE != "")
|
|
|
{
|
|
|
if (System.DateTime.Now >= Convert.ToDateTime(data.STLDATE) && data.TTLNODR > 0)
|
|
|
{
|
|
|
data.IS欠费超期 = "yes";
|
|
|
data.结费类型 = data.结费类型 + " <span style=\"colorred\">已欠费超期</span>";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
data.IS欠费超期 = "no";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (data.TTLNODR != 0)
|
|
|
data.IS欠费超期 = "yes";
|
|
|
data.结费类型 = data.结费类型 + " 结算时间未知 ";
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
data.InfoText = data.结费类型 + "\n";
|
|
|
data.InfoText = data.InfoText + data.欠费超期 + "\n";
|
|
|
data.InfoText = data.InfoText + data.累计欠费 + "\n";
|
|
|
data.InfoText = data.InfoText + data.信用额度 + "\n";
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
static public List<BLINFOmb> GetBLINFO2 ( string BSNO )
|
|
|
{ //合同信息/商品信息
|
|
|
var BLISSUENOSHEN = MsSysParamSetDAL.GetData("PARAMNAME='BLISSUENOSHEN'");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" select vb.CUSTOMERNAME,(select ISSP from info_client where shortname=vb.CUSTOMERNAME) ISSP ");
|
|
|
strSql.Append(" ,C.ACCTYPE ,(g.RMBDR-g.STLRMBDR) RMBNODR,(g.USDDR-g.STLUSDDR) USDNODR,(g.TTLDR-g.STLTTLDR)TTLNODR , ");
|
|
|
strSql.Append(" isnull(dbo.trimdate(vb.stldate),'') stldate ");
|
|
|
strSql.Append(" ,ISNULL(C.ALLOWAMOUNT,0) ALLOWAMOUNT,'' WFDHT,vb.SALE,vb.OPLBNAME,vb.ETD ");
|
|
|
strSql.Append(" from v_OP_bs VB ");
|
|
|
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" left join v_op_gain_sum_shen g on g.BSNO=vb.bsno left join V_Client_ACCDATE C ON (C.SHORTNAME=VB.CUSTOMERNAME and vb.ETD between c.BGNDATE and c.ENDDATE) ");
|
|
|
}
|
|
|
else strSql.Append(" left join v_op_gain_sum_ttl g on g.BSNO=vb.bsno left join V_Client_ACCDATE C ON (C.SHORTNAME=VB.CUSTOMERNAME and vb.ETD between c.BGNDATE and c.ENDDATE) ");
|
|
|
// strSql.Append(" left join V_CUSTOMER_NODR CN ON (CN.CUSTOMERNAME=VB.CUSTOMERNAME)");
|
|
|
if (!string.IsNullOrEmpty(BSNO))
|
|
|
{
|
|
|
strSql.Append(" where vb.BSNO in( " + BSNO + " )");//str.Replace("b","**");
|
|
|
}
|
|
|
return SetBLINFO2(strSql);
|
|
|
}
|
|
|
private static List<BLINFOmb> SetBLINFO2 ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<BLINFOmb>();
|
|
|
//var _nomsg = "";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
BLINFOmb data = new BLINFOmb();
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
#region Set DB data to Object
|
|
|
|
|
|
#region 结费类型
|
|
|
data.结费类型 = "";
|
|
|
if (reader["ISSP"] != DBNull.Value)
|
|
|
{
|
|
|
if (Convert.ToBoolean(reader["ISSP"]))
|
|
|
{
|
|
|
data.结费类型 = "注意:该客户是特批放单客户!" + "\n";
|
|
|
}
|
|
|
}
|
|
|
if (Convert.ToString(reader["ACCTYPE"]).Trim() == "")
|
|
|
{
|
|
|
data.结费类型 = data.结费类型 + "客户结费类型为:现结买单";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
data.结费类型 = data.结费类型 + "客户结费类型为:" + Convert.ToString(reader["ACCTYPE"]);
|
|
|
}
|
|
|
if (Convert.ToString(reader["ACCTYPE"]) == "约定天数") {
|
|
|
//data.结费类型 = data.结费类型 + Convert.ToString(reader["stldays"]) + "天 ";
|
|
|
//string CUSTOMERNAME, string OPLBNAME, string BUSDATE, string SALE
|
|
|
var CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
var OPLBNAME = Convert.ToString(reader["OPLBNAME"]);
|
|
|
var BUSDATE = Convert.ToString(reader["ETD"]);
|
|
|
var SALE = Convert.ToString(reader["SALE"]);
|
|
|
|
|
|
data.结费类型 = data.结费类型 + MsInfoClientDAL.GetSTLDAYS(CUSTOMERNAME, OPLBNAME, BUSDATE, SALE).STLDAYS + "天 ";
|
|
|
}
|
|
|
data.结费类型 = data.结费类型 + ",结算日期为 " + Convert.ToString(reader["stldate"]) + "";
|
|
|
data.STLDATE = Convert.ToString(reader["stldate"]);
|
|
|
#endregion
|
|
|
|
|
|
#region 该业务是否 欠费超期
|
|
|
//var TTLNODR=0M;
|
|
|
if (reader["TTLNODR"] != DBNull.Value)
|
|
|
data.TTLNODR = data.TTLNODR + Convert.ToDecimal(reader["TTLNODR"]);
|
|
|
//var RMBNODR=0M;
|
|
|
if (reader["RMBNODR"] != DBNull.Value)
|
|
|
data.RMBNODR =data.RMBNODR+ Convert.ToDecimal(reader["RMBNODR"]);
|
|
|
//var USDNODR=0M;
|
|
|
if (reader["USDNODR"] != DBNull.Value)
|
|
|
data.USDNODR = data.USDNODR+Convert.ToDecimal(reader["USDNODR"]);
|
|
|
#endregion
|
|
|
|
|
|
#region 累计欠费
|
|
|
//data.TTLNODR_All = 0M;
|
|
|
//if (reader["TTLNODR_All"] != DBNull.Value)
|
|
|
// data.TTLNODR_All = Convert.ToDecimal(reader["TTLNODR_All"]);
|
|
|
|
|
|
//data.RMBNODR_All = 0M;
|
|
|
//if (reader["RMBNODR_All"] != DBNull.Value)
|
|
|
// data.RMBNODR_All = Convert.ToDecimal(reader["RMBNODR_All"]);
|
|
|
|
|
|
//data.USDNODR_All = 0M;
|
|
|
//if (reader["USDNODR_All"] != DBNull.Value)
|
|
|
// data.USDNODR_All = Convert.ToDecimal(reader["USDNODR_All"]);
|
|
|
|
|
|
//data.ZLTTLNODR_All = 0M;
|
|
|
//if (reader["ZLTTLNODR_All"] != DBNull.Value)
|
|
|
// data.ZLTTLNODR_All = Convert.ToDecimal(reader["ZLTTLNODR_All"]);
|
|
|
|
|
|
//data.ZLRMBNODR_All = 0M;
|
|
|
//if (reader["ZLRMBNODR_All"] != DBNull.Value)
|
|
|
// data.ZLRMBNODR_All = Convert.ToDecimal(reader["ZLRMBNODR_All"]);
|
|
|
|
|
|
//data.ZLUSDNODR_All = 0M;
|
|
|
//if (reader["ZLUSDNODR_All"] != DBNull.Value)
|
|
|
// data.ZLUSDNODR_All = Convert.ToDecimal(reader["ZLUSDNODR_All"]);
|
|
|
|
|
|
|
|
|
//var Rate_All = 0M;
|
|
|
//if (data.TTLNODR_All > 0 && data.USDNODR_All > 0)
|
|
|
//{
|
|
|
// Rate_All = (data.TTLNODR_All - data.RMBNODR_All) / data.USDNODR_All;
|
|
|
//}
|
|
|
//var _Rate_All = Rate_All.ToString("#0.0000");
|
|
|
|
|
|
//data.累计欠费 = data.InfoText + "累计未结算费用:"
|
|
|
// + "USD" + Convert.ToString(data.USDNODR_All)
|
|
|
// + " RMB" + Convert.ToString(data.RMBNODR_All)
|
|
|
// + ",合计" + Convert.ToString(data.TTLNODR_All) ;
|
|
|
|
|
|
var ALLOWAMOUNT = 0M;
|
|
|
if (reader["ALLOWAMOUNT"] != DBNull.Value)
|
|
|
ALLOWAMOUNT = Convert.ToDecimal(reader["ALLOWAMOUNT"]);
|
|
|
data.信用额度 = "信用额度:" + ALLOWAMOUNT;
|
|
|
|
|
|
if (ALLOWAMOUNT > data.TTLNODR_All)
|
|
|
{
|
|
|
data.IS累计欠费 = "no";
|
|
|
data.信用额度 = data.信用额度 + " 额度范围内";
|
|
|
}
|
|
|
|
|
|
else
|
|
|
{
|
|
|
if (data.TTLNODR_All != 0)
|
|
|
{
|
|
|
data.IS累计欠费 = "yes";
|
|
|
data.信用额度 = data.信用额度 + " <已超额>";
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
//headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
|
|
|
|
|
|
#region Set DB data to Object
|
|
|
#region 该业务欠费是否超期
|
|
|
|
|
|
var Rate = 0M;
|
|
|
if (data.TTLNODR > 0 && data.USDNODR > 0)
|
|
|
{
|
|
|
Rate = (data.TTLNODR - data.RMBNODR) / data.USDNODR;
|
|
|
}
|
|
|
var _Rate = Rate.ToString("#0.0000");
|
|
|
data.欠费超期 = "未结算费用:"
|
|
|
+ "USD" + Convert.ToString(data.USDNODR)
|
|
|
+ " RMB" + Convert.ToString(data.RMBNODR)
|
|
|
+ ",合计" + Convert.ToString(data.TTLNODR);
|
|
|
if (Rate != 0M)
|
|
|
{
|
|
|
data.欠费超期 = data.欠费超期 + "(" + _Rate + ")";
|
|
|
}
|
|
|
data.超期欠费 = "";
|
|
|
if (data.ZLTTLNODR_All != 0) {
|
|
|
data.超期欠费 = "超期欠费:"
|
|
|
+ "USD" + Convert.ToString(data.ZLUSDNODR_All)
|
|
|
+ " RMB" + Convert.ToString(data.ZLRMBNODR_All)
|
|
|
+ ",合计" + Convert.ToString(data.ZLTTLNODR_All);
|
|
|
|
|
|
}
|
|
|
|
|
|
//data.欠费超期 = data.欠费超期 + "\n";
|
|
|
|
|
|
//data.欠费超期 = data.欠费超期 + "付款日期:" + data.STLDATE;
|
|
|
if (data.STLDATE != "")
|
|
|
{
|
|
|
if (System.DateTime.Now >= Convert.ToDateTime(data.STLDATE) && data.TTLNODR > 0)
|
|
|
{
|
|
|
data.IS欠费超期 = "yes";
|
|
|
data.结费类型 = data.结费类型 + " <span style=\"colorred\">已欠费超期</span>";
|
|
|
}
|
|
|
else {
|
|
|
data.IS欠费超期 = "no";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (data.TTLNODR!=0)
|
|
|
data.IS欠费超期 = "yes";
|
|
|
data.结费类型 = data.结费类型 + " 结算时间未知 ";
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
data.InfoText = data.结费类型 + "\n";
|
|
|
data.InfoText = data.InfoText + data.欠费超期 + "\n";
|
|
|
data.InfoText = data.InfoText + data.累计欠费 + "\n";
|
|
|
data.InfoText = data.InfoText + data.信用额度 + "\n";
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
|
|
|
}
|
|
|
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
static public List<BLINFOLIST> GetBLINFOLIST(string CUSTNAME, string SALE)
|
|
|
{ //合同信息/商品信息
|
|
|
|
|
|
var BLISSUENOSHEN = MsSysParamSetDAL.GetData("PARAMNAME='BLISSUENOSHEN'");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT '委托单位:'+CUSTOMERNAME+'('+SALE+')' INFOTEXT, SUM(RMBNODR) RMBNODR,SUM(USDNODR) USDNODR,SUM(TTLNODR) TTLNODR");
|
|
|
strSql.Append(",SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN RMBNODR ELSE 0 END) CRMBNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN USDNODR ELSE 0 END) CUSDNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN TTLNODR ELSE 0 END) CTTLNODR");
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" from v_op_bill_gain_shen WHERE CUSTOMERNAME='" + CUSTNAME + "' and SALE='" + SALE + "'");
|
|
|
}
|
|
|
else strSql.Append(" from v_op_bill_gain WHERE CUSTOMERNAME='" + CUSTNAME + "' and SALE='" + SALE + "'");
|
|
|
strSql.Append(" GROUP BY CUSTOMERNAME,SALE ");
|
|
|
strSql.Append(" UNION");
|
|
|
strSql.Append(" SELECT '委托单位:'+CUSTOMERNAME INFOTEXT, SUM(RMBNODR) RMBNODR,SUM(USDNODR) USDNODR,SUM(TTLNODR) TTLNODR");
|
|
|
strSql.Append(",SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN RMBNODR ELSE 0 END) CRMBNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN USDNODR ELSE 0 END) CUSDNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN TTLNODR ELSE 0 END) CTTLNODR");
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" from v_op_bill_gain_shen WHERE CUSTOMERNAME='" + CUSTNAME + "' ");
|
|
|
} else
|
|
|
strSql.Append(" from v_op_bill_gain WHERE CUSTOMERNAME='" +CUSTNAME+ "' ");
|
|
|
strSql.Append(" GROUP BY CUSTOMERNAME ");
|
|
|
strSql.Append(" UNION");
|
|
|
strSql.Append(" SELECT '结算单位:'+CUSTNAME+'('+SALE+')' INFOTEXT, SUM(RMBNODR) RMBNODR,SUM(USDNODR) USDNODR,SUM(TTLNODR) TTLNODR");
|
|
|
strSql.Append(",SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN RMBNODR ELSE 0 END) CRMBNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN USDNODR ELSE 0 END) CUSDNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN TTLNODR ELSE 0 END) CTTLNODR");
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" from v_op_bill_cust_gain_shen WHERE CUSTNAME='" + CUSTNAME + "' and SALE='" + SALE + "'");
|
|
|
} else
|
|
|
strSql.Append(" from v_op_bill_cust_gain WHERE CUSTNAME='"+CUSTNAME+"' and SALE='"+SALE+"'");
|
|
|
strSql.Append(" GROUP BY CUSTNAME,SALE ");
|
|
|
strSql.Append(" UNION");
|
|
|
strSql.Append(" SELECT '结算单位:'+CUSTNAME INFOTEXT, SUM(RMBNODR) RMBNODR,SUM(USDNODR) USDNODR,SUM(TTLNODR) TTLNODR");
|
|
|
strSql.Append(",SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN RMBNODR ELSE 0 END) CRMBNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN USDNODR ELSE 0 END) CUSDNODR,");
|
|
|
strSql.Append("SUM(CASE WHEN (DATEDIFF([day],ISNULL(STLDATE,ETD),GETDATE())>0) THEN TTLNODR ELSE 0 END) CTTLNODR");
|
|
|
if (BLISSUENOSHEN.PARAMVALUE == "1")
|
|
|
{
|
|
|
strSql.Append(" from v_op_bill_cust_gain_shen WHERE CUSTNAME='" + CUSTNAME + "'");
|
|
|
} else
|
|
|
strSql.Append(" from v_op_bill_cust_gain WHERE CUSTNAME='"+CUSTNAME+"'");
|
|
|
strSql.Append(" GROUP BY CUSTNAME ");
|
|
|
|
|
|
return SetBLINFOLIST(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<BLINFOLIST> SetBLINFOLIST(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<BLINFOLIST>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
BLINFOLIST data = new BLINFOLIST();
|
|
|
#region Set DB data to Object
|
|
|
data.INFOTEXT = Convert.ToString(reader["INFOTEXT"]);
|
|
|
data.RMBNODR = Convert.ToString(reader["RMBNODR"]) + "(" + Convert.ToString(reader["CRMBNODR"]) + ")";
|
|
|
data.USDNODR = Convert.ToString(reader["USDNODR"]) + "(" + Convert.ToString(reader["CUSDNODR"]) + ")";
|
|
|
data.TTLNODR = Convert.ToString(reader["TTLNODR"]) + "(" + Convert.ToString(reader["CTTLNODR"]) + ")";
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 附件处理
|
|
|
|
|
|
#region FileList
|
|
|
static public List<DSWeb.Areas.TruckMng.Models.MsUpLoadFile> GetUpLoadFileList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT ");
|
|
|
strSql.Append("GID,PID,FILENAME,FILETYPE,IMGFILE,UPLOADEMPLY,UPLOADDATE,FILEPATH");
|
|
|
|
|
|
strSql.Append(" from info_files ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
return SetUpLoadFileData(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
private static List<DSWeb.Areas.TruckMng.Models.MsUpLoadFile> SetUpLoadFileData ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<DSWeb.Areas.TruckMng.Models.MsUpLoadFile>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
DSWeb.Areas.TruckMng.Models.MsUpLoadFile data = new DSWeb.Areas.TruckMng.Models.MsUpLoadFile();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.PID = Convert.ToString(reader["PID"]);
|
|
|
data.UPLOADEMPLY = Convert.ToString(reader["UPLOADEMPLY"]);
|
|
|
data.UPLOADDATE = Convert.ToString(reader["UPLOADDATE"]);
|
|
|
data.FILETYPE = Convert.ToString(reader["FILETYPE"]);
|
|
|
data.FILENAME = Convert.ToString(reader["FILENAME"]);
|
|
|
data.FILEPATH = Convert.ToString(reader["FILEPATH"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
public static bool UpdateFileData ( HttpRequestBase request, string filename, string fileurl, string GID, out string msg )
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
|
|
|
Stream stream = new FileStream(filename, FileMode.Open);
|
|
|
|
|
|
byte[] data = new byte[stream.Length];
|
|
|
stream.Read(data, 0, data.Length);
|
|
|
stream.Close();
|
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
const string insertSql = @"update info_files set IMGFILE=@Image,FILEPATH=@FILEPATH where GID=@GID";
|
|
|
|
|
|
|
|
|
SqlParameter[] updateParms = new SqlParameter[] {
|
|
|
new SqlParameter("@GID",SqlDbType.VarChar),
|
|
|
new SqlParameter("@Image",SqlDbType.Image),
|
|
|
new SqlParameter("@FILEPATH",SqlDbType.VarChar)
|
|
|
};
|
|
|
|
|
|
updateParms[0].Value = GID;
|
|
|
updateParms[1].Value = data;
|
|
|
updateParms[2].Value = fileurl;
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, insertSql, updateParms);
|
|
|
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
isSucess = true;//状态为1表示插入成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
isSucess = false;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
msg = execError.Message;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
static public int SaveFileList ( IList<DSWeb.Areas.TruckMng.Models.MsUpLoadFile> tempFileEntities, string tempBSNO )
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
const string SQL_INSERT = @"insert info_files (GID,PID,UPLOADEMPLY,UPLOADDATE,FILENAME,FILETYPE) VALUES(@GID,@PID,@UPLOADEMPLY,@UPLOADDATE,@FILENAME,@FILETYPE) ";
|
|
|
const string SQL_UPDATE = @"update info_files SET FILENAME=@FILENAME where GID=@GID";
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (DSWeb.Areas.TruckMng.Models.MsUpLoadFile fileEntity in tempFileEntities)
|
|
|
{
|
|
|
if (fileEntity.PID == "*" || fileEntity.PID == "")
|
|
|
{
|
|
|
SqlParameter[] insertParms = new SqlParameter[] {
|
|
|
new SqlParameter("@GID",SqlDbType.VarChar),
|
|
|
new SqlParameter("@PID",SqlDbType.VarChar),
|
|
|
new SqlParameter("@UPLOADEMPLY",SqlDbType.VarChar),
|
|
|
new SqlParameter("@UPLOADDATE",SqlDbType.VarChar),
|
|
|
new SqlParameter("@FILENAME",SqlDbType.VarChar),
|
|
|
new SqlParameter("@FILETYPE",SqlDbType.VarChar)
|
|
|
|
|
|
};
|
|
|
|
|
|
insertParms[0].Value = fileEntity.GID;
|
|
|
insertParms[1].Value = tempBSNO;
|
|
|
insertParms[2].Value = fileEntity.UPLOADEMPLY;
|
|
|
insertParms[3].Value = fileEntity.UPLOADDATE;
|
|
|
insertParms[4].Value = fileEntity.FILENAME;
|
|
|
insertParms[5].Value = fileEntity.FILETYPE;
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_INSERT, insertParms);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SqlParameter[] updateParms = new SqlParameter[] {
|
|
|
new SqlParameter("@FILENAME",SqlDbType.VarChar)
|
|
|
|
|
|
};
|
|
|
|
|
|
updateParms[0].Value = fileEntity.GID;
|
|
|
updateParms[1].Value = tempBSNO;
|
|
|
updateParms[2].Value = fileEntity.UPLOADEMPLY;
|
|
|
updateParms[3].Value = fileEntity.UPLOADDATE;
|
|
|
updateParms[4].Value = fileEntity.FILENAME;
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE, updateParms);
|
|
|
}
|
|
|
}
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
iResult = 1;//状态为1表示插入成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
static public int DeleteUploadFile ( string tempGId )
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("Delete from info_files where ");
|
|
|
strSql.Append(" GId in (" + tempGId + ")");
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, strSql.ToString());
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
iResult = 1;//状态为1表示插入成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,插入失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//插入异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public static string GetSPRangDAStr(string tb, string userid, string username, string companyid)
|
|
|
{
|
|
|
string str = "";
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT ");
|
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE,AUTHORITYID,VSSQL ");
|
|
|
strSql.Append(" from VW_User_Authority ");
|
|
|
strSql.Append(" where [NAME]='" + tb + "' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
|
string visiblerange = "4";
|
|
|
string operaterange = "4";
|
|
|
string AUTHORITYID = "";
|
|
|
string VSSQL = "";
|
|
|
|
|
|
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"]);
|
|
|
VSSQL = Convert.ToString(reader["VSSQL"]);
|
|
|
break;
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
if (visiblerange == "4")
|
|
|
{
|
|
|
str = " (ob.OPNAME='" + username + "')";
|
|
|
}
|
|
|
else if (visiblerange == "3")
|
|
|
{
|
|
|
str = " (ob.OPNAME='" + username + "')";
|
|
|
}
|
|
|
else if (visiblerange == "2")
|
|
|
{
|
|
|
var rangeDa = new RangeDA();
|
|
|
var deptid = rangeDa.GetDEPTGID(userid);
|
|
|
str = " ob.OPNAME in (select SHOWNAME from vw_user where deptid='" + deptid + "') ";
|
|
|
}
|
|
|
else if (visiblerange == "1")
|
|
|
{
|
|
|
str = " ob.OPNAME in (select SHOWNAME from vw_user where COMPANYID='" + companyid + "') ";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "5")
|
|
|
{
|
|
|
str = " ob.OPNAME in (select SHOWNAME from vw_user where COMPANYID IN (select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1)) ";
|
|
|
//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 = " (COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "'";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// str = str + " or COMPANYID='" + Convert.ToString(reader["COMPANYID"]) + "'";
|
|
|
// };
|
|
|
// }
|
|
|
// str = str + ")";
|
|
|
// reader.Close();
|
|
|
//}
|
|
|
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "6")
|
|
|
{
|
|
|
|
|
|
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()))
|
|
|
{
|
|
|
str = "";
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
if (str == "")
|
|
|
{
|
|
|
str = " (ob.OPNAME='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = str + " or ob.OPNAME='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
};
|
|
|
}
|
|
|
str = str + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (visiblerange == "0")
|
|
|
{
|
|
|
str = " 1=1 ";
|
|
|
}
|
|
|
VSSQL = VSSQL.Trim();
|
|
|
if (!string.IsNullOrEmpty(VSSQL))
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
{
|
|
|
str = str + " and (" + VSSQL + ") ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (" + VSSQL + ") ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|