diff --git a/.vs/PlatformScalePortReadData/FileContentIndex/55a7facb-e327-486e-a212-ea8e63b16a91.vsidx b/.vs/PlatformScalePortReadData/FileContentIndex/55a7facb-e327-486e-a212-ea8e63b16a91.vsidx deleted file mode 100644 index 897f7d6..0000000 Binary files a/.vs/PlatformScalePortReadData/FileContentIndex/55a7facb-e327-486e-a212-ea8e63b16a91.vsidx and /dev/null differ diff --git a/App.config b/App.config index 7b34360..d0771bc 100644 --- a/App.config +++ b/App.config @@ -7,12 +7,12 @@ - - - + + + - - + + diff --git a/Form1.cs b/Form1.cs index c57f6cb..26c2335 100644 --- a/Form1.cs +++ b/Form1.cs @@ -348,19 +348,26 @@ namespace PlatformScalePortReadData { redis.LPop(key); } - result = YARDService.PublicFunc(record); - - - //抬杠 - if (NativeMethods.CLIENT_LPRC_SetRelayClose(this.pIP, 8080) == 0) + if (YARDService.CheckBook(record.TRUCKNO, record.BoxCode)) { - textBoxReceive.AppendText("自动抬杆成功!"); + result = YARDService.PublicFunc(record); + //抬杠 + if (NativeMethods.CLIENT_LPRC_SetRelayClose(this.pIP, 8080) == 0) + { + textBoxReceive.AppendText("自动抬杆成功!"); + } + else + { + textBoxReceive.AppendText("自动抬杆失败!"); + } } else - { - textBoxReceive.AppendText("自动抬杆失败!"); + { + textBoxReceive.AppendText("未检测到预约数据:车牌 " + record.TRUCKNO + " 箱号:" + record.BoxCode + " 箱号2:" + record.BoxCode2 + ",请及时在客户端预约! " ); + } + } } @@ -661,6 +668,8 @@ namespace PlatformScalePortReadData /// public decimal ReadPortWeright() { + //清空 buffer 缓存 + buffer.Clear(); decimal weight = 0M; bool a = true; if (!serialPort.IsOpen) diff --git a/Model/VW_OP_YARD_CTNMNG_DJZ.cs b/Model/VW_OP_YARD_CTNMNG_DJZ.cs new file mode 100644 index 0000000..9d6ae35 --- /dev/null +++ b/Model/VW_OP_YARD_CTNMNG_DJZ.cs @@ -0,0 +1,257 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PlatformScalePortReadData.Model +{ + [SugarTable("VW_OP_YARD_CTNMNG_DJZ")] + public partial class VW_OP_YARD_CTNMNG_DJZ + { + public VW_OP_YARD_CTNMNG_DJZ() + { + + + } + /// + /// Desc: + /// Default: + /// Nullable:False + /// + public Guid GID { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string BSNO { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string CUSTOMERNAME { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string GOODNAME { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public DateTime? ENTERDATE { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string TRUCKNO { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string LinkTel { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string BoxCode { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string BoxType { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public decimal? BoxWeigth { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public DateTime? ENTERDATE_ACTUAL { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public DateTime? OutDate { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public bool? ISTwoBox { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string REMARK { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public Guid? EnterOrderGid { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public int? DAYS { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string BILLSTATUS_CUST { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string BoxStatus { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public int? BondType { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string AREACODE { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public decimal? EnterWeight { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public decimal? OutWeight { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public decimal? NetWeight { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:False + /// + public short Status { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public bool? IsCollectTRUCK { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public bool? IsCollectBox { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public bool? IsUpLoadPackBox { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public int? BusinessType { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public int? AuditStatus { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public decimal? LimitRatio { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public Guid? TrainId { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string TrainNum { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public string OrgId { get; set; } + + /// + /// Desc: + /// Default: + /// Nullable:True + /// + public int? MaterialStatus { get; set; } + + } +} diff --git a/PlatformScalePortReadData.csproj b/PlatformScalePortReadData.csproj index 116f877..a81954f 100644 --- a/PlatformScalePortReadData.csproj +++ b/PlatformScalePortReadData.csproj @@ -166,6 +166,7 @@ + diff --git a/Service/YARDService.cs b/Service/YARDService.cs index d2f8ff9..dd02b6f 100644 --- a/Service/YARDService.cs +++ b/Service/YARDService.cs @@ -12,7 +12,30 @@ namespace PlatformScalePortReadData.Service { internal class YARDService { + public static bool CheckBook(string TRUCKNO,string BoxCode) + { + bool res = false; + try + { + using (var db = SqlSugarFactory.GetInstance("1")) + { + var info = db.Queryable().Where(x => x.TRUCKNO == TRUCKNO && x.Status == 1 && x.AuditStatus == 1) + .WhereIF(!String.IsNullOrEmpty(BoxCode), x => x.BoxCode == BoxCode).OrderByDescending(x => x.ENTERDATE).First(); + if (info != null) + { + res = true; + } + return res; + } + } + catch (Exception ex) + { + //return "程序异常:" + ex.ToString(); + return res; + } + + } /// /// 添加进出站记录 ///