コード例 #1
0
ファイル: MaterialService.cs プロジェクト: ewin66/SCOUT_NS
        public static bool AdjustMaterialConsumableItem(Part part, Shopfloorline sfl, int qty, string comments, AdjustmentTransactionType sourceType, MessageListener messages)
        {
            var repo       = Scout.Core.Data.GetRepository(part.Session);
            var consumable = new MaterialsConsumableInventory(repo);

            MaterialConsumableItem item;

            try
            {
                if (sourceType.Direction == "IN")
                {
                    item = consumable.IncreaseItemQty(part, sfl, qty);
                }
                else
                {
                    item = consumable.DecreaseItemQty(part, sfl, qty);
                }

                WriteQtyAdjustmentTransaction(item, qty, comments, sourceType);


                return(repo.Save());
            }
            catch (Exception ex)
            {
                Scout.Core.UserInteraction.Dialog.ShowMessage(ex.Message, UserMessageType.Error);
                return(false);
            }
        }
コード例 #2
0
ファイル: MaterialService.cs プロジェクト: ewin66/SCOUT_NS
        public static bool IssueOutMaterial(MaterialWarehouseItem item, Shopfloorline shopfloorline, int qty)
        {
            if (!new MaterialIssueOutValidator(item, shopfloorline, qty).Validated())
            {
                return(false);
            }

            try
            {
                var repo       = Scout.Core.Data.GetRepository(shopfloorline.Session);
                var warehouse  = new MaterialsWarehouseInventory(repo);
                var consumable = new MaterialsConsumableInventory(repo);

                consumable.IncreaseItemQty(item.Part, shopfloorline, qty);
                warehouse.DecreaseItemQuantity(item.Part, item.Domain, item.RackLocation, qty);

                // Write the transaction
                WriteIssueOutTransaction(item, qty, shopfloorline);

                //Commit
                return(repo.Save());
            }
            catch (Exception ex)
            {
                Scout.Core.UserInteraction.Dialog.ShowMessage(ex.Message, UserMessageType.Error);
                return(false);
            }
        }