Esempio n. 1
0
        public static SubItemSetting GetInstance(Session session, SubItem.SubItemType subItemType)
        {
            SubItemSetting setting = session.FindObject<SubItemSetting>(new BinaryOperator("ItemType", subItemType));

            if (setting == null)
            {
                session.BeginTransaction();
                setting = new SubItemSetting(session);
                setting.ItemType = subItemType;
                setting.Save();
                session.CommitTransaction();
            }

            return setting;
        }
Esempio n. 2
0
        public static List<SubSalesOrderLine> LoadOpenBalance(UnitOfWork uow, SubItem SubItem)
        {
            XPCollection<SubSalesOrderLine> soLines = new XPCollection<SubSalesOrderLine>(uow);
            var SoList = soLines.Where(So => So.Item.ItemNo == SubItem.ItemNo &&
                    So.OrderStatus == SalesOrderLine.SalesOrderStatus.Active)
                    .OrderBy(So => So.NeedDate);

            return SoList.ToList();
        }
Esempio n. 3
0
 public static List<SubPurchOrderLine> LoadOpenBalance(UnitOfWork uow, SubItem SubItem, 
     SubPurchOrderLine.OrderType PoType)
 {
     XPCollection<SubPurchOrderLine> PoLines = new XPCollection<SubPurchOrderLine>(uow);
     var PoList = PoLines.Where(Po => Po.SubItem.ItemNo == SubItem.ItemNo &&
                             Po.OrderStatus == PurchOrderStatus.Active &&
                             Po.PurchOrderLineType == PoType).OrderBy(Po => Po.NeedDate);
     return PoList.ToList();
 }
        private void CreatePurchOrderReceive(SubItem.SubItemType subItemType)
        {
            UnitOfWork uow = new UnitOfWork();
            XPCollection<SubItemSummary> SubItemSummarys = new XPCollection<SubItemSummary>(uow);

            SubItemSummarys.Criteria = CriteriaOperator.Parse(string.Format("(CanShipQty > 0 OR CanShipDefectQty > 0 OR CanShipNWDefectQty > 0) AND SubItem.ItemType == '{0}'", subItemType));

            foreach (SubItemSummary subItemSummary in SubItemSummarys)
            {
                SubPurchOrderReceive.IssuePOReceiveFromSummary(subItemSummary);
            }

            uow = null;
        }
Esempio n. 5
0
        public static void IssuePOReceive(SubItem subItem, SubPurchOrderLine.OrderType poType, SubSalesOrderLine soLine,
                                                     ref float Qty, ref float DefectQty, ref float NWDefectQty)
        {
            UnitOfWork uow = new UnitOfWork();
            uow.BeginTransaction();
            List<SubPurchOrderLine> PoLines = SubPurchOrderLine.LoadOpenBalance(uow, subItem, poType);

            try
            {
                for (int i = 0; i < PoLines.Count; i++)
                {
                    if (Qty == 0 && DefectQty == 0 && NWDefectQty == 0)
                        break;

                    SubPurchOrderLine poLine = PoLines[i];
                    SubPurchOrderReceive poReceive = new SubPurchOrderReceive(uow);
                    poReceive.PurchOrderLine = poLine;

                    if (soLine != null)
                    {
                        poReceive.SalesOrderLine = uow.FindObject<SubSalesOrderLine>(new BinaryOperator("Oid", soLine.Oid));
                    }

                    float poBal = poLine.BalQty;
                    poReceive.Qty = UDFunction.AssignSmallQty(ref poBal, ref Qty);
                    poReceive.DefectQty = UDFunction.AssignSmallQty(ref poBal, ref DefectQty);
                    poReceive.NWDefectQty = UDFunction.AssignSmallQty(ref poBal, ref NWDefectQty);

                    poReceive.Save();
                    poReceive.Post();

                }

                uow.CommitTransaction();
            }
            catch (Exception ex)
            {
                uow.RollbackTransaction();
                throw ex;
            }
        }