示例#1
0
 public static void UpdateSOQty(SubSalesOrderLine SubSOLine)
 {
     UnitOfWork uow = new UnitOfWork();
     uow.BeginTransaction();
     SubSalesOrderLine soLine = uow.FindObject<SubSalesOrderLine>(new BinaryOperator("Oid", SubSOLine.Oid));
     soLine.UpdateQty();
     soLine.Save();
     uow.CommitTransaction();
 }
        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;
            }
        }