public OrderLocationTransaction AddNewMaterial(OrderDetail orderDetail, BomDetail bomDetail, Location orgLocation, decimal orgOrderedQty) { //�����ѡװ������Ĭ�ϲ���װ������������� if (bomDetail.StructureType != BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_O || bomDetail.Priority != 0) { foreach (OrderLocationTransaction orderLocationTransaction in orderDetail.OrderLocationTransactions) { if (orderLocationTransaction.Item.Code == bomDetail.Item.Code && orderLocationTransaction.Operation == bomDetail.Operation) { //�ϲ���ͬ���� //decimal orderedQty = orderDetail.OrderedQty * orgOrderedQty * bomDetail.RateQty * (1 + bomDetail.ScrapPercentage); decimal orderedQty = orgOrderedQty * bomDetail.RateQty * (1 + bomDetail.ScrapPercentage); if (orderLocationTransaction.Uom.Code != bomDetail.Uom.Code) { orderedQty = this.uomConversionMgr.ConvertUomQty(orderLocationTransaction.Item.Code, bomDetail.Uom, orderedQty, orderLocationTransaction.Uom); } orderLocationTransaction.UnitQty += orgOrderedQty * bomDetail.RateQty * (1 + bomDetail.ScrapPercentage); orderLocationTransaction.OrderedQty += orderedQty; this.UpdateOrderLocationTransaction(orderLocationTransaction); return orderLocationTransaction; } } Location bomLocFrom = bomDetail.Location != null ? bomDetail.Location : orgLocation; OrderLocationTransaction newOrderLocationTransaction = this.GenerateOrderLocationTransaction(orderDetail, bomDetail.Item, bomDetail, bomDetail.Uom, bomDetail.Operation, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO, orgOrderedQty * bomDetail.RateQty * (1 + bomDetail.ScrapPercentage), bomLocFrom, bomDetail.IsShipScanHu, bomDetail.HuLotSize, bomDetail.NeedPrint, bomDetail.BackFlushMethod, null, null); this.CreateOrderLocationTransaction(newOrderLocationTransaction); orderDetail.AddOrderLocationTransaction(newOrderLocationTransaction); this.orderOperationMgr.TryAddOrderOperation(orderDetail.OrderHead, bomDetail.Operation, bomDetail.Reference); return newOrderLocationTransaction; } return null; }
public virtual void UpdateBomDetail(BomDetail entity) { entityDao.UpdateBomDetail(entity); }
public virtual void DeleteBomDetail(BomDetail entity) { entityDao.DeleteBomDetail(entity); }
public OrderLocationTransaction GenerateOrderLocationTransaction( OrderDetail orderDetail, Item item, BomDetail bomDetail, Uom uom, int operation, string ioType, string transactionType, decimal unitQty, Location loc, bool isShipScanHu, int? huLotSize, bool needPrint, string backFlushMethod, string itemVersion, Location rejectLocation) { OrderLocationTransaction orderLocationTransaction = new OrderLocationTransaction(); orderLocationTransaction.OrderDetail = orderDetail; orderLocationTransaction.Item = item; orderLocationTransaction.OrderedQty = unitQty * orderDetail.OrderedQty; //根据unitQty计算实际的订单量 orderLocationTransaction.Uom = uom; orderLocationTransaction.Operation = operation; orderLocationTransaction.IOType = ioType; orderLocationTransaction.TransactionType = transactionType; orderLocationTransaction.UnitQty = unitQty; orderLocationTransaction.Location = loc; orderLocationTransaction.RejectLocation = rejectLocation; orderLocationTransaction.IsShipScanHu = isShipScanHu; //仅生产有效 orderLocationTransaction.BackFlushMethod = backFlushMethod; //生产回冲物料方式 orderLocationTransaction.ItemVersion = itemVersion; if (huLotSize.HasValue) { orderLocationTransaction.HuLotSize = int.Parse(Math.Round(huLotSize.Value * unitQty).ToString("#")); } orderLocationTransaction.NeedPrint = needPrint; orderLocationTransaction.IsAssemble = true; //默认都安装 if (bomDetail != null) { orderLocationTransaction.BomDetail = bomDetail; if (bomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_O) { //如果是选装件,取bomDetail.Priority作为选装件的默认值,0代表默认不装,1代表默认安装 orderLocationTransaction.IsAssemble = (bomDetail.Priority != 0); } } if (uom.Code != item.Uom.Code) //和库存单位不一致,需要进行转化 { //单位转化,更改UnitQty和OrderedQty值 orderLocationTransaction.Uom = item.Uom; orderLocationTransaction.UnitQty = this.uomConversionMgrE.ConvertUomQty(item, uom, unitQty, item.Uom); orderLocationTransaction.OrderedQty = this.uomConversionMgrE.ConvertUomQty(item, uom, orderLocationTransaction.OrderedQty, item.Uom); if (orderLocationTransaction.HuLotSize.HasValue) { orderLocationTransaction.HuLotSize = int.Parse(Math.Round(orderLocationTransaction.HuLotSize.Value * orderLocationTransaction.UnitQty).ToString("#")); } } orderDetail.AddOrderLocationTransaction(orderLocationTransaction); return orderLocationTransaction; }
private void UpdateView() { bomdetail = TheBomDetailMgr.LoadBomDetail(Convert.ToInt32(this.code)); TextBox tbParCode = (TextBox)(this.FV_BomDetail.FindControl("tbParCode")); TextBox tbCompCode = (TextBox)(this.FV_BomDetail.FindControl("tbCompCode")); TextBox tbOp = (TextBox)(this.FV_BomDetail.FindControl("tbOp")); TextBox tbReference = (TextBox)(this.FV_BomDetail.FindControl("tbReference")); TextBox tbStartTime = (TextBox)(this.FV_BomDetail.FindControl("tbStartTime")); TextBox tbEndTime = (TextBox)(this.FV_BomDetail.FindControl("tbEndTime")); TextBox tbRateQty = (TextBox)(this.FV_BomDetail.FindControl("tbRateQty")); Controls_TextBox tbUom = (Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom")); Controls_TextBox tbStruType = (Controls_TextBox)(this.FV_BomDetail.FindControl("tbStruType")); TextBox tbScrapPercentage = (TextBox)(this.FV_BomDetail.FindControl("tbScrapPercentage")); Controls_TextBox tbLocation = (Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation")); CheckBox cbNeedPrint = (CheckBox)(this.FV_BomDetail.FindControl("cbNeedPrint")); CheckBox cbIsShipScan = (CheckBox)(this.FV_BomDetail.FindControl("cbIsShipScan")); TextBox tbPriority = (TextBox)(this.FV_BomDetail.FindControl("tbPriority")); com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList)this.FV_BomDetail.FindControl("ddlBackFlushMethod"); tbParCode.Text = bomdetail.Bom.Code; tbCompCode.Text = bomdetail.Item.Code; tbOp.Text = bomdetail.Operation.ToString(); tbReference.Text = bomdetail.Reference; tbStartTime.Text = bomdetail.StartDate.ToString("yyyy-MM-dd HH:mm"); if (bomdetail.EndDate != null) { tbEndTime.Text = ((DateTime)bomdetail.EndDate).ToString("yyyy-MM-dd HH:mm"); } tbRateQty.Text = bomdetail.RateQty.ToString("0.########"); tbUom.Text = bomdetail.Uom.Code; tbStruType.Text = bomdetail.StructureType; tbScrapPercentage.Text = (100 * bomdetail.ScrapPercentage).ToString("0.########"); if (bomdetail.Location != null) { tbLocation.Text = bomdetail.Location.Code; } tbPriority.Text = bomdetail.Priority.ToString(); if (bomdetail.BackFlushMethod != string.Empty) { ddlBackFlushMethod.SelectedValue = bomdetail.BackFlushMethod; } }
public virtual void DeleteBomDetail(BomDetail entity) { Delete(entity); }
public virtual void CreateBomDetail(BomDetail entity) { Create(entity); }
private void ProcessCurrentBomDetail(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_N) //��ͨ�ṹ(N) { ProcessCurrentBomDetailByItemType(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_O) //ѡ���(O) { currentBomDetail.OptionalItemGroup = currentBomDetail.Bom.Code; //Ĭ����BomCode��Ϊѡ�������� ProcessCurrentBomDetailByItemType(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_X) //��ṹ(X) { //�������ṹ(X)�������Լ��ӵ����ر���������·ֽ� NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else { throw new TechnicalException("no such kind fo bomdetail structure type " + currentBomDetail.StructureType); } }
public void ReplaceAbstractItem(OrderLocationTransaction orderLocationTransaction, BomDetail bomDetail) { OrderDetail orderDetail = orderLocationTransaction.OrderDetail; OrderHead orderHead = orderDetail.OrderHead; //ɾ������� this.DeleteOrderLocationTransaction(orderLocationTransaction); orderDetail.RemoveOrderLocationTransaction(orderLocationTransaction); if (orderLocationTransaction.Operation != 0) { //ɾ����Ӧ��OrderOp this.orderOperationMgr.TryDeleteOrderOperation(orderHead, orderLocationTransaction.Operation); } //���Էֽ��Ӽ� string bomCode = this.bomMgr.FindBomCode(bomDetail.Item); IList<BomDetail> bomDetailList = this.bomDetailMgr.GetFlatBomDetail(bomCode, orderHead.StartTime); if (bomDetailList != null && bomDetailList.Count > 0) { //�Ӽ���Bom foreach (BomDetail subBomDetail in bomDetailList) { //ѭ�������Ӽ���Bom OrderLocationTransaction newOrderLocationTransaction = this.AddNewMaterial(orderDetail, subBomDetail, orderLocationTransaction.Location, orderLocationTransaction.OrderedQty); if (newOrderLocationTransaction != null && newOrderLocationTransaction.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_A) { //����Ӽ���Bom�������������Ƕ�����滻����������� this.AutoReplaceAbstractItem(newOrderLocationTransaction); } } } else { //�Ӽ�û��Bom�����Ӽ�ֱ���滻����� this.AddNewMaterial(orderDetail, bomDetail, orderLocationTransaction.Location, orderLocationTransaction.OrderedQty); } }
public OrderLocationTransaction GenerateOrderLocationTransaction( OrderDetail orderDetail, Item item, BomDetail bomDetail, Uom uom, int operation, string ioType, string transactionType, decimal unitQty, Location loc, bool isShipScanHu, int? huLotSize, bool needPrint, string backFlushMethod, string itemVersion, Location rejectLocation) { OrderLocationTransaction orderLocationTransaction = new OrderLocationTransaction(); orderLocationTransaction.OrderDetail = orderDetail; orderLocationTransaction.Item = item; orderLocationTransaction.OrderedQty = unitQty * orderDetail.OrderedQty; //����unitQty����ʵ�ʵĶ����� orderLocationTransaction.Uom = uom; orderLocationTransaction.Operation = operation; orderLocationTransaction.IOType = ioType; orderLocationTransaction.TransactionType = transactionType; orderLocationTransaction.UnitQty = unitQty; orderLocationTransaction.Location = loc; orderLocationTransaction.RejectLocation = rejectLocation; orderLocationTransaction.IsShipScanHu = isShipScanHu; //��������Ч orderLocationTransaction.BackFlushMethod = backFlushMethod; //�����س����Ϸ�ʽ orderLocationTransaction.ItemVersion = itemVersion; if (huLotSize.HasValue) { orderLocationTransaction.HuLotSize = int.Parse(Math.Round(huLotSize.Value * unitQty).ToString("0.#########")); } orderLocationTransaction.NeedPrint = needPrint; orderLocationTransaction.IsAssemble = true; //Ĭ�϶���װ if (bomDetail != null) { orderLocationTransaction.BomDetail = bomDetail; if (bomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_O) { //�����ѡװ����ȡbomDetail.Priority��Ϊѡװ����Ĭ��ֵ��0����Ĭ�ϲ�װ��1����Ĭ�ϰ�װ orderLocationTransaction.IsAssemble = (bomDetail.Priority != 0); } #region ȡ��λ�ͻ��� DetachedCriteria criteria = DetachedCriteria.For(typeof(Flow)); criteria.Add(Expression.Eq("Code", orderDetail.OrderHead.Flow)); IList<Flow> flowList = criteriaMgr.FindAll<Flow>(criteria); if (flowList != null && flowList.Count > 0) { if (flowList[0].Routing != null) { #region ��routingdet DetachedCriteria rcriteria = DetachedCriteria.For(typeof(RoutingDetail)); rcriteria.Add(Expression.Eq("Routing.Code", flowList[0].Routing.Code)); rcriteria.Add(Expression.Eq("Operation", bomDetail.Operation)); IList<RoutingDetail> routingDetailList = criteriaMgr.FindAll<RoutingDetail>(rcriteria); if (routingDetailList != null && routingDetailList.Count > 0) { if (routingDetailList[0].TagNo != null && routingDetailList[0].TagNo != string.Empty) { orderLocationTransaction.TagNo = routingDetailList[0].TagNo; #region �Ҷ�Ӧ�Ĺ�λ���� DetachedCriteria scriteria = DetachedCriteria.For(typeof(ShelfItem)); scriteria.CreateAlias("Shelf", "s"); scriteria.Add(Expression.Eq("s.TagNo", orderLocationTransaction.TagNo)); scriteria.Add(Expression.Eq("IsActive", true)); scriteria.Add(Expression.Eq("Item.Code", orderLocationTransaction.Item.Code)); IList<ShelfItem> shelfItemDetailList = criteriaMgr.FindAll<ShelfItem>(scriteria); if (shelfItemDetailList != null && shelfItemDetailList.Count > 0) { orderLocationTransaction.Shelf = shelfItemDetailList[0].Shelf.Code; } #endregion } } #endregion } } #endregion } //���� orderLocationTransaction.Cartons = Convert.ToInt32(orderLocationTransaction.OrderedQty / orderLocationTransaction.Item.UnitCount); if (uom.Code != item.Uom.Code) //�Ϳ�浥λ��һ�£���Ҫ����ת�� { //��λת��������UnitQty��OrderedQtyֵ orderLocationTransaction.Uom = item.Uom; orderLocationTransaction.UnitQty = this.uomConversionMgr.ConvertUomQty(item, uom, unitQty, item.Uom); orderLocationTransaction.OrderedQty = this.uomConversionMgr.ConvertUomQty(item, uom, orderLocationTransaction.OrderedQty, item.Uom); if (orderLocationTransaction.HuLotSize.HasValue) { orderLocationTransaction.HuLotSize = int.Parse(Math.Round(orderLocationTransaction.HuLotSize.Value * orderLocationTransaction.UnitQty).ToString("#")); } } orderDetail.AddOrderLocationTransaction(orderLocationTransaction); return orderLocationTransaction; }
private void ProcessBomDetailIn(MesScmsTableIndex mesScmsTableIndex) { IList<MesScmsBom> bomDetailList = mesScmsBomMgr.GetUpdateMesScmsBom(); if (bomDetailList != null && bomDetailList.Count > 0) { foreach (MesScmsBom mesScmsBom in bomDetailList) { try { Bom bom = bomMgr.LoadBom(mesScmsBom.Bom); if (bom == null) { bom = new Bom(); bom.Code = mesScmsBom.Bom; bom.IsActive = true; bom.Uom = itemMgr.LoadItem(mesScmsBom.ItemCode).Uom; bomMgr.CreateBom(bom); } BomDetail bomDetail = LoadBomDetail(mesScmsBom.Bom, mesScmsBom.ItemCode, Int32.Parse(mesScmsBom.Operation), DateTime.Now); if (bomDetail == null && mesScmsBom.Qty > 0) { bomDetail = new BomDetail(); bomDetail.Bom = bom; bomDetail.Item = itemMgr.LoadItem(mesScmsBom.ItemCode); Item bomItem = itemMgr.LoadItem(mesScmsBom.Bom); bomDetail.BackFlushMethod = bomDetail.Item.BackFlushMethod; bomDetail.NeedPrint = true; bomDetail.Operation = Convert.ToInt32(mesScmsBom.Operation); bomDetail.RateQty = mesScmsBom.Qty; bomDetail.StructureType = BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_N; bomDetail.StartDate = DateTime.Now; bomDetail.Uom = itemMgr.LoadItem(mesScmsBom.ItemCode).Uom; if (mesScmsBom.Flag == MesDssConstants.MES_SCMS_FLAG_FTPC_DELETED) { bomDetail.EndDate = DateTime.Now.AddDays(-1); } bomDetailMgr.CreateBomDetail(bomDetail); } else { if (mesScmsBom.Qty == 0) { bomDetail.EndDate = DateTime.Now.AddDays(-1); } bomDetail.RateQty = mesScmsBom.Qty; bomDetailMgr.UpdateBomDetail(bomDetail); } #region ���¹����λ��Ӧ,���ڹ����λΨһ��Ӧ #region ��routing DetachedCriteria criteria = DetachedCriteria.For(typeof(Flow)); criteria.Add(Expression.Eq("Code", mesScmsBom.ProductLine)); IList<Flow> flowList = criteriaMgr.FindAll<Flow>(criteria); if (flowList == null || flowList.Count == 0) { log.Error(mesScmsBom.ProductLine + " not found"); continue; } if (flowList[0].Routing == null) { log.Error(mesScmsBom.ProductLine + " not found routing"); continue; } #endregion #region ��routingdet DetachedCriteria rcriteria = DetachedCriteria.For(typeof(RoutingDetail)); rcriteria.Add(Expression.Eq("Routing.Code", flowList[0].Routing.Code)); rcriteria.Add(Expression.Eq("Operation", Convert.ToInt32(mesScmsBom.Operation))); IList<RoutingDetail> routingDetailList = criteriaMgr.FindAll<RoutingDetail>(rcriteria); if (routingDetailList == null || routingDetailList.Count == 0) { log.Error(flowList[0].Routing.Code + " not found routing detail"); continue; } #endregion RoutingDetail rd = routingDetailList[0]; rd.TagNo = mesScmsBom.TagNo; routingDetailMgr.UpdateRoutingDetail(rd); #endregion mesScmsBomMgr.Complete(mesScmsBom); } catch (Exception e) { this.CleanSession(); log.Error(mesScmsBom.Bom + "," + mesScmsBom.ItemCode + "," + mesScmsBom.ProductLine + "," + mesScmsBom.TagNo + " complete exception", e); continue; } } } mesScmsTableIndexMgr.Complete(mesScmsTableIndex); }
private void NestingGetNextLevelBomDetail(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { string nextLevelBomCode = this.bomMgrE.FindBomCode(currentBomDetail.Item); IList<BomDetail> nextBomDetailList = this.GetNextLevelBomDetail(nextLevelBomCode, efftiveDate); if (nextBomDetailList != null && nextBomDetailList.Count > 0) { foreach (BomDetail nextBomDetail in nextBomDetailList) { if (nextBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { //K类型的Item不能出现在Bom结构中 throw new BusinessErrorException("Bom.Error.ItemTypeKInBom", nextBomDetail.Bom.Code); } //当前子件的Uom和下层Bom的Uom不匹配,需要做单位转换 if (currentBomDetail.Uom.Code != nextBomDetail.Bom.Uom.Code) { //单位换算 nextBomDetail.CalculatedQty = uomConversionMgrE.ConvertUomQty(currentBomDetail.Item, currentBomDetail.Uom, 1, nextBomDetail.Bom.Uom) * currentBomDetail.CalculatedQty * nextBomDetail.RateQty * (1 + nextBomDetail.ScrapPercentage); } else { nextBomDetail.CalculatedQty = nextBomDetail.RateQty * currentBomDetail.CalculatedQty * (1 + nextBomDetail.ScrapPercentage); } nextBomDetail.OptionalItemGroup = currentBomDetail.OptionalItemGroup; ProcessCurrentBomDetail(flatBomDetailList, nextBomDetail, efftiveDate); } } else { throw new BusinessErrorException("Bom.Error.NotFoundForItem", currentBomDetail.Item.Code); } }
private void ProcessCurrentBomDetailByItemType(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_X) { //如果是虚零件(X),继续向下分解 NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_A) { //todo 抽象件需不需要分解?是否可以在物料回冲时在指定? flatBomDetailList.Add(currentBomDetail); } else if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { //K类型的Item不能出现在Bom结构中 throw new BusinessErrorException("Bom.Error.ItemTypeKInBom", currentBomDetail.Bom.Code); //组件,继续向下分解 //NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else { //直接加入到flatBomDetailList flatBomDetailList.Add(currentBomDetail); } }
private void ProcessCurrentBomDetail(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_N) //普通结构(N) { ProcessCurrentBomDetailByItemType(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_O) //选配件(O) { currentBomDetail.OptionalItemGroup = currentBomDetail.Bom.Code; //默认用BomCode作为选配件的组号 ProcessCurrentBomDetailByItemType(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.StructureType == BusinessConstants.CODE_MASTER_BOM_DETAIL_TYPE_VALUE_X) //虚结构(X) { //如果是虚结构(X),不把自己加到返回表里,继续向下分解 NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else { throw new TechnicalException("no such kind fo bomdetail structure type " + currentBomDetail.StructureType); } }
public void ReplaceAbstractItem(OrderLocationTransaction orderLocationTransaction, BomDetail bomDetail) { OrderDetail orderDetail = orderLocationTransaction.OrderDetail; OrderHead orderHead = orderDetail.OrderHead; //删除抽象件 this.DeleteOrderLocationTransaction(orderLocationTransaction); orderDetail.RemoveOrderLocationTransaction(orderLocationTransaction); if (orderLocationTransaction.Operation != 0) { //删除对应的OrderOp this.orderOperationMgrE.TryDeleteOrderOperation(orderHead, orderLocationTransaction.Operation); } //尝试分解子件 string bomCode = this.bomMgrE.FindBomCode(bomDetail.Item); IList<BomDetail> bomDetailList = this.bomDetailMgrE.GetFlatBomDetail(bomCode, orderHead.StartTime); if (bomDetailList != null && bomDetailList.Count > 0) { //子件有Bom foreach (BomDetail subBomDetail in bomDetailList) { //循环插入子件的Bom OrderLocationTransaction newOrderLocationTransaction = this.AddNewMaterial(orderDetail, subBomDetail, orderLocationTransaction.Location, orderLocationTransaction.OrderedQty); if (newOrderLocationTransaction != null && newOrderLocationTransaction.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_A) { //如果子件的Bom还包含抽象件,嵌套调用替换抽象零件方法 this.AutoReplaceAbstractItem(newOrderLocationTransaction); } } } else { //子件没有Bom,用子件直接替换抽象件 this.AddNewMaterial(orderDetail, bomDetail, orderLocationTransaction.Location, orderLocationTransaction.OrderedQty); } }
public IList<BomDetail> GetBomView_Cost(string itemCode, DateTime effDate) { Item item = itemMgr.LoadItem(itemCode); string bomCode = item.Bom != null ? item.Bom.Code : item.Code; IList<BomDetail> bomDetailList = this.GetFlatBomDetail(bomCode, effDate); IList<BomDetail> bomViewList = new List<BomDetail>(); IList<BomDetail> costBomViewList = new List<BomDetail>(); bomViewList = this.GetAllBomDetailTree(bomDetailList, effDate); bomViewList = this.GetNoOverloadBomDetail(bomViewList); if (bomViewList != null && bomViewList.Count > 0) { bomViewList = this.GetCostBomDetail(bomViewList); Bom bom = bomMgr.LoadBom(bomCode); foreach (BomDetail bomDetail in bomViewList) { BomDetail costBomDetail = new BomDetail(); CloneHelper.CopyProperty(bomDetail, costBomDetail, BomCompDetail); costBomDetail.Bom = bom; costBomViewList.Add(costBomDetail); } } return this.GetNoOverloadBomDetail(costBomViewList); }
private void NestingGetNextLevelBomDetail(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { string nextLevelBomCode = this.bomMgr.FindBomCode(currentBomDetail.Item); IList<BomDetail> nextBomDetailList = this.GetNextLevelBomDetail(nextLevelBomCode, efftiveDate); if (nextBomDetailList != null && nextBomDetailList.Count > 0) { foreach (BomDetail nextBomDetail in nextBomDetailList) { if (nextBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { //K���͵�Item���ܳ�����Bom�ṹ�� throw new BusinessErrorException("Bom.Error.ItemTypeKInBom", nextBomDetail.Bom.Code); } //��ǰ�Ӽ���Uom���²�Bom��Uom��ƥ�䣬��Ҫ����λת�� if (currentBomDetail.Uom.Code.ToUpper() != nextBomDetail.Bom.Uom.Code.ToUpper()) { //��λ���� nextBomDetail.CalculatedQty = uomConversionMgr.ConvertUomQty(currentBomDetail.Item, currentBomDetail.Uom, 1, nextBomDetail.Bom.Uom) * currentBomDetail.CalculatedQty * nextBomDetail.RateQty * (1 + nextBomDetail.ScrapPercentage); } else { nextBomDetail.CalculatedQty = nextBomDetail.RateQty * currentBomDetail.CalculatedQty * (1 + nextBomDetail.ScrapPercentage); } nextBomDetail.OptionalItemGroup = currentBomDetail.OptionalItemGroup; ProcessCurrentBomDetail(flatBomDetailList, nextBomDetail, efftiveDate); } } else { throw new BusinessErrorException("Bom.Error.NotFoundForItem", currentBomDetail.Item.Code); } }
public void CreateBomDetail(BomDetail bomdetail) { BomDetailMgr.CreateBomDetail(bomdetail); }
private void ProcessCurrentBomDetailByItemType(IList<BomDetail> flatBomDetailList, BomDetail currentBomDetail, DateTime efftiveDate) { if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_X) { //����������(X)���������·ֽ� NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_A) { //todo ������費��Ҫ�ֽ⣿�Ƿ���������ϻس�ʱ��ָ���� flatBomDetailList.Add(currentBomDetail); } else if (currentBomDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { //K���͵�Item���ܳ�����Bom�ṹ�� throw new BusinessErrorException("Bom.Error.ItemTypeKInBom", currentBomDetail.Bom.Code); //������������·ֽ� //NestingGetNextLevelBomDetail(flatBomDetailList, currentBomDetail, efftiveDate); } else { //ֱ�Ӽ��뵽flatBomDetailList flatBomDetailList.Add(currentBomDetail); } }
public void DeleteBomDetail(BomDetail bomdetail) { BomDetailMgr.DeleteBomDetail(bomdetail); }
public virtual void UpdateBomDetail(BomDetail entity) { Update(entity); }
public void UpdateBomDetail(BomDetail bomdetail) { BomDetailMgr.UpdateBomDetail(bomdetail); }
protected void ODS_BomDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { string parcode = ((TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim(); string compcode = ((TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim(); string uom = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim(); string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim(); string endTime = ((TextBox)(this.FV_BomDetail.FindControl("tbEndTime"))).Text.Trim(); com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList)this.FV_BomDetail.FindControl("ddlBackFlushMethod"); bomdetail = (BomDetail)e.InputParameters[0]; bomdetail.Bom = TheBomMgr.LoadBom(parcode); item = TheItemMgr.LoadItem(compcode); bomdetail.Item = item; if (item != null) { //default compcode and uom if (uom.Trim() == string.Empty) { bomdetail.Uom = item.Uom; } else { bomdetail.Uom = TheUomMgr.LoadUom(uom); } } if (location == string.Empty) { bomdetail.Location = null; } else { bomdetail.Location = TheLocationMgr.LoadLocation(location); } if (ddlBackFlushMethod.SelectedIndex != -1) { bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue; } if (endTime != string.Empty) { bomdetail.EndDate = DateTime.Parse(endTime); } bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100; }
public virtual void CreateBomDetail(BomDetail entity) { entityDao.CreateBomDetail(entity); }
protected void ODS_BomDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string parcode = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbParCode"))).Text.Trim(); string compcode = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbCompCode"))).Text.Trim(); string uom = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbUom"))).Text.Trim(); string location = ((Controls_TextBox)(this.FV_BomDetail.FindControl("tbLocation"))).Text.Trim(); com.Sconit.Control.CodeMstrDropDownList ddlBackFlushMethod = (com.Sconit.Control.CodeMstrDropDownList)this.FV_BomDetail.FindControl("ddlBackFlushMethod"); bomdetail = (BomDetail)e.InputParameters[0]; bomdetail.Bom = TheBomMgr.LoadBom(parcode); item = TheItemMgr.LoadItem(compcode); bomdetail.Item = item; if (item != null) { //default compcode and uom if (uom.Trim() == "") { bomdetail.Uom = item.Uom; } else { bomdetail.Uom = TheUomMgr.LoadUom(uom); } } if (location == "") { bomdetail.Location = null; } else { bomdetail.Location = TheLocationMgr.LoadLocation(location); } if (ddlBackFlushMethod.SelectedIndex != -1) { bomdetail.BackFlushMethod = ddlBackFlushMethod.SelectedValue; } bomdetail.ScrapPercentage = bomdetail.ScrapPercentage / 100; if (TheBomDetailMgr.CheckUniqueExist(bomdetail.Bom.Code, bomdetail.Item.Code, bomdetail.Operation, bomdetail.Reference, bomdetail.StartDate)) { ShowWarningMessage("MasterData.BomDetail.WarningMessage.UniqueExistError"); e.Cancel = true; } }
private object Deserialize(DssImportHistory dssImportHistory, bool isUpdate) { Item bomItem = this.itemMgr.CheckAndLoadItem(dssImportHistory[1]);//bom头 Item item = this.itemMgr.CheckAndLoadItem(dssImportHistory[2]);//零件号 if (item.IsMes && bomItem.IsMes) { MesBomDetail mesBomDetail = new MesBomDetail(); mesBomDetail.Bom = this.LoadMesBom(dssImportHistory[1]);//Bom代码 mesBomDetail.Item = item; mesBomDetail.StartDate = dssImportHistory[4] != null ? DssHelper.GetDate(dssImportHistory[4], BusinessConstants.DSS_SYSTEM_CODE_QAD) : new DateTime(2000, 1, 1); if (isUpdate) { mesBomDetail.RateQty = decimal.Parse(dssImportHistory[5]);//用量 mesBomDetail.StructureType = this.GetStructureType(dssImportHistory[6], BusinessConstants.DSS_SYSTEM_CODE_QAD);//类型 if (dssImportHistory[8] != null) mesBomDetail.EndDate = DssHelper.GetDate(dssImportHistory[8], BusinessConstants.DSS_SYSTEM_CODE_QAD);//结束日期 } return mesBomDetail; } else { BomDetail bomDetail = new BomDetail(); bomDetail.Bom = this.LoadBom(dssImportHistory[1]);//Bom代码 bomDetail.Item = item;//零件号 bomDetail.Reference = dssImportHistory[3];//参考 bomDetail.StartDate = dssImportHistory[4] != null ? DssHelper.GetDate(dssImportHistory[4], BusinessConstants.DSS_SYSTEM_CODE_QAD) : new DateTime(2000, 1, 1); if (isUpdate) { bomDetail.RateQty = decimal.Parse(dssImportHistory[5]);//用量 bomDetail.StructureType = this.GetStructureType(dssImportHistory[6], BusinessConstants.DSS_SYSTEM_CODE_QAD);//类型 if (dssImportHistory[8] != null) bomDetail.EndDate = DssHelper.GetDate(dssImportHistory[8], BusinessConstants.DSS_SYSTEM_CODE_QAD);//结束日期 //回冲方式从零件上取 bomDetail.BackFlushMethod = bomDetail.Item.BackFlushMethod; bomDetail.ScrapPercentage = decimal.Parse(dssImportHistory[10]) / 100;//废品百分比 bomDetail.Operation = int.Parse(dssImportHistory[12]); } #region 默认值 bomDetail.Uom = bomDetail.Item.Uom; bomDetail.Priority = 0; bomDetail.NeedPrint = true; bomDetail.IsShipScanHu = false; #endregion return bomDetail; } }