123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using ServiceCenter.Logs;
- using ServiceCenter.SqlSugars;
- using System.ComponentModel;
- using WCS.Core;
- using WCS.Entity;
- using WCS.WorkEngineering.Extensions;
- using WCS.WorkEngineering.Protocol.BCR;
- using WCS.WorkEngineering.Protocol.Station;
- using WCS.WorkEngineering.WebApi.Controllers;
- using WCS.WorkEngineering.WebApi.Models.WMS.Request;
- using WCS.WorkEngineering.Worlds;
- namespace WCS.WorkEngineering.Systems
- {
- /// <summary>
- /// 一楼入库工位处理系统
- /// </summary>
- [BelongTo(typeof(MainWorld))]
- [Description("一楼扫码入库")]
- public class 一楼扫码入库 : DeviceSystem<Device<IStation520, IStation521, IStation523, IStation91, IBCR81>>
- {
- protected override bool ParallelDo => true;
- protected override bool SaveLogsToFile => true;
- public 一楼扫码入库()
- {
- }
- public override void Do(Device<IStation520, IStation521, IStation523, IStation91, IBCR81> obj)
- {
- obj.入库站点是否被禁止();
- obj.入库站点是否满足执行条件();
- WCS_TaskInfo task = null;//处理完成的任务
- try
- {
- SqlSugarHelper.Do(_db =>
- {
- var db = _db.Default;
- //获取托盘条码
- var barcode = obj.Data5.GetBCRCode();
- //验证是否有对应的任务
- if (!db.Queryable<WCS_TaskInfo>().Any(v => v.BarCode == barcode))
- {
- WmsApi.OneFloorWorkerBuildEmptyPalletsStock(new OneFloorWorkerBuildEmptyPalletsStockRequest()
- {
- PalletCode = barcode,
- StartLoc = obj.Entity.Code,
- });
- }
- //找到对应的任务
- task = db.Queryable<WCS_TaskInfo>().First(v => v.BarCode == barcode);
- if (task.Status == Entity.TaskStatus.NewBuild)
- {
- //开始对任务进行处理
- task.Status = Entity.TaskStatus.ConveyorExecution;
- task.StartTime = DateTime.Now;
- task.SrmStation = task.AddrFrom;
- task.AddWCS_TASK_DTL(_db, obj.Entity.Code, "开始执行入库任务");
- db.Updateable(task).ExecuteCommand();
- task.updateRedisHash();
- }
- else return;
- });
- }
- catch (Exception ex)
- {
- throw new KnownException(ex.Message, LogLevelEnum.High);
- }
- obj.Data.TaskNumber = task.ID;
- obj.Data.VoucherNo++;
- }
- public override bool Select(Device dev)
- {
- return dev.HasFlag(Extensions.DeviceFlags.一楼扫码);
- }
- }
- }
|