コード例 #1
0
        private async Task ExecuteRefreshSubOrder()
        {
            try
            {
                if (_suborderid == null)
                {
                    _suborderid = SelectedSubOrder?.ID;
                }

                DataListSubOrder.Clear();
                if (SelectedOrder != null)
                {
                    var suborders = await _dbservicewms.GetSubOrdersBySKUWithCount(SelectedOrder.ERPID, SelectedOrder.OrderID);

                    DataListSubOrder.Clear();
                    foreach (var p in suborders)
                    {
                        DataListSubOrder.Add(new ReleaseOrderViewModel
                        {
                            ID            = p.WMSID,
                            ERPID         = p.ERPID,
                            OrderID       = p.OrderID,
                            SubOrderID    = p.SubOrderID,
                            SubOrderERPID = p.SubOrderERPID,
                            SubOrderName  = p.SubOrderName,
                            SKUID         = p.SKUID,
                            SKUBatch      = p.SKUBatch,
                            SKUQty        = p.SKUQty,
                            Portion       = $"{p.CountAll-p.CountActive-p.CountFinished}+{p.CountActive}+{p.CountFinished}={p.CountAll}",
                            Status        = (EnumWMSOrderStatus)p.Status
                        });
                    }
                    foreach (var l in DataListOrder)
                    {
                        l.Initialize(_warehouse);
                    }
                    if (_suborderid != null)
                    {
                        SelectedSubOrder = DataListSubOrder.FirstOrDefault(p => p.ID == _suborderid);
                    }
                    if (SelectedSubOrder == null)
                    {
                        SelectedSubOrder = DataListSubOrder.FirstOrDefault();
                    }
                    _suborderid = null;
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
コード例 #2
0
ファイル: OrdersViewModel.cs プロジェクト: II01/i2MFCSv2.TAI
 private void ExecuteRefreshSubOrder()
 {
     try
     {
         DataListSubOrder.Clear();
         if (SelectedOrder != null)
         {
             foreach (var p in _dbservicewms.GetSubOrdersDistinct(SelectedOrder.ERPID, SelectedOrder.OrderID))
             {
                 DataListSubOrder.Add(new OrderViewModel
                 {
                     ID            = p.ID,
                     ERPID         = p.ERP_ID,
                     ERPIDRef      = null,
                     OrderID       = p.OrderID,
                     Destination   = p.Destination,
                     ReleaseTime   = p.ReleaseTime,
                     SubOrderID    = p.SubOrderID,
                     SubOrderERPID = p.SubOrderERPID,
                     SubOrderName  = p.SubOrderName,
                     SKUID         = p.SKU_ID,
                     SKUBatch      = p.SKU_Batch,
                     SKUQty        = p.SKU_Qty,
                     Status        = (EnumWMSOrderStatus)p.Status
                 });
             }
             foreach (var l in DataListOrder)
             {
                 l.Initialize(_warehouse);
             }
             if (SelectedOrder != null)
             {
                 if (_suborderid != -1)
                 {
                     SelectedSubOrder = DataListSubOrder.FirstOrDefault(p => p.SubOrderID == _suborderid);
                 }
                 if (SelectedSubOrder == null)
                 {
                     SelectedSubOrder = DataListSubOrder.FirstOrDefault();
                 }
             }
             ExecuteRefreshSKU();
         }
     }
     catch (Exception e)
     {
         _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                             string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
     }
 }
コード例 #3
0
        private async Task ExecuteRefreshSubOrder()
        {
            try
            {
                DataListSubOrder.Clear();
                if (SelectedOrder != null)
                {
                    var suborders = await _dbservicewms.GetHistSubOrders(SelectedOrder.ERPID, SelectedOrder.OrderID);

                    DataListSubOrder.Clear();
                    foreach (var p in suborders)
                    {
                        DataListSubOrder.Add(new ReleaseOrderViewModel
                        {
                            OrderID       = p.OrderID,
                            SubOrderID    = p.SubOrderID,
                            SubOrderERPID = p.SubOrderERPID,
                            SubOrderName  = p.SubOrderName,
                            TUID          = p.TU_ID,
                            BoxID         = p.Box_ID,
                            SKUID         = p.SKU_ID,
                            SKUBatch      = p.SKU_Batch,
                            SKUQty        = p.SKU_Qty,
                            Operation     = (EnumOrderOperation)p.Operation,
                            Status        = (EnumWMSOrderStatus)p.Status
                        });
                    }
                    foreach (var l in DataListOrder)
                    {
                        l.Initialize(_warehouse);
                    }
                    if (_suborderid != null)
                    {
                        SelectedSubOrder = DataListSubOrder.FirstOrDefault(p => p.SubOrderID == _suborderid);
                    }
                    if (SelectedSubOrder == null)
                    {
                        SelectedSubOrder = DataListSubOrder.FirstOrDefault();
                    }
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }
コード例 #4
0
ファイル: OrdersViewModel.cs プロジェクト: II01/i2MFCSv2.TAI
        private async Task ExecuteConfirm()
        {
            int    orderid, suborderid;
            string skuid;

            try
            {
                EditEnabled = false;
                EnabledCC   = false;
                try
                {
                    switch (_selectedCommand)
                    {
                    case CommandType.AddOrder:
                        Detailed.Order.SubOrderERPID = Detailed.Order.SubOrderID;
                        _dbservicewms.AddOrder(Detailed.Order);
                        orderid = Detailed.OrderID;
                        await ExecuteRefresh();

                        SelectedOrder = DataListOrder.FirstOrDefault(p => p.OrderID == orderid);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add order: {Detailed.Order.ToString()}");
                        break;

                    case CommandType.EditOrder:
                        _dbservicewms.UpdateOrders(SelectedOrder.ERPID, SelectedOrder.OrderID, Detailed.Order);
                        var loe = from d in DataListOrder
                                  where d.OrderID == SelectedOrder.OrderID
                                  select d;
                        foreach (var l in loe)
                        {
                            l.OrderID     = Detailed.OrderID;
                            l.Destination = Detailed.Destination;
                            l.ReleaseTime = Detailed.ReleaseTime;
                        }
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit order: {Detailed.Order.ToString()}");
                        break;

                    case CommandType.DeleteOrder:
                        _dbservicewms.DeleteOrders(SelectedOrder.ERPID, SelectedOrder.OrderID);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete order: {Detailed.Order.ToString()}");
                        await ExecuteRefresh();

                        break;

                    case CommandType.AddSubOrder:
                        Detailed.Order.SubOrderERPID = Detailed.Order.SubOrderID;
                        _dbservicewms.AddOrder(Detailed.Order);
                        orderid    = Detailed.OrderID;
                        suborderid = Detailed.SubOrderID;
                        await ExecuteRefresh();

                        SelectedSubOrder = DataListSubOrder.FirstOrDefault(p => p.OrderID == orderid && p.SubOrderID == suborderid);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add suborder: {Detailed.Order.ToString()}");
                        break;

                    case CommandType.EditSubOrder:
                        Detailed.Order.SubOrderERPID = Detailed.Order.SubOrderID;
                        _dbservicewms.UpdateSubOrders(Detailed.ERPID, SelectedSubOrder.OrderID, SelectedSubOrder.SubOrderID, Detailed.Order);
                        var lse = from d in DataListSubOrder
                                  where d.OrderID == SelectedSubOrder.OrderID && d.SubOrderID == SelectedSubOrder.SubOrderID
                                  select d;
                        foreach (var l in lse)
                        {
                            l.SubOrderID   = Detailed.SubOrderID;
                            l.SubOrderName = Detailed.SubOrderName;
                        }
                        SelectedSubOrder.SubOrderID   = Detailed.SubOrderID;
                        SelectedSubOrder.SubOrderName = Detailed.SubOrderName;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit suborder: {Detailed.Order.ToString()}");
                        break;

                    case CommandType.DeleteSubOrder:
                        _dbservicewms.DeleteSubOrders(Detailed.ERPID, Detailed.OrderID, Detailed.SubOrderID);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete suborder: {Detailed.Order.ToString()}");
                        await ExecuteRefresh();

                        break;

                    case CommandType.AddSKU:
                        if (Detailed.Order.SubOrderName == null)
                        {
                            Detailed.Order.SubOrderName = Detailed.Order.SubOrderID.ToString();
                        }
                        Detailed.Order.SubOrderERPID = Detailed.Order.SubOrderID;
                        _dbservicewms.AddSKU(Detailed.Order);
                        orderid    = Detailed.OrderID;
                        suborderid = Detailed.SubOrderID;
                        skuid      = Detailed.SKUID;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Add SKU: {Detailed.Order.ToString()}");
                        await ExecuteRefresh();

                        SelectedSubOrder = DataListSubOrder.FirstOrDefault(p => p.OrderID == orderid && p.SubOrderID == suborderid);
                        SelectedSKU      = DataListSKU.FirstOrDefault(p => p.OrderID == orderid && p.SubOrderID == suborderid && p.SKUID == skuid);
                        break;

                    case CommandType.EditSKU:
                        Detailed.Order.SubOrderERPID = Detailed.Order.SubOrderID;
                        _dbservicewms.UpdateSKU(Detailed.Order);
                        SelectedSKU.SKUID    = Detailed.SKUID;
                        SelectedSKU.SKUBatch = Detailed.SKUBatch;
                        SelectedSKU.SKUQty   = Detailed.SKUQty;
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Edit SKU: {Detailed.Order.ToString()}");
                        break;

                    case CommandType.DeleteSKU:
                        _dbservicewms.DeleteSKU(Detailed.Order);
                        _dbservicewms.AddLog(_accessUser, EnumLogWMS.Event, "UI", $"Delete SKU: {Detailed.Order.ToString()}");
                        await ExecuteRefresh();

                        break;

                    default:
                        break;
                    }
                    if (Detailed != null)
                    {
                        Detailed.EnableOrderEdit    = false;
                        Detailed.EnableSubOrderEdit = false;
                        Detailed.EnableSKUEdit      = false;
                        Detailed.ValidationEnabled  = false;
                    }
                }
                catch (Exception e)
                {
                    _warehouse.AddEvent(Event.EnumSeverity.Error, Event.EnumType.Exception, e.Message);
                }
            }
            catch (Exception e)
            {
                _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception,
                                    string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
            }
        }