From a1394d8f3b96c60e322946430045b26ecf8a7bee Mon Sep 17 00:00:00 2001 From: ddlucky Date: Thu, 23 Feb 2023 18:04:40 +0800 Subject: [PATCH] =?UTF-8?q?20230223-=E9=92=89=E9=92=89=E9=80=9A=E8=AE=AF?= =?UTF-8?q?=E5=BD=95=E8=AF=BB=E5=8F=96-=E5=BC=80=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + BookingJieFeng/BookingJieFeng.csproj.user | 39 - BookingWeb/BookingWeb.csproj.user | 39 - DSWeb.Service.Output.DS7/App.config | 2 +- DSWeb.Service.Output.DS7/DS7DataContext.cs | 31 + .../DSWeb.Service.Output.DS7.csproj | 1 + .../DingtalkUserListService.cs | 1010 +++++++++++++++++ DSWeb.Service.Output.DS7/说明.txt | 4 +- .../Controllers/PublicAPIController.cs | 11 + DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs | 12 + DSWeb/DSWeb.csproj.user | 40 - DispatchWeb/DispatchWeb.csproj.user | 38 - 12 files changed, 1073 insertions(+), 158 deletions(-) delete mode 100644 BookingJieFeng/BookingJieFeng.csproj.user delete mode 100644 BookingWeb/BookingWeb.csproj.user create mode 100644 DSWeb.Service.Output.DS7/DingtalkUserListService.cs delete mode 100644 DSWeb/DSWeb.csproj.user delete mode 100644 DispatchWeb/DispatchWeb.csproj.user diff --git a/.gitignore b/.gitignore index 6227e48d..08a094cf 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,7 @@ DispatchWeb/DispatchWeb.csproj.user DSWeb/Properties/PublishProfiles/FolderProfile.pubxml /UpdateSQL/update.ldb /DSWeb/EDIFiles/SeaeEdi +/BookingJieFeng/BookingJieFeng.csproj.user +/BookingWeb/BookingWeb.csproj.user +/DispatchWeb/DispatchWeb.csproj.user +/DSWeb/DSWeb.csproj.user diff --git a/BookingJieFeng/BookingJieFeng.csproj.user b/BookingJieFeng/BookingJieFeng.csproj.user deleted file mode 100644 index 28be9c4c..00000000 --- a/BookingJieFeng/BookingJieFeng.csproj.user +++ /dev/null @@ -1,39 +0,0 @@ - - - - Release|Any CPU - FolderProfile - true - - - - - - - - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - True - True - - - - - \ No newline at end of file diff --git a/BookingWeb/BookingWeb.csproj.user b/BookingWeb/BookingWeb.csproj.user deleted file mode 100644 index 4edb5e0f..00000000 --- a/BookingWeb/BookingWeb.csproj.user +++ /dev/null @@ -1,39 +0,0 @@ - - - - Release|Any CPU - true - - - - - - - FolderProfile - - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - True - True - - - - - \ No newline at end of file diff --git a/DSWeb.Service.Output.DS7/App.config b/DSWeb.Service.Output.DS7/App.config index 8918e8ec..c1eaec81 100644 --- a/DSWeb.Service.Output.DS7/App.config +++ b/DSWeb.Service.Output.DS7/App.config @@ -35,7 +35,7 @@ - + diff --git a/DSWeb.Service.Output.DS7/DS7DataContext.cs b/DSWeb.Service.Output.DS7/DS7DataContext.cs index 9308d1cd..44d4e5f8 100644 --- a/DSWeb.Service.Output.DS7/DS7DataContext.cs +++ b/DSWeb.Service.Output.DS7/DS7DataContext.cs @@ -39,6 +39,7 @@ namespace DSWeb.Service.Output.DS7 public DbSet op_seae_edi { get; set; } public DbSet op_seae_edi_ctn { get; set; } + public DbSet code_employee { get; set; } } [Table("op_seae")] @@ -1270,4 +1271,34 @@ namespace DSWeb.Service.Output.DS7 public string CTNOWNER { get; set; } } + + [Table("code_employee")] + + public partial class code_employee_md + { + [Key] + public string GID { get; set; } + public string USERNAME { get; set; } + public string SEX { get; set; } + public DateTime? ENROLLTIME { get; set; } + public DateTime? BIRTHDAY { get; set; } + public string OFFICEPHONE { get; set; } + public string HOMEPHONE { get; set; } + public string MOBILE { get; set; } + public string EMAIL1 { get; set; } + public string EMAIL2 { get; set; } + public string HOMEADDRESS { get; set; } + public string DEPTNAME { get; set; } + public string STATUS { get; set; } + public DateTime? LEAVEOFFICETIME { get; set; } + public string CREATEUSER { get; set; } + public DateTime? CREATETIME { get; set; } + public string MODIFIEDUSER { get; set; } + public DateTime? MODIFIEDTIME { get; set; } + public string REMARK { get; set; } + public string CORPID { get; set; } + public string USERCODE { get; set; } + public string OFFICEADDR { get; set; } + } + } diff --git a/DSWeb.Service.Output.DS7/DSWeb.Service.Output.DS7.csproj b/DSWeb.Service.Output.DS7/DSWeb.Service.Output.DS7.csproj index ef298afe..e1d44a0d 100644 --- a/DSWeb.Service.Output.DS7/DSWeb.Service.Output.DS7.csproj +++ b/DSWeb.Service.Output.DS7/DSWeb.Service.Output.DS7.csproj @@ -121,6 +121,7 @@ + diff --git a/DSWeb.Service.Output.DS7/DingtalkUserListService.cs b/DSWeb.Service.Output.DS7/DingtalkUserListService.cs new file mode 100644 index 00000000..de4cf62b --- /dev/null +++ b/DSWeb.Service.Output.DS7/DingtalkUserListService.cs @@ -0,0 +1,1010 @@ +using DSWeb.Common.DB; +using DSWeb.Common.Extentions; +using DSWeb.Common.Helper; +using JobReqWebData; +using log4net; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Quartz.Impl; +using RabbitMQ.Client; +using RabbitMQ.Client.Events; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Topshelf; + +namespace DSWeb.Service.Output.DingtalkUserList +{ + public class DingtalkUserListService : ServiceControl + { + + private static ILog logger = LogManager.GetLogger("DingtalkUserListService"); + + private IConnection mqConn; + + + public bool Start(HostControl hostControl) + { + // 开始具体的业务逻辑 + logger.Debug("开始运行"); + + //只调用一下ds7的公开接口 + + return true; + } + + public bool Stop(HostControl hostControl) + { + // 结束 + logger.Debug("停止运行"); + + //StdSchedulerFactory.GetDefaultScheduler().Shutdown(); + mqConn.Close(); + + return true; + } + + + #region 舱单数据解析实体类 + + public class Ctnlist + { + /// + /// + /// + public string ctn_id { get; set; } + /// + /// + /// + public string MFNO { get; set; } + /// + /// + /// + public string CTNCODE { get; set; } + /// + /// + /// + public int? SIZE { get; set; } + /// + /// + /// + public string CTN { get; set; } + /// + /// + /// + public int? CTNNUM { get; set; } + /// + /// + /// + public int? TEU { get; set; } + /// + /// + /// + public string CTNALL { get; set; } + /// + /// + /// + public string CNTRNO { get; set; } + /// + /// + /// + public string SEALNO { get; set; } + /// + /// + /// + public int? PKGS { get; set; } + /// + /// + /// + public decimal? KGS { get; set; } + /// + /// + /// + public decimal? CBM { get; set; } + /// + /// + /// + public string KINDPKGS { get; set; } + /// + /// + /// + public string DESCRIPTION { get; set; } + /// + /// + /// + public string MARKS { get; set; } + /// + /// + /// + public string PO { get; set; } + /// + /// + /// + public string SKU { get; set; } + /// + /// + /// + public string SKUDESCRIP { get; set; } + /// + /// + /// + public string DUNNO { get; set; } + /// + /// + /// + public string HTS { get; set; } + /// + /// + /// + public string CTOFORIGIN { get; set; } + /// + /// + /// + public decimal? GOODVALUE { get; set; } + /// + /// + /// + public string CTNOWNER { get; set; } + /// + /// + /// + public string ShiFengRen { get; set; } + /// + /// + /// + public string LeiXingFa { get; set; } + /// + /// + /// + public string LeiXingShou { get; set; } + /// + /// + /// + public string LeiXingTong { get; set; } + /// + /// + /// + public int ZhongKongBiaoShi { get; set; } + /// + /// + /// + public string ChengZhongZhongLiang { get; set; } + /// + /// + /// + public string ChengZhongFangShi { get; set; } + /// + /// + /// + public string ChengZhongShiJian { get; set; } + /// + /// + /// + public decimal? PIZHONG { get; set; } + /// + /// + /// + public string APICTNID { get; set; } + /// + /// + /// + public DateTime? VGMCLOSETIME { get; set; } + } + + public class OpSeaeEdi + { + /// + /// + /// + public string MBLNO { get; set; } + /// + /// + /// + public string HBLNO { get; set; } + /// + /// + /// + public string CARRIERID { get; set; } + /// + /// + /// + public string CARRIER { get; set; } + /// + /// + /// + public string WeiTuoFaSongFang { get; set; } + /// + /// + /// + public string DESTINATION { get; set; } + /// + /// + /// + public string DESTINATIONID { get; set; } + /// + /// + /// + public string PORTDISCHARGE { get; set; } + /// + /// + /// + public string PORTDISCHARGEID { get; set; } + /// + /// + /// + public DateTime? ETD { get; set; } + /// + /// + /// + public string CompId { get; set; } + /// + /// 东方海外物流(中国)有限公司青岛分公司 + /// + public string CompName { get; set; } + /// + /// + /// + public string MFNO { get; set; } + /// + /// + /// + public string BSNO { get; set; } + /// + /// + /// + public string MASTERNO { get; set; } + /// + /// + /// + public string SHIPPERNAME { get; set; } + /// + /// + /// + public string SHIPPERADDR1 { get; set; } + /// + /// + /// + public string SHIPPERCOUNTRY { get; set; } + /// + /// + /// + public string SHIPPERTEL { get; set; } + /// + /// + /// + public string CONSIGNEENAME { get; set; } + /// + /// + /// + public string CONSIGNEEADDR1 { get; set; } + /// + /// + /// + public string CONSIGNEECOUNTRY { get; set; } + + public string CONSIGNEETEL { get; set; } + public string NOTIFYPARTYNAME { get; set; } + public string NOTIFYPARTYADDR1 { get; set; } + /// + /// + /// + public string NOTIFYPARTYCOUNTRY { get; set; } + /// + /// + /// + public string NOTIFYPARTYTEL { get; set; } + /// + /// + /// + public string SHIPPER { get; set; } + /// + /// + /// + public string CONSIGNEE { get; set; } + /// + /// + /// + public string NOTIFYPARTY { get; set; } + /// + /// + /// + public string VESSEL { get; set; } + /// + /// + /// + public string VOYNO { get; set; } + /// + /// + /// + public string PORTLOADID { get; set; } + /// + /// + /// + public string PORTLOAD { get; set; } + /// + /// + /// + public string PLACEDELIVERYID { get; set; } + /// + /// + /// + public string PLACEDELIVERY { get; set; } + /// + /// + /// + public string SERVICE { get; set; } + /// + /// + /// + public string MARKS { get; set; } + /// + /// + /// + public string DESCRIPTION { get; set; } + /// + /// + /// + public int? PKGS { get; set; } + /// + /// + /// + public string KINDPKGS { get; set; } + /// + /// + /// + public decimal? KGS { get; set; } + /// + /// + /// + public decimal? CBM { get; set; } + /// + /// + /// + public string CARGOID { get; set; } + /// + /// + /// + public string DCLASS { get; set; } + /// + /// + /// + public string DUNNO { get; set; } + /// + /// + /// + public string REEFERF { get; set; } + /// + /// + /// + public string TEMPID { get; set; } + /// + /// + /// + public string TEMPSET { get; set; } + /// + /// + /// + public string TEMPMAX { get; set; } + /// + /// + /// + public string TEMPMIN { get; set; } + /// + /// + /// + public string FREIGHTAGMNO { get; set; } + /// + /// + /// + public string HUMIDITY { get; set; } + /// + /// + /// + public string SHIPIMO { get; set; } + /// + /// + /// + public DateTime? ETA { get; set; } + /// + /// + /// + public string BLFRT { get; set; } + /// + /// + /// + public DateTime? SENDTIME { get; set; } + /// + /// + /// + public string YARD { get; set; } + /// + /// 外代 + /// + public string FORWARDER { get; set; } + /// + /// + /// + public List ctnlist { get; set; } + } + + + #endregion + + /// + /// 舱单数据生成到OPOther版本的舱单业务中 经汉专用 + /// + /// + public void CangdanDataToDS7_OPOther(JArray jarr) + { + try + { + var opUser = dS7Data.User.AsNoTracking().First(u => u.GID == FeeInputUserId); + foreach (var item in jarr) + { + var obj = item as JObject; + + var itemstr = item.ToString(); + + var _edi = JsonConvert.DeserializeObject(itemstr); + + var MBLNO = obj.GetValue("MBLNO").ToString(); + var HBLNO = obj.GetValue("HBLNO").ToString(); + var CARRIERID = obj.GetValue("CARRIERID").ToString(); + var CARRIER = obj.GetValue("CARRIER").ToString(); + var WeiTuoFaSongFang = obj.GetValue("WeiTuoFaSongFang").ToString(); + var DESTINATION = obj.GetValue("DESTINATION").ToString(); + var DESTINATIONID = obj.GetValue("DESTINATIONID").ToString(); + var PORTDISCHARGE = obj.GetValue("PORTDISCHARGE").ToString(); + var PORTDISCHARGEID = obj.GetValue("PORTDISCHARGEID").ToString(); + var strETD = obj.GetValue("ETD").ToString(); + var ETD = Convert.ToDateTime(strETD); + var CompId = obj.GetValue("CompId").ToString(); + + //看op_other当中有没有该业务主单 如无则增加 + var 主单mfno = "topother" + _edi.MFNO; + if (!string.IsNullOrWhiteSpace(_edi.BSNO)) 主单mfno = "topother" + _edi.BSNO; + + op_other_md op_other = dS7Data.op_other.FirstOrDefault(x => x.BSNO == 主单mfno); + + var BSNO = ""; + var CUSTNOHEAD = ""; + var CUSTOMERNAME = ""; + + + var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == WeiTuoFaSongFang); + if (custEdi != null) + { + CUSTOMERNAME = custEdi.CUST; + } + + if (op_other == null || op_other.BSNO == null || op_other.BSNO == "") + { + logger.Debug($"未找到委托数据:{MBLNO}"); + + + + + BSNO = 主单mfno; + + //件数 毛重 净重 尺码 sum + var PKGS = 0; + var KGS = 0M; + var CBM = 0M; + foreach (var ja in jarr) + { + var _edi2= JsonConvert.DeserializeObject(ja.ToString()); + PKGS += _edi2.PKGS==null?0:(int)_edi2.PKGS; + KGS += _edi2.KGS == null ? 0M : (decimal)_edi2.KGS; + + CBM += _edi2.CBM == null ? 0M : (decimal)_edi2.CBM; + + } + + var newrec = new op_other_md + { + BSNO = BSNO, + OPLB = "op_other", + OPLBNAME = "舱单申报", + BSSTATUS = false, + FEESTATUS = false, + MBLNO = MBLNO, + HBLNO = "", + CUSTOMERNAME = CUSTOMERNAME, + //CARRIER + BSDATE = DateTime.Today, + ACCDATE = DateTime.Now.ToString("yyyy-MM"), + BSSOURCE = "", + OP = opUser.SHOWNAME, + CUSTSERVICE = opUser.SHOWNAME, + SALE = opUser.SHOWNAME, + CORPID = Corpid, + ETD = ETD,//业务日期 + //SR2023011000005 + PORTLOAD = _edi.PORTLOAD,//装货港 + PORTDISCHARGE = _edi.PORTDISCHARGE,//卸货港 + PKGS= PKGS, + KGS= KGS, + NETWEIGHT=0, + CBM= CBM + }; + + var billnoset = dS7Data.SysBillNoSet.AsNoTracking().FirstOrDefault(x => x.COMPANYID == Corpid && x.OPLBNAME == "舱单申报" && x.RULEBLNO == "委托编号"); + if (billnoset != null) + newrec.CUSTNO = GetBillNo(billnoset, newrec.ETD.ToString(), newrec.ACCDATE, opname: opUser.SHOWNAME, corpid: Corpid); + else + { + + logger.Debug($"SysBillNoSet数据未找到,无法生成编号:{MBLNO}"); + } + + + dS7Data.op_other.Add(newrec); + dS7Data.SaveChanges(); + + op_other= dS7Data.op_other.FirstOrDefault(x => x.BSNO == 主单mfno); + } + else + { + logger.Debug($"委托数据已存在:{MBLNO}"); + + BSNO = op_other.BSNO; + CUSTNOHEAD = op_other.CUSTNO; + } + + + //看op_seae_edi当中有没有该业务 如无则增加 + + var ediList = dS7Data.op_seae_edi.Where(x => x.BSNO == BSNO).ToList(); + + if (!ediList.Exists(x => x.MBLNO == MBLNO && x.HBLNO == HBLNO)) + { + var newedi = new op_seae_edi_md { + MFNO = _edi.MFNO, + BSNO = 主单mfno, + MASTERNO = 主单mfno, + CUSTNO = CUSTNOHEAD + (ediList.Count + 1).ToString(), + MBLNO =_edi.MBLNO, + HBLNO = _edi.HBLNO, + CARRIERID = _edi.CARRIERID, + CARRIER = _edi.CARRIER, + //WeiTuoFaSongFang = _edi.WeiTuoFaSongFang, + DESTINATION = _edi.DESTINATION, + DESTINATIONID = _edi.DESTINATIONID, + PORTDISCHARGE = _edi.PORTDISCHARGE, + PORTDISCHARGEID = _edi.PORTDISCHARGEID, + ETD = _edi.ETD, + + SHIPPERNAME = _edi.SHIPPERNAME, + SHIPPERADDR1 = _edi.SHIPPERADDR1, + SHIPPERCOUNTRY = _edi.SHIPPERCOUNTRY, + SHIPPERTEL = _edi.SHIPPERTEL, + + CONSIGNEENAME = _edi.CONSIGNEENAME, + CONSIGNEEADDR1 = _edi.CONSIGNEEADDR1, + CONSIGNEECOUNTRY = _edi.CONSIGNEECOUNTRY, + CONSIGNEETEL = _edi.CONSIGNEETEL, + + NOTIFYPARTYNAME = _edi.NOTIFYPARTYNAME, + NOTIFYPARTYADDR1 = _edi.NOTIFYPARTYADDR1, + NOTIFYPARTYCOUNTRY = _edi.NOTIFYPARTYCOUNTRY, + NOTIFYPARTYTEL = _edi.NOTIFYPARTYTEL, + + SHIPPER = _edi.SHIPPER, + CONSIGNEE = _edi.CONSIGNEE, + NOTIFYPARTY = _edi.NOTIFYPARTY, + VESSEL = _edi.VESSEL, + VOYNO = _edi.VOYNO, + PORTLOADID = _edi.PORTLOADID, + PORTLOAD = _edi.PORTLOAD, + PLACEDELIVERYID = _edi.PLACEDELIVERYID, + PLACEDELIVERY = _edi.PLACEDELIVERY, + SERVICE = _edi.SERVICE, + MARKS = _edi.MARKS, + DESCRIPTION = _edi.DESCRIPTION, + PKGS = _edi.PKGS, + KINDPKGS = _edi.KINDPKGS, + KGS = _edi.KGS, + CBM = _edi.CBM, + CARGOID = _edi.CARGOID, + DCLASS = _edi.DCLASS, + DUNNO = _edi.DUNNO, + REEFERF = _edi.REEFERF, + TEMPID = _edi.TEMPID, + TEMPSET = _edi.TEMPSET, + TEMPMAX = _edi.TEMPMAX, + TEMPMIN = _edi.TEMPMIN, + FREIGHTAGMNO = _edi.FREIGHTAGMNO, + HUMIDITY = _edi.HUMIDITY, + SHIPIMO = _edi.SHIPIMO, + ETA = _edi.ETA, + BLFRT = _edi.BLFRT, + SENDTIME = _edi.SENDTIME, + YARD = _edi.YARD, + FORWARDER = _edi.FORWARDER + }; + + dS7Data.op_seae_edi.Add(newedi); + + if (_edi.ctnlist != null && _edi.ctnlist.Count > 0) { + foreach (var ctn in _edi.ctnlist) { + var newctn = new op_seae_edi_ctn_md + { + ctn_id = Guid.NewGuid().ToString(),//ctn.ctn_id, + MFNO = _edi.MFNO, + CTNCODE = ctn.CTNCODE, + CNTRNO= ctn.CNTRNO, + SEALNO = ctn.SEALNO, + SIZE = ctn.SIZE.ToString(), + CTN = ctn.CTN, + CTNNUM = ctn.CTNNUM, + TEU = ctn.TEU, + CTNALL = ctn.CTNALL, + PKGS = ctn.PKGS, + KGS = ctn.KGS, + CBM = ctn.CBM, + KINDPKGS = ctn.KINDPKGS, + DESCRIPTION = ctn.DESCRIPTION, + MARKS = ctn.MARKS, + PO = ctn.PO, + SKU = ctn.SKU, + SKUDESCRIP = ctn.SKUDESCRIP, + DUNNO = ctn.DUNNO, + HTS = ctn.HTS, + CTOFORIGIN = ctn.CTOFORIGIN, + GOODVALUE = ctn.GOODVALUE, + CTNOWNER = ctn.CTNOWNER + }; + dS7Data.op_seae_edi_ctn.Add(newctn); + } + } + dS7Data.SaveChanges(); + } + + + //只要有对应的往来单位=委托发送方 主分单都产生相应的应收 + InfoClient infoClient = null; + if (!string.IsNullOrEmpty(CUSTOMERNAME)) + { + infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == CUSTOMERNAME); + if (infoClient != null) + { + op_other.SALE = infoClient.SALE; //揽货人赋值 + + //查询配置,生成应收 + var fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == infoClient.SHORTNAME && x.FEENAME == FeeShouName); + if (fee != null ) + { + var feeShou = new ChFee(); + feeShou.GID = Guid.NewGuid().ToString().Replace("-", ""); + feeShou.BSNO = op_other.BSNO; + feeShou.FEETYPE = 1; + feeShou.FEENAME = FeeShouName; + feeShou.CUSTOMERTYPE = "其他"; + feeShou.CUSTOMERNAME = infoClient.SHORTNAME; + feeShou.UNIT = fee.UNIT; + feeShou.UNITPRICE = fee.UNITPRICE; + feeShou.QUANTITY = 1; + feeShou.AMOUNT = fee.UNITPRICE; + feeShou.EXCHANGERATE = 1; + feeShou.CURRENCY = "RMB"; + feeShou.ENTEROPERATOR = FeeInputUserId; + feeShou.ENTERDATE = DateTime.Now; + feeShou.MODIFIEDUSER = FeeInputUserId; + feeShou.MODIFIEDTIME = DateTime.Now; + feeShou.LOCALCURR = feeShou.CURRENCY; + feeShou.FEEDESCRIPTION = feeShou.FEENAME; + feeShou.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0 + + //2021-12-8,下列字段不能为空,写入默认值 + feeShou.SETTLEMENT = 0; + feeShou.ORDERAMOUNT = 0; + feeShou.ORDERINVOICE = 0; + feeShou.ORDERINVSETTLEMENT = 0; + feeShou.ORDERSETTLEMENT = 0; + feeShou.INVOICE = 0; + feeShou.TAXRATE = 0; + feeShou.ISADVANCEDPAY = false; + feeShou.ISINVOICE = false; + feeShou.ISCRMORDERFEE = false; + feeShou.TAXUNITPRICE = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额 + feeShou.NOTAXAMOUNT = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额 + + //2021-12-9,要求下列字段不能为空,填写0或false + feeShou.COMMISSIONRATE = 0; + feeShou.AUDITSTATUS = 0; + feeShou.LINENUM = 0; + feeShou.ISDEBIT = false; + feeShou.ISOPEN = false; + feeShou.ACCTAXRATE = 0; + feeShou.ISVOU = false; + feeShou.TAX = 0; + feeShou.PREAMOUNT = 0; + feeShou.ISACC = false; + feeShou.CUSTDUI = false; + + feeShou.BXGID = HBLNO; + + //2021-12-23:分单号写入备注 + //if (!string.IsNullOrEmpty(HBLNO)) + //{ + // feeShou.REMARK += $" {HBLNO} "; + //} + + dS7Data.ChFee.Add(feeShou); + } + + } + } + + //应付 + if (string.IsNullOrEmpty(HBLNO) && FeePayPrice>0) //主单才插入船代费用 + { + var feeFu = new ChFee(); + feeFu.GID = Guid.NewGuid().ToString().Replace("-", ""); + feeFu.BSNO = op_other.BSNO; + feeFu.FEETYPE = 2; + feeFu.FEENAME = FeePayName; + feeFu.CUSTOMERTYPE = FeePayCustomerType; + feeFu.CUSTOMERNAME = FeePayCustomer; + feeFu.UNIT = "票"; + feeFu.UNITPRICE = FeePayPrice; + feeFu.QUANTITY = 1; + feeFu.AMOUNT = FeePayPrice; + feeFu.EXCHANGERATE = 1; + feeFu.CURRENCY = "RMB"; + feeFu.ENTEROPERATOR = FeeInputUserId; + feeFu.ENTERDATE = DateTime.Now; + feeFu.MODIFIEDUSER = FeeInputUserId; + feeFu.MODIFIEDTIME = DateTime.Now; + feeFu.LOCALCURR = feeFu.CURRENCY; + feeFu.FEEDESCRIPTION = feeFu.FEENAME; + feeFu.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0 + + //2021-12-8,下列字段不能为空,写入默认值 + feeFu.SETTLEMENT = 0; + feeFu.ORDERAMOUNT = 0; + feeFu.ORDERINVOICE = 0; + feeFu.ORDERINVSETTLEMENT = 0; + feeFu.ORDERSETTLEMENT = 0; + feeFu.INVOICE = 0; + feeFu.TAXRATE = 0; + feeFu.ISADVANCEDPAY = false; + feeFu.ISINVOICE = false; + feeFu.ISCRMORDERFEE = false; + feeFu.TAXUNITPRICE = FeePayPrice; + feeFu.NOTAXAMOUNT = 0; + + //2021-12-9,要求下列字段不能为空,填写0或false + feeFu.COMMISSIONRATE = 0; + feeFu.AUDITSTATUS = 0; + feeFu.LINENUM = 0; + feeFu.ISDEBIT = false; + feeFu.ISOPEN = false; + feeFu.ACCTAXRATE = 0; + feeFu.ISVOU = false; + feeFu.TAX = 0; + feeFu.PREAMOUNT = 0; + feeFu.ISACC = false; + feeFu.CUSTDUI = false; + + feeFu.BXGID = HBLNO; + + dS7Data.ChFee.Add(feeFu); + dS7Data.SaveChanges(); + } + + if (FeePayMyshippingPrice > 0) { + //不管主单分单都要付费给大简云 + var feeFuDJY = new ChFee(); + feeFuDJY.GID = Guid.NewGuid().ToString().Replace("-", ""); + feeFuDJY.BSNO = op_other.BSNO; + feeFuDJY.FEETYPE = 2; + feeFuDJY.FEENAME = FeePayMyshippingName; + feeFuDJY.CUSTOMERTYPE = "其他"; + feeFuDJY.CUSTOMERNAME = FeePayMyshippingCustomer; + feeFuDJY.UNIT = "票"; + feeFuDJY.UNITPRICE = FeePayMyshippingPrice; + feeFuDJY.QUANTITY = 1; + feeFuDJY.AMOUNT = FeePayMyshippingPrice; + feeFuDJY.EXCHANGERATE = 1; + feeFuDJY.CURRENCY = "RMB"; + feeFuDJY.ENTEROPERATOR = FeeInputUserId; + feeFuDJY.ENTERDATE = DateTime.Now; + feeFuDJY.MODIFIEDUSER = FeeInputUserId; + feeFuDJY.MODIFIEDTIME = DateTime.Now; + feeFuDJY.LOCALCURR = feeFuDJY.CURRENCY; + feeFuDJY.FEEDESCRIPTION = feeFuDJY.FEENAME; + feeFuDJY.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0 + + //2021-12-8,下列字段不能为空,写入默认值 + feeFuDJY.SETTLEMENT = 0; + feeFuDJY.ORDERAMOUNT = 0; + feeFuDJY.ORDERINVOICE = 0; + feeFuDJY.ORDERINVSETTLEMENT = 0; + feeFuDJY.ORDERSETTLEMENT = 0; + feeFuDJY.INVOICE = 0; + feeFuDJY.TAXRATE = 0; + feeFuDJY.ISADVANCEDPAY = false; + feeFuDJY.ISINVOICE = false; + feeFuDJY.ISCRMORDERFEE = false; + feeFuDJY.TAXUNITPRICE = FeePayMyshippingPrice; + feeFuDJY.NOTAXAMOUNT = 0; + + //2021-12-9,要求下列字段不能为空,填写0或false + feeFuDJY.COMMISSIONRATE = 0; + feeFuDJY.AUDITSTATUS = 0; + feeFuDJY.LINENUM = 0; + feeFuDJY.ISDEBIT = false; + feeFuDJY.ISOPEN = false; + feeFuDJY.ACCTAXRATE = 0; + feeFuDJY.ISVOU = false; + feeFuDJY.TAX = 0; + feeFuDJY.PREAMOUNT = 0; + feeFuDJY.ISACC = false; + feeFuDJY.CUSTDUI = false; + + feeFuDJY.BXGID = HBLNO; + + dS7Data.ChFee.Add(feeFuDJY); + + //dS7Data.Database.Log = (x => { logger.Debug(x); }); + dS7Data.SaveChanges(); + } + } + } + catch (Exception e) { + logger.Error($"导入舱单出错:{e}"); + } + } + + + /// + /// 生成编号(从东胜7移植并修改) + /// + /// + /// + /// + /// + /// + /// + /// + /// + private string GetBillNo(SysBillNoSet billType, string bsdate, string accdate, string dbname = "", string opname = "", string corpid = "", string bshead = "") + { + var orgCode = ""; + var UserCode = ""; + UserCode = GetUserCode(opname, dbname); + orgCode = GetCorpCode(corpid, dbname); + + //List paramArray = new List(); + //paramArray.Add(new SqlParameter("@ps_BillType", billType.BILLTYPE)); + //paramArray.Add(new SqlParameter("@ps_OrgCode", orgCode)); + //paramArray.Add(new SqlParameter("@ps_EmpCode", UserCode)); + //paramArray.Add(new SqlParameter("@ps_bshead", bshead)); + //if (billType.RULEDATETYPE == "业务日期") + // paramArray.Add(new SqlParameter("@ps_Date", bsdate)); + //else if (billType.RULEDATETYPE == "会计期间" && accdate.Length == 7) + // paramArray.Add(new SqlParameter("@ps_Date", accdate + "-01")); + //else + // paramArray.Add(new SqlParameter("@ps_Date", accdate + "")); + //paramArray.Add(new SqlParameter("@ps_BillNo", 20)); + + //SqlParameter sqlParaOut = new SqlParameter("@ps_RefBillNo", SqlDbType.VarChar, 50); + //sqlParaOut.Direction = ParameterDirection.Output; + //paramArray.Add(sqlParaOut); + + //dS7Data.Database.ExecuteSqlCommand("EXEC [sSysGetBillNo_new] @ps_BillType,@ps_OrgCode,@ps_EmpCode,@ps_bshead,@ps_Date,@ps_BillNo,@ps_RefBillNo output", paramArray.ToArray()); + //ExecStoredProcedure("sSysGetBillNo_new", paramArray.ToArray()); + + var bsDate = string.Empty; + if (!string.IsNullOrWhiteSpace(bsdate)) + bsdate = Convert.ToDateTime(bsdate).ToString("yyyy-MM-dd"); + + if (billType.RULEDATETYPE == "业务日期") + bsDate = bsdate; + else if (billType.RULEDATETYPE == "会计期间" && accdate.Length == 7) + bsDate = accdate + "-01"; + else + bsDate = accdate; + var cmd = $@"DECLARE @ps_BillNo varchar(20) +EXEC [sSysGetBillNo_new] + + @ps_BillType = N'{billType.BILLTYPE}', + @ps_OrgCode = N'{orgCode}', + @ps_EmpCode = N'{UserCode}', + @ps_Date = N'{bsDate}', + @ps_bshead = N'{bshead}', + @ps_BillNo = @ps_BillNo OUTPUT, + @ps_RefBillNo = N'' + +SELECT @ps_BillNo as N'billno'"; + return dS7Data.Database.SqlQuery(cmd).First(); + + } + + /// + /// 获取用户code(参考东胜7修改) + /// + /// + /// + /// + private string GetUserCode(string username, string dbname = "") + { + //string EDICODE = ""; + //var strSql = new StringBuilder(); + //strSql.Append("select CODENAME from [user] where SHOWNAME='" + username + "'"); + //Database db = string.IsNullOrWhiteSpace(dbname) ? DatabaseFactory.CreateDatabase() : DatabaseFactory.CreateDatabase(dbname); + //using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + //{ + // while (reader.Read()) + // { + // EDICODE = Convert.ToString(reader["CODENAME"]); + // } + // reader.Close(); + //} + //return EDICODE; + + return dS7Data.Database.SqlQuery("select CODENAME from [user] where SHOWNAME='" + username + "'").FirstOrDefault(); + } + + /// + /// 获取公司code(参考东胜7修改) + /// + /// + /// + /// + private string GetCorpCode(string Corpid, string dbname = "") + { + //string EDICODE = ""; + //var strSql = new StringBuilder(); + //strSql.Append("select CODENAME from [company] where GID='" + Corpid + "'"); + //Database db = string.IsNullOrWhiteSpace(dbname) ? DatabaseFactory.CreateDatabase() : DatabaseFactory.CreateDatabase(dbname); + //using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString())) + //{ + // while (reader.Read()) + // { + // EDICODE = Convert.ToString(reader["CODENAME"]); + // } + // reader.Close(); + //} + //return EDICODE; + + return dS7Data.Database.SqlQuery("select CODENAME from [company] where GID='" + Corpid + "'").FirstOrDefault(); + } + + public static int ExecStoredProcedure(string procName, params SqlParameter[] parameters) + { + int rtn = 0; + using (SqlConnection conn = new SqlConnection(DS7ConnStr)) + { + conn.Open(); + using (SqlCommand cmd = conn.CreateCommand()) + { + SqlTransaction st = conn.BeginTransaction(); + cmd.Transaction = st; + try + { + cmd.CommandText = procName; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddRange(parameters); + var rr = cmd.ExecuteScalar(); + st.Commit(); + return rtn; + } + catch (SqlException sqlex) + { + st.Rollback(); + throw sqlex; + } + } + } + } + + } +} diff --git a/DSWeb.Service.Output.DS7/说明.txt b/DSWeb.Service.Output.DS7/说明.txt index 2a7c8e08..106acf09 100644 --- a/DSWeb.Service.Output.DS7/说明.txt +++ b/DSWeb.Service.Output.DS7/说明.txt @@ -1 +1,3 @@ -大简云数据(舱单、报关等),导出数据到东胜7专用服务 \ No newline at end of file +1:从大简云的公开消息队列,获取自己的业务,写入ds7经汉版的op_other表,作为舱单业务的数据 + +2:定时读取钉钉通讯录,向 \ No newline at end of file diff --git a/DSWeb/Areas/CommMng/Controllers/PublicAPIController.cs b/DSWeb/Areas/CommMng/Controllers/PublicAPIController.cs index 7dc35577..b1b4c1a8 100644 --- a/DSWeb/Areas/CommMng/Controllers/PublicAPIController.cs +++ b/DSWeb/Areas/CommMng/Controllers/PublicAPIController.cs @@ -15,6 +15,7 @@ using System.Text; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.CommMng.Models; using DSWeb.Areas.MvcShipping.DAL; +using HcUtility.Comm; namespace DSWeb.Areas.CommMng.Controllers { @@ -96,7 +97,17 @@ namespace DSWeb.Areas.CommMng.Controllers } } + /// + /// 获取钉钉的通讯录 + /// + /// + [HttpPost] + public ContentResult DingTalkUserList() { + var result = new DBResult(); + + return BasicDataRefDAL.GetContentResult(result); + } } diff --git a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs index d14d2080..7d5b0e4b 100644 --- a/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs +++ b/DSWeb/Areas/CommMng/DAL/BasicDataRefDAL.cs @@ -6480,6 +6480,18 @@ namespace DSWeb.Areas.CommMng.DAL } } #endregion + + public static ContentResult GetContentResult(DBResult dbresult) + { + var jsonRespose = new JsonResponse + { + Success = dbresult.Success, + Message = dbresult.Message, + Data = null + }; + if (dbresult.Data != null) jsonRespose.Data = dbresult.Data; + return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; + } } } \ No newline at end of file diff --git a/DSWeb/DSWeb.csproj.user b/DSWeb/DSWeb.csproj.user deleted file mode 100644 index 9a8510e8..00000000 --- a/DSWeb/DSWeb.csproj.user +++ /dev/null @@ -1,40 +0,0 @@ - - - - ShowAllFiles - FolderProfile - true - Release|Any CPU - - - - - - - - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - True - False - - - - - \ No newline at end of file diff --git a/DispatchWeb/DispatchWeb.csproj.user b/DispatchWeb/DispatchWeb.csproj.user deleted file mode 100644 index af17a67a..00000000 --- a/DispatchWeb/DispatchWeb.csproj.user +++ /dev/null @@ -1,38 +0,0 @@ - - - - Release|Any CPU - true - - - - - - - - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - True - True - - - - - \ No newline at end of file