| | |
| | | using MailKit.Search; |
| | | using Rhea.Common; |
| | | using Rhea.Common; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Business.WMS.Extensions; |
| | | using Tiger.Business.WMS.Transaction; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | using Tiger.Model.Extensions; |
| | | |
| | | namespace Tiger.Business.WMS.Common |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 备料任务单据 |
| | | /// </summary> |
| | |
| | | |
| | | #region Propertys & Variables |
| | | private static object AddOrderLock { get; } = new object(); |
| | | private static object AddBatchLock { get; } = new object(); |
| | | public DbClient MainDB { get; set; } |
| | | public string UserCode { get; set; } |
| | | public string OrgCode { get; set; } |
| | | public BIZ_WMS_PREP Order { get; set; } |
| | | public BIZ_WMS_PREP.BIZ_TYPEs BizType => Order.BIZ_TYPE.GetEnum<BIZ_WMS_PREP.BIZ_TYPEs>(); |
| | | public SuggestOption Option { get; set; } |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | Order.SourceOrders = Order.SourceOrders ?? new(); |
| | | Order.SourceDetails = Order.SourceDetails ?? new(); |
| | | Order.Details = Order.Details ?? new(); |
| | | Order.Batchs = Order.Batchs ?? new(); |
| | | Order.SnList = Order.SnList ?? new(); |
| | | var srcOrder = new BIZ_WMS_PREP_SRC() |
| | | { |
| | |
| | | var srcInfo = Order.SourceOrders.Select(q => new { q.SOURCE_CODE, q.SOURCE_ORDER }).DistinctBy(q => q.SOURCE_ORDER).OrderBy(q => q.SOURCE_ORDER); |
| | | Order.SOURCE_CODE = string.Join(",", srcInfo.Select(q => q.SOURCE_CODE)); |
| | | Order.SOURCE_ORDER = string.Join(",", srcInfo.Select(q => q.SOURCE_ORDER)); |
| | | if (Order.CurBatch.IsNullOrEmpty()) |
| | | { |
| | | var bacth = new BIZ_WMS_PREP_BTH() |
| | | { |
| | | AUTH_ORG = OrgCode, |
| | | ORDER_NO = Order.ORDER_NO, |
| | | BATCH = Order.Batchs.Max(q => q.BATCH) + 1, |
| | | PREP_MODE = BIZ_WMS_PREP_BTH.PREP_MODEs.Whole.GetValue(), |
| | | DLVY_MODE = BIZ_WMS_PREP_BTH.DLVY_MODEs.Supply.GetValue(), |
| | | STATUS = BIZ_WMS_PREP_BTH.STATUSs.WaitPick.GetValue(), |
| | | CALL_TIME = DateTime.Now, |
| | | PRIORITY = 4, |
| | | }; |
| | | bacth.PLAN_TIME = bacth.CALL_TIME.AddHours(1); |
| | | Order.Batchs.Add(bacth); |
| | | } |
| | | |
| | | //使用统一的事务DB对象 |
| | | var db = Biz.Db; |
| | |
| | | var d = db.Storageable(Order.Details, UserCode).WhereColumns(t => new { t.ORDER_NO, t.ITEM_CODE, t.GHOST_ROW }).ToStorage(); |
| | | d.AsInsertable.ExecuteCommand(); |
| | | d.AsUpdateable.IgnoreColumns(q => q.ID).UpdateColumns(q => new { q.QTY_REQ, q.UPDATE_TIME, q.UPDATE_USER }).ExecuteCommand(); |
| | | db.Storageable(Order.Batchs, UserCode).WhereColumns(t => new { t.ORDER_NO, t.BATCH, t.GHOST_ROW }).ToStorage().AsInsertable.ExecuteCommand(); |
| | | }); |
| | | if (dbTran.IsSuccess) |
| | | { |