public IList <ProductLineInProcessLocationDetail> GetProductLineInProcessLocationDetailGroupByItem(string prodLineCode, string status)
        {
            IList <ProductLineInProcessLocationDetail> plIpGroupList = new List <ProductLineInProcessLocationDetail>();
            IList <ProductLineInProcessLocationDetail> plIpList      = GetProductLineInProcessLocationDetail(prodLineCode, status);

            foreach (ProductLineInProcessLocationDetail plIpDetail in plIpList)
            {
                bool isExist = false;
                foreach (ProductLineInProcessLocationDetail plIpGroupDetail in plIpGroupList)
                {
                    if (plIpGroupDetail.Item.Code.Trim() == plIpDetail.Item.Code.Trim())
                    {
                        isExist                       = true;
                        plIpGroupDetail.Qty          += plIpDetail.Qty;
                        plIpGroupDetail.BackflushQty += plIpGroupDetail.BackflushQty;
                        break;
                    }
                }
                if (!isExist)
                {
                    ProductLineInProcessLocationDetail newPlIpDetail = new ProductLineInProcessLocationDetail();
                    newPlIpDetail.Item         = plIpDetail.Item;
                    newPlIpDetail.Qty          = plIpDetail.Qty;
                    newPlIpDetail.BackflushQty = plIpDetail.BackflushQty;
                    plIpGroupList.Add(newPlIpDetail);
                }
            }

            return(plIpGroupList);
        }
        public IList<ProductLineInProcessLocationDetail> GetProductLineInProcessLocationDetailGroupByItem(string prodLineCode, string status)
        {
            IList<ProductLineInProcessLocationDetail> plIpGroupList = new List<ProductLineInProcessLocationDetail>();
            IList<ProductLineInProcessLocationDetail> plIpList = GetProductLineInProcessLocationDetail(prodLineCode, status);
            foreach (ProductLineInProcessLocationDetail plIpDetail in plIpList)
            {
                bool isExist = false;
                foreach (ProductLineInProcessLocationDetail plIpGroupDetail in plIpGroupList)
                {
                    if (plIpGroupDetail.Item.Code == plIpDetail.Item.Code)
                    {
                        isExist = true;
                        plIpGroupDetail.Qty += plIpDetail.Qty;
                        plIpGroupDetail.BackflushQty += plIpGroupDetail.BackflushQty;
                        break;
                    }
                }
                if (!isExist)
                {
                    ProductLineInProcessLocationDetail newPlIpDetail = new ProductLineInProcessLocationDetail();
                    newPlIpDetail.Item = plIpDetail.Item;
                    newPlIpDetail.Qty = plIpDetail.Qty;
                    newPlIpDetail.BackflushQty = plIpDetail.BackflushQty;
                    plIpGroupList.Add(newPlIpDetail);
                }

            }

            return plIpGroupList;
        }
Ejemplo n.º 3
0
        public IList<InventoryTransaction> InventoryIn(ProductLineInProcessLocationDetail productLineInProcessLocationDetail, User user)
        {
            Hu hu = null;
            if (productLineInProcessLocationDetail.HuId != null && productLineInProcessLocationDetail.HuId.Trim() != string.Empty)
            {
                hu = this.huMgr.CheckAndLoadHu(productLineInProcessLocationDetail.HuId);
            }

            #region ���¿��
            IList<InventoryTransaction> inventoryTransactionList = RecordInventory(
                productLineInProcessLocationDetail.Item,
                productLineInProcessLocationDetail.LocationFrom,
                hu != null ? hu.HuId : null,
                hu != null ? hu.LotNo : null,
                productLineInProcessLocationDetail.Qty,
                false,
                null,
                BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_TR,
                null,
                //true,
                user,
                false,
                false,
                null
                );
            #endregion

            #region ��¼�������
            foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
            {
                this.locationTransactionMgr.RecordLocationTransaction(inventoryTransaction, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_TR, user);
            }
            #endregion

            return inventoryTransactionList;
        }
 public virtual void DeleteProductLineInProcessLocationDetail(ProductLineInProcessLocationDetail entity)
 {
     entityDao.DeleteProductLineInProcessLocationDetail(entity);
 }
        public void RecordLocationTransaction(ProductLineInProcessLocationDetail productLineInProcessLocationDetail, string transType, User user, string ioType)
        {
            LocationTransaction locationTransaction = new LocationTransaction();

            locationTransaction.HuId = productLineInProcessLocationDetail.HuId;
            locationTransaction.LotNo = productLineInProcessLocationDetail.LotNo;
            //locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.Item = productLineInProcessLocationDetail.Item.Code;
            locationTransaction.ItemDescription = productLineInProcessLocationDetail.Item.Description;
            locationTransaction.Uom = productLineInProcessLocationDetail.Item.Uom.Code;
            if (transType == BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_MATERIAL_IN)
            {
                locationTransaction.Qty = productLineInProcessLocationDetail.Qty;

                if (ioType == BusinessConstants.IO_TYPE_OUT)
                {
                    locationTransaction.RefLocation = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.Location = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.LocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
                else
                {
                    locationTransaction.Location = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.LocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.RefLocation = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
            }
            else if (transType == BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_MATERIAL_IN)
            {
                locationTransaction.Qty = 0 - productLineInProcessLocationDetail.CurrentBackflushQty;

                if (ioType == BusinessConstants.IO_TYPE_OUT)
                {
                    locationTransaction.Location = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.LocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.RefLocation = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
                else
                {
                    locationTransaction.RefLocation = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.Location = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.LocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
            }
            else
            {
                throw new TechnicalException("Invalided TransType: " + transType);
            }
            locationTransaction.PartyFrom = productLineInProcessLocationDetail.ProductLine.PartyFrom.Code;
            locationTransaction.PartyFromName = productLineInProcessLocationDetail.ProductLine.PartyFrom.Name;
            locationTransaction.PartyTo = productLineInProcessLocationDetail.ProductLine.PartyTo.Code;
            locationTransaction.PartyToName = productLineInProcessLocationDetail.ProductLine.PartyTo.Name;
            locationTransaction.TransactionType = transType;
            locationTransaction.CreateDate = DateTime.Now;
            locationTransaction.CreateUser = user.Code;
            locationTransaction.EffectiveDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

            this.CreateLocationTransaction(locationTransaction);
        }
        public void RawMaterialIn(string prodLineCode, IList <MaterialIn> materialInList, User user)
        {
            Flow flow = this.flowMgr.CheckAndLoadFlow(prodLineCode);
            IList <BomDetail> bomDetailList = this.flowMgr.GetBatchFeedBomDetail(flow);

            IList <MaterialIn> noneZeroMaterialInList = new List <MaterialIn>();
            DateTime           dateTimeNow            = DateTime.Now;

            if (materialInList != null && materialInList.Count > 0)
            {
                foreach (MaterialIn materialIn in materialInList)
                {
                    if (materialIn.Qty != 0)
                    {
                        noneZeroMaterialInList.Add(materialIn);
                    }

                    #region 查找物料是否是生产线上投料的
                    if (bomDetailList != null && bomDetailList.Count > 0)
                    {
                        bool findMatch = false;
                        foreach (BomDetail bomDetail in bomDetailList)
                        {
                            if (bomDetail.Item.Code == materialIn.RawMaterial.Code)
                            {
                                findMatch = true;
                                break;
                            }
                        }

                        if (!findMatch)
                        {
                            throw new BusinessErrorException("MasterData.Production.Feed.Error.NotContainMaterial", materialIn.RawMaterial.Code, prodLineCode);
                        }
                    }
                    else
                    {
                        throw new BusinessErrorException("MasterData.Production.Feed.Error.NoFeedMaterial", prodLineCode);
                    }
                    #endregion
                }
            }

            if (noneZeroMaterialInList.Count == 0)
            {
                throw new BusinessErrorException("Order.Error.ProductLineInProcessLocationDetailEmpty");
            }

            foreach (MaterialIn materialIn in noneZeroMaterialInList)
            {
                #region 出库
                IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InventoryOut(materialIn, user, flow);
                #endregion

                #region 入生产线物料
                foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
                {
                    ProductLineInProcessLocationDetail productLineInProcessLocationDetail = new ProductLineInProcessLocationDetail();
                    productLineInProcessLocationDetail.ProductLine    = flow;
                    productLineInProcessLocationDetail.Operation      = materialIn.Operation;
                    productLineInProcessLocationDetail.Item           = inventoryTransaction.Item;
                    productLineInProcessLocationDetail.HuId           = inventoryTransaction.Hu != null ? inventoryTransaction.Hu.HuId : null;
                    productLineInProcessLocationDetail.LotNo          = inventoryTransaction.Hu != null ? inventoryTransaction.Hu.LotNo : null;
                    productLineInProcessLocationDetail.Qty            = 0 - inventoryTransaction.Qty;
                    productLineInProcessLocationDetail.IsConsignment  = inventoryTransaction.IsConsignment;
                    productLineInProcessLocationDetail.PlannedBill    = inventoryTransaction.PlannedBill;
                    productLineInProcessLocationDetail.Status         = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
                    productLineInProcessLocationDetail.LocationFrom   = inventoryTransaction.Location;
                    productLineInProcessLocationDetail.CreateDate     = dateTimeNow;
                    productLineInProcessLocationDetail.CreateUser     = user;
                    productLineInProcessLocationDetail.LastModifyDate = dateTimeNow;
                    productLineInProcessLocationDetail.LastModifyUser = user;

                    this.CreateProductLineInProcessLocationDetail(productLineInProcessLocationDetail);

                    //记录库存事务
                    this.locationTransactionMgr.RecordLocationTransaction(productLineInProcessLocationDetail, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_MATERIAL_IN, user, BusinessConstants.IO_TYPE_IN);
                }
                #endregion
            }
        }
        public void RecordLocationTransaction(ProductLineInProcessLocationDetail productLineInProcessLocationDetail, string transType, User user, string ioType)
        {
            LocationTransaction locationTransaction = new LocationTransaction();

            locationTransaction.HuId  = productLineInProcessLocationDetail.HuId;
            locationTransaction.LotNo = productLineInProcessLocationDetail.LotNo;
            //locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.Item            = productLineInProcessLocationDetail.Item.Code;
            locationTransaction.ItemDescription = productLineInProcessLocationDetail.Item.Description;
            locationTransaction.Uom             = productLineInProcessLocationDetail.Item.Uom.Code;
            if (transType == BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_MATERIAL_IN)
            {
                locationTransaction.Qty = productLineInProcessLocationDetail.Qty;

                if (ioType == BusinessConstants.IO_TYPE_OUT)
                {
                    locationTransaction.RefLocation     = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.Location        = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.LocationName    = productLineInProcessLocationDetail.LocationFrom.Name;
                }
                else
                {
                    locationTransaction.Location        = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.LocationName    = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.RefLocation     = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
            }
            else if (transType == BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_MATERIAL_IN)
            {
                locationTransaction.Qty = 0 - productLineInProcessLocationDetail.CurrentBackflushQty;

                if (ioType == BusinessConstants.IO_TYPE_OUT)
                {
                    locationTransaction.Location        = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.LocationName    = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.RefLocation     = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.LocationFrom.Name;
                }
                else
                {
                    locationTransaction.RefLocation     = productLineInProcessLocationDetail.ProductLine.Code;
                    locationTransaction.RefLocationName = productLineInProcessLocationDetail.ProductLine.Description;
                    locationTransaction.Location        = productLineInProcessLocationDetail.LocationFrom.Code;
                    locationTransaction.LocationName    = productLineInProcessLocationDetail.LocationFrom.Name;
                }
            }
            else
            {
                throw new TechnicalException("Invalided TransType: " + transType);
            }
            locationTransaction.PartyFrom       = productLineInProcessLocationDetail.ProductLine.PartyFrom.Code;
            locationTransaction.PartyFromName   = productLineInProcessLocationDetail.ProductLine.PartyFrom.Name;
            locationTransaction.PartyTo         = productLineInProcessLocationDetail.ProductLine.PartyTo.Code;
            locationTransaction.PartyToName     = productLineInProcessLocationDetail.ProductLine.PartyTo.Name;
            locationTransaction.TransactionType = transType;
            locationTransaction.CreateDate      = DateTime.Now;
            locationTransaction.CreateUser      = user.Code;
            locationTransaction.EffectiveDate   = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

            this.CreateLocationTransaction(locationTransaction);
        }
 public virtual void DeleteProductLineInProcessLocationDetail(ProductLineInProcessLocationDetail entity)
 {
     Delete(entity);
 }
Ejemplo n.º 9
0
 public virtual void UpdateProductLineInProcessLocationDetail(ProductLineInProcessLocationDetail entity)
 {
     Update(entity);
 }
        public void RawMaterialIn(string prodLineCode, IList<MaterialIn> materialInList, User user)
        {
            Flow flow = this.flowMgr.CheckAndLoadFlow(prodLineCode);
            IList<BomDetail> bomDetailList = this.flowMgr.GetBatchFeedBomDetail(flow);

            IList<MaterialIn> noneZeroMaterialInList = new List<MaterialIn>();
            DateTime dateTimeNow = DateTime.Now;

            if (materialInList != null && materialInList.Count > 0)
            {
                foreach (MaterialIn materialIn in materialInList)
                {
                    if (materialIn.Qty != 0)
                    {
                        noneZeroMaterialInList.Add(materialIn);
                    }

                    #region ���������Ƿ�����������Ͷ�ϵ�
                    if (bomDetailList != null && bomDetailList.Count > 0)
                    {
                        bool findMatch = false;
                        foreach (BomDetail bomDetail in bomDetailList)
                        {
                            if (bomDetail.Item.Code == materialIn.RawMaterial.Code)
                            {
                                findMatch = true;
                                break;
                            }
                        }

                        if (!findMatch)
                        {
                            throw new BusinessErrorException("MasterData.Production.Feed.Error.NotContainMaterial", materialIn.RawMaterial.Code, prodLineCode);
                        }
                    }
                    else
                    {
                        throw new BusinessErrorException("MasterData.Production.Feed.Error.NoFeedMaterial", prodLineCode);
                    }
                    #endregion
                }
            }

            if (noneZeroMaterialInList.Count == 0)
            {
                throw new BusinessErrorException("Order.Error.ProductLineInProcessLocationDetailEmpty");
            }

            foreach (MaterialIn materialIn in noneZeroMaterialInList)
            {
                #region ����
                IList<InventoryTransaction> inventoryTransactionList = this.locationMgr.InventoryOut(materialIn, user, flow);
                #endregion

                #region ������������
                foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
                {
                    ProductLineInProcessLocationDetail productLineInProcessLocationDetail = new ProductLineInProcessLocationDetail();
                    productLineInProcessLocationDetail.ProductLine = flow;
                    productLineInProcessLocationDetail.Operation = materialIn.Operation;
                    productLineInProcessLocationDetail.Item = inventoryTransaction.Item;
                    productLineInProcessLocationDetail.HuId = inventoryTransaction.Hu != null ? inventoryTransaction.Hu.HuId : null;
                    productLineInProcessLocationDetail.LotNo = inventoryTransaction.Hu != null ? inventoryTransaction.Hu.LotNo : null;
                    productLineInProcessLocationDetail.Qty = 0 - inventoryTransaction.Qty;
                    productLineInProcessLocationDetail.IsConsignment = inventoryTransaction.IsConsignment;
                    productLineInProcessLocationDetail.PlannedBill = inventoryTransaction.PlannedBill;
                    productLineInProcessLocationDetail.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
                    productLineInProcessLocationDetail.LocationFrom = inventoryTransaction.Location;
                    productLineInProcessLocationDetail.CreateDate = dateTimeNow;
                    productLineInProcessLocationDetail.CreateUser = user;
                    productLineInProcessLocationDetail.LastModifyDate = dateTimeNow;
                    productLineInProcessLocationDetail.LastModifyUser = user;

                    this.CreateProductLineInProcessLocationDetail(productLineInProcessLocationDetail);

                    //��¼�������
                    this.locationTransactionMgr.RecordLocationTransaction(productLineInProcessLocationDetail, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_MATERIAL_IN, user, BusinessConstants.IO_TYPE_IN);
                }
                #endregion
            }
        }
 public virtual void UpdateProductLineInProcessLocationDetail(ProductLineInProcessLocationDetail entity)
 {
     entityDao.UpdateProductLineInProcessLocationDetail(entity);
 }