public void FeedOrderRawMaterial(string orderNo, string location, List<com.Sconit.Entity.SD.INV.Hu> hus, bool isForceFeed, DateTime? effectiveDate) { if (hus == null || hus.Count == 0) { throw new Entity.Exception.BusinessException("投料的条码明细不能为空"); } var feedInputs = new List<Entity.PRD.FeedInput>(); foreach (var hu in hus) { if (hu.IsEffective == false) { #region 校验投料的库位是否Bom物料的来源库位 if (!isForceFeed) { IList<string> orderBomLoationList = this.genericMgr.FindAll<string>("select distinct Location from OrderBomDetail where OrderNo = ? and Item = ? and IsScanHu = ?", new object[] { orderNo, hu.Item, true }); if (orderBomLoationList == null || orderBomLoationList.Count == 0 || !orderBomLoationList.Contains(location)) { string bomLocations = string.Empty; foreach (string bomLocation in orderBomLoationList) { if (orderBomLoationList.IndexOf(bomLocation) == 0) { bomLocations += bomLocation; } else { bomLocations += ", " + bomLocation; } } if (bomLocations != string.Empty) { throw new BusinessException("关键件{0}不在库位{1}上投料,可投料的库位有{2}", hu.Item, location, bomLocations); } else { throw new BusinessException("物料{1}不是生产单{0}的关键件。", orderNo, hu.Item); } } } #endregion TryPackBarcode(hu.HuId, location); } var feedInput = new Entity.PRD.FeedInput(); feedInput.HuId = hu.HuId; feedInput.LotNo = hu.LotNo; feedInput.Qty = hu.Qty; feedInputs.Add(feedInput); } effectiveDate = effectiveDate.HasValue ? effectiveDate.Value : DateTime.Now; this.genericMgr.FlushSession(); this.productionLineMgr.FeedRawMaterial(orderNo, feedInputs, isForceFeed, effectiveDate.Value); }
public void FeedProdLineRawMaterial(string productLine, string productLineFacility, string location, List<com.Sconit.Entity.SD.INV.Hu> hus, bool isForceFeed, DateTime? effectiveDate) { if (hus == null || hus.Count == 0) { throw new Entity.Exception.BusinessException("投料的条码明细不能为空"); } var feedInputs = new List<Entity.PRD.FeedInput>(); foreach (var hu in hus) { if (hu.IsEffective == false) { TryPackBarcode(hu.HuId, location); } var feedInput = new Entity.PRD.FeedInput(); feedInput.HuId = hu.HuId; feedInput.LotNo = hu.LotNo; feedInput.Qty = hu.Qty; feedInputs.Add(feedInput); } effectiveDate = effectiveDate.HasValue ? effectiveDate.Value : DateTime.Now; this.genericMgr.FlushSession(); this.productionLineMgr.FeedRawMaterial(productLine, productLineFacility, feedInputs, isForceFeed, effectiveDate.Value); }