Inheritance: PartyBase
示例#1
0
 public virtual void CreateParty(Party entity)
 {
     entityDao.CreateParty(entity);
 }
示例#2
0
        private Hu ResolveAndCreateHu(string barCode, Uom uom, Party manufactureParty)
        {
            object[] result = ResolveBarCode(barCode);
            Item item = (Item)result[0];
            string supMark = (string)result[1];
            string lotNo = (string)result[2];
            decimal qty = (decimal)result[3];
            int seq = (int)result[4];
            DateTime manufactureDate = (DateTime)result[5];

            Hu hu = new Hu();
            hu.HuId = barCode;
            hu.Item = item;
            hu.Uom = uom;
            #region 单位用量
            if (item.Uom.Code != uom.Code)
            {
                hu.UnitQty = this.uomConversionMgr.ConvertUomQty(item, uom, 1, item.Uom);   //单位用量
            }
            else
            {
                hu.UnitQty = 1;
            }
            #endregion
            hu.QualityLevel = BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1;
            hu.Qty = qty / hu.UnitQty;
            hu.UnitCount = qty;
            hu.LotNo = lotNo;
            hu.ManufactureDate = manufactureDate;
            hu.ManufactureParty = manufactureParty;
            hu.CreateUser = this.userMgr.GetMonitorUser();
            hu.CreateDate = DateTime.Now;
            hu.Status = BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_CREATE;
            hu.LotSize = hu.Qty;

            this.huMgr.CreateHu(hu);
            this.numberControlMgr.ReverseUpdateHuId(barCode);

            return hu;
        }
示例#3
0
        public IList<Hu> CreateHu(Item item, decimal qty, string lotNo, Uom uom, decimal unitCount, int? huLotSize,
            string orderNo, string recNo, DateTime? manufactureDate, Party manufactureParty, string qualityLevel, User user, Object obj, string shiftCode, string itemVersion, string idMark,string customerItemCode)
        {
            IList<Hu> huList = new List<Hu>();

            #region 根据Hu批量创建Hu
            decimal remainHuQty = qty;                                        //剩余量
            decimal currentHuQty = GetNextHuQty(ref remainHuQty, huLotSize);  //本次量
            DateTime dateTimeNow = DateTime.Now;

            while (currentHuQty > 0)
            {
                #region 创建Hu
                Hu hu = new Hu();
                #region HuId生成
                if (obj.GetType() == typeof(FlowDetail))
                {
                    FlowDetail flowDetail = (FlowDetail)obj;
                    if (flowDetail.Flow.Type != BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(flowDetail, lotNo, currentHuQty, idMark);
                    }
                    else
                    {
                        if (shiftCode != null && shiftCode.Trim().Length != 0)
                        {
                            lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                            hu.HuId = this.numberControlMgrE.GenerateFGHuId(flowDetail, shiftCode, currentHuQty, idMark);
                        }
                        else
                        {
                            throw new TechnicalException("ShiftCode can't be null when create fg huId by flowdetail");
                        }
                    }
                }
                else if (obj.GetType() == typeof(OrderDetail))
                {
                    OrderDetail orderDetail = (OrderDetail)obj;
                    if (orderDetail.OrderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo(orderDetail.OrderHead.WindowTime);
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(orderDetail, lotNo, currentHuQty, idMark);
                    }
                    else
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo(orderDetail.OrderHead.WindowTime);
                        hu.HuId = this.numberControlMgrE.GenerateFGHuId(orderDetail, currentHuQty, idMark);
                    }
                }
                else if (obj.GetType() == typeof(InProcessLocationDetail))
                {
                    InProcessLocationDetail inProcessLocationDetail = (InProcessLocationDetail)obj;
                    if (inProcessLocationDetail.OrderLocationTransaction.OrderDetail.OrderHead.Type
                        != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(inProcessLocationDetail, lotNo, currentHuQty);
                    }
                    else
                    {
                        throw new TechnicalException("Can't create fg huid by InProcessLocationDetail");
                    }
                }
                else if (obj.GetType() == typeof(ReceiptDetail))
                {
                    ReceiptDetail receiptDetail = (ReceiptDetail)obj;
                    if (receiptDetail.OrderLocationTransaction.OrderDetail.OrderHead.Type
                        != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(receiptDetail, lotNo, currentHuQty);
                    }
                    else
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateFGHuId(receiptDetail, currentHuQty);
                    }
                }
                else
                {
                    throw new TechnicalException("Parameter obj only accept type: FlowDetail, OrderDetail, InProcessLocationDetail, ReceiptDetail");
                }
                #endregion
                hu.Item = item;
                hu.OrderNo = orderNo;
                hu.ReceiptNo = recNo;
                hu.Uom = uom;   //用订单单位
                hu.UnitCount = unitCount;
                #region 单位用量
                //如果是OrderDetail,应该等于inOrderLocationTransaction.UnitQty,现在暂时直接用单位换算
                if (item.Uom.Code != uom.Code)
                {
                    hu.UnitQty = this.uomConversionMgrE.ConvertUomQty(item, uom, 1, item.Uom);   //单位用量
                }
                else
                {
                    hu.UnitQty = 1;
                }
                #endregion
                hu.QualityLevel = qualityLevel;
                hu.Qty = currentHuQty;
                hu.LotNo = lotNo;
                hu.ManufactureDate = manufactureDate.HasValue ? manufactureDate.Value : LotNoHelper.ResolveLotNo(hu.LotNo);
                hu.ManufactureParty = manufactureParty;
                hu.CreateUser = user;
                hu.CreateDate = dateTimeNow;
                hu.LotSize = huLotSize.HasValue ? huLotSize.Value : currentHuQty;
                hu.Version = itemVersion;
                hu.Status = BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_CREATE;
                hu.CustomerItemCode = customerItemCode;

                this.CreateHu(hu);
                #endregion

                huList.Add(hu);
                currentHuQty = GetNextHuQty(ref remainHuQty, huLotSize);
            }
            #endregion

            return huList;
        }
 public ShipAddress GetDefaultShipAddress(Party party)
 {
     return GetDefaultShipAddress(party.Code);
 }
示例#5
0
        private Hu ResolveHu(string antiResolveHuOption, string huId, Uom uom, Party manufactureParty)
        {
            Hu hu = null;
            if (antiResolveHuOption == BusinessConstants.CODE_MASTER_ANTI_RESOLVE_HU_VALUE_NOT_RESOLVE
                || antiResolveHuOption == null || antiResolveHuOption.Trim() == string.Empty)
            {
                hu = huMgr.CheckAndLoadHu(huId);
            }
            else
            {
                #region 自动解析HuId,生成Hu
                hu = huMgr.LoadHu(huId);

                if (hu == null)
                {
                    hu = this.ResolveAndCreateHu(huId, uom, manufactureParty);
                }
                #endregion
            }

            return hu;
        }
 public IList<ItemReference> GetItemReference(Item item, Party partyFrom, Party partyTo)
 {
     return GetItemReference(item.Code, partyFrom.Code, partyTo.Code);
 }
 private PurchasePriceList LoadPurchasePriceList(string code, Party party)
 {
     PurchasePriceList purchasePriceList = purchasePriceListMgrE.LoadPurchasePriceList(code);
     if (purchasePriceList == null)
     {
         purchasePriceList = new PurchasePriceList();
         purchasePriceList.Code = code;
         purchasePriceList.Party = party;
         purchasePriceList.IsActive = true;
         this.purchasePriceListMgrE.CreatePurchasePriceList(purchasePriceList);
     }
     return purchasePriceList;
 }
示例#8
0
 public virtual ItemReference LoadItemReference(com.Sconit.Entity.MasterData.Item item, com.Sconit.Entity.MasterData.Party party, String referenceCode)
 {
     return(entityDao.LoadItemReference(item, party, referenceCode));
 }
        public virtual ItemReference LoadItemReference(com.Sconit.Entity.MasterData.Item item, com.Sconit.Entity.MasterData.Party party, String referenceCode)
        {
            string hql = @"from ItemReference entity where entity.Item.Code = ? and entity.Party.Code = ? and entity.ReferenceCode = ?";
            IList <ItemReference> result = FindAllWithCustomQuery <ItemReference>(hql, new object[] { item.Code, party.Code, referenceCode }, new IType[] { NHibernateUtil.String, NHibernateUtil.String, NHibernateUtil.String });

            if (result != null && result.Count > 0)
            {
                return(result[0]);
            }
            else
            {
                return(null);
            }
        }
示例#10
0
 public IList GetBillAddress(Party party)
 {
     return GetBillAddress(party.Code, false);
 }
示例#11
0
 public IList GetBillAddress(Party party, bool includeInactive)
 {
     return GetBillAddress(party.Code, includeInactive);
 }
 public virtual void DeleteParty(Party entity)
 {
     Delete(entity);
 }
 public virtual void UpdateParty(Party entity)
 {
     Update(entity);
 }
 public virtual void CreateParty(Party entity)
 {
     Create(entity);
 }
示例#15
0
 public virtual void DeleteParty(Party entity)
 {
     entityDao.DeleteParty(entity);
 }
 private SalesPriceList LoadSalesPriceList(string code, Party party)
 {
     SalesPriceList salesPriceList = salesPriceListMgrE.LoadSalesPriceList(code);
     if (salesPriceList == null)
     {
         salesPriceList = new SalesPriceList();
         salesPriceList.Code = code;
         salesPriceList.Party = party;
         salesPriceList.IsActive = true;
         this.salesPriceListMgrE.CreateSalesPriceList(salesPriceList);
     }
     return salesPriceList;
 }
示例#17
0
 public virtual void UpdateParty(Party entity)
 {
     entityDao.UpdateParty(entity);
 }
示例#18
0
 public override ItemReference LoadItemReference(Item item, Party party, string referenceCode)
 {
     string partyCode = party == null ? string.Empty : party.Code;
     return this.LoadItemReference(item.Code, partyCode, referenceCode);
 }