public void TryAddOrderOperation(OrderHead orderHead, int operation, string reference) { bool hasOp = false; foreach (OrderOperation orderOperation in orderHead.OrderOperations) { if (orderOperation.Operation == operation) { if (orderOperation.Reference == reference || (orderOperation.Reference == null && reference == null)) { hasOp = true; } } } if (!hasOp) { //没有找到Op,新增 RoutingDetail routingDetail = this.routingDetailMgr.LoadRoutingDetail(orderHead.Routing, operation, reference); if (routingDetail != null) { OrderOperation orderOperation = this.GenerateOrderOperation(orderHead, routingDetail); this.CreateOrderOperation(orderOperation); } else { throw new BusinessErrorException("Order.Error.RoutingDetail.Not.Found", orderHead.Routing.Code, operation.ToString(), reference); } } }
public OrderOperation GenerateOrderOperation(OrderHead orderHead, RoutingDetail routingDetail) { OrderOperation orderOp = new OrderOperation(); CloneHelper.CopyProperty(routingDetail, orderOp, OrderOperationCloneFields); orderOp.OrderHead = orderHead; //todo UnitTime��WorkTime���� orderHead.AddOrderOperation(orderOp); return orderOp; }
public OrderOperation GenerateOrderOperation(OrderHead orderHead, RoutingDetail routingDetail) { OrderOperation orderOp = new OrderOperation(); CloneHelper.CopyProperty(routingDetail, orderOp, OrderOperationCloneFields); orderOp.OrderHead = orderHead; //todo UnitTime和WorkTime计算 orderHead.AddOrderOperation(orderOp); return(orderOp); }
public BomDetail GetDefaultBomDetailForAbstractItem(Item abstractItem, Routing routing, DateTime effDate, Location defaultLocationFrom) { string bomCode = this.bomMgr.FindBomCode(abstractItem); IList <BomDetail> bomDetailList = this.GetNextLevelBomDetail(bomCode, effDate); if (bomDetailList != null && bomDetailList.Count > 0) { bomDetailList = IListHelper.Sort <BomDetail>(bomDetailList, "Priority"); //根据Priority进行排序 foreach (BomDetail bomDetail in bomDetailList) { #region 来源库位查找逻辑BomDetail-->RoutingDetail-->defaultLocationFrom //defaultLocationFrom = FlowDetail-->Flow Location bomLocation = bomDetail.Location; if (bomLocation == null) { RoutingDetail routingDetail = routingDetailMgr.LoadRoutingDetail(routing, bomDetail.Operation, bomDetail.Reference); if (routingDetail != null) { if (bomLocation == null) { bomLocation = routingDetail.Location; } } } if (bomLocation == null) { bomLocation = defaultLocationFrom; } #endregion //如果没有找到库位,直接跳到下一个bomDetail if (bomLocation != null) { if (!bomLocation.AllowNegativeInventory) { //不允许负库存 //todo 检查库存 throw new NotImplementedException(); } else { //允许负库存,直接返回 return(bomDetail); } } } } return(null); }
protected void ODS_RoutingDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { string routingCode = ((TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"))).Text.Trim(); string workCenterCode = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbWorkCenter"))).Text.Trim(); string locationCode = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbLocation"))).Text.Trim(); routingDetail = (RoutingDetail)e.InputParameters[0]; if (routingDetail != null) { routingDetail.Routing = TheRoutingMgr.LoadRouting(routingCode); routingDetail.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workCenterCode); routingDetail.Location = TheLocationMgr.LoadLocation(locationCode); } }
public void MakeDocumentPathForKeyValueAndCollectionMeetsExpectation(string keyValue, string collectionPath) { // arrange var document = new RoutingDetail { TouchpointID = keyValue }; var collectionUri = new Uri(collectionPath, UriKind.Relative); var documentPath = $"{collectionPath}/docs/{keyValue}"; var sut = MakeSUT(); // act var result = sut.MakeDocumentPathFor(document, collectionUri); // assert Assert.Equal(documentPath, result.OriginalString); }
public async Task AddDocumentMeetsVerification() { // arrange var modelItem = new RoutingDetail(); var testPath = new Uri("http://blahStore/blahCollection/blahID"); var sut = MakeSUT(); GetMock(sut.SafeOperations) .Setup(x => x.Try(It.IsAny <Func <Task <RoutingDetail> > >(), It.IsAny <Func <Exception, Task <RoutingDetail> > >())) .Returns(Task.FromResult(modelItem)); // act await sut.AddDocument(modelItem, testPath); // assert GetMock(sut.Client).VerifyAll(); GetMock(sut.SafeOperations).VerifyAll(); }
public async Task ProcessAddDocumentMeetsVerification() { // arrange var modelItem = new RoutingDetail(); var testPath = new Uri("http://blahStore/blahCollection/blahID"); var sut = MakeSUT(); GetMock(sut.Client) .Setup(x => x.CreateDocumentAsync(testPath, modelItem)) .Returns(Task.FromResult(modelItem)); // act await sut.ProcessAddDocument(testPath, modelItem); // assert GetMock(sut.Client).VerifyAll(); GetMock(sut.SafeOperations).VerifyAll(); }
public override RoutingDetail LoadRoutingDetail(string routingCode, int operation, string reference) { RoutingDetail routingDetail = null; if (reference == null) { DetachedCriteria criteria = DetachedCriteria.For <RoutingDetail>(); criteria.Add(Expression.Eq("Routing.Code", routingCode)) .Add(Expression.Eq("Operation", operation)).Add(Expression.IsNull("Reference")); IList <RoutingDetail> routingDetailList = criteriaMgr.FindAll <RoutingDetail>(criteria); if (routingDetailList != null && routingDetailList.Count > 0) { routingDetail = routingDetailList[0]; } } else { routingDetail = base.LoadRoutingDetail(routingCode, operation, reference); } return(routingDetail); }
/// <summary> /// process, add new area routing detail /// </summary> /// <param name="theTouchpoint">the touchpoint</param> /// <param name="usingContent">using content</param> /// <param name="inScope">in scope</param> /// <returns>the result of the operation</returns> public async Task <HttpResponseMessage> ProcessAddAreaRoutingDetailUsing( string theContent, IScopeLoggingContext inScope) { await inScope.EnterMethod(); It.IsEmpty(theContent) .AsGuard <MalformedRequestException>(); await inScope.Information($"deserialising the submitted content: '{theContent}'"); var theCandidate = JsonConvert.DeserializeObject <IncomingRoutingDetail>(theContent); await inScope.Information("deserialisation complete..."); It.IsNull(theCandidate) .AsGuard <MalformedRequestException>(); await inScope.Information($"validating the candidate: '{theCandidate.TouchpointID}'"); await RoutingDetail.Validate(theCandidate); await inScope.Information($"validation complete..."); await inScope.Information($"adding the candidate: '{theCandidate.TouchpointID}'"); var result = await RoutingDetails.Add(theCandidate); await inScope.Information($"candidate addition complete..."); await inScope.Information($"preparing response..."); var response = Respond.Created().SetContent(result); await inScope.Information($"preparation complete..."); await inScope.ExitMethod(); return(response); }
public IList <BomDetail> GetBomDetailListForAbstractItem(Item abstractItem, Routing routing, DateTime effDate, Location defaultLocationFrom) { string bomCode = this.bomMgr.FindBomCode(abstractItem); IList <BomDetail> bomDetailList = this.GetNextLevelBomDetail(bomCode, effDate); if (bomDetailList != null && bomDetailList.Count > 0) { bomDetailList = IListHelper.Sort <BomDetail>(bomDetailList, "Priority"); //根据Priority进行排序 foreach (BomDetail bomDetail in bomDetailList) { #region 来源库位查找逻辑BomDetail-->RoutingDetail-->defaultLocationFrom //defaultLocationFrom = FlowDetail-->Flow Location bomLocation = bomDetail.Location; if (bomLocation == null) { RoutingDetail routingDetail = routingDetailMgr.LoadRoutingDetail(routing, bomDetail.Operation, bomDetail.Reference); if (routingDetail != null) { if (bomLocation == null) { bomLocation = routingDetail.Location; } } } if (bomLocation == null) { bomLocation = defaultLocationFrom; } bomDetail.Location = bomLocation; #endregion } } return(bomDetailList); }
private void UpdateView() { Routingdetail = TheRoutingDetailMgr.LoadRoutingDetail(Convert.ToInt32(this.code)); TextBox tbCode = (TextBox)(this.FV_RoutingDetail.FindControl("tbCode")); TextBox tbRouting = (TextBox)(this.FV_RoutingDetail.FindControl("tbRouting")); TextBox tbStartDate = (TextBox)(this.FV_RoutingDetail.FindControl("tbStartDate")); TextBox tbEndDate = (TextBox)(this.FV_RoutingDetail.FindControl("tbEndDate")); TextBox tbOperation = (TextBox)(this.FV_RoutingDetail.FindControl("tbOperation")); TextBox tbReference = (TextBox)(this.FV_RoutingDetail.FindControl("tbReference")); Controls_TextBox tbWorkCenter = (Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbWorkCenter")); Controls_TextBox tbLocation = (Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbLocation")); TextBox tbSetupTime = (TextBox)(this.FV_RoutingDetail.FindControl("tbSetupTime")); TextBox tbRunTime = (TextBox)(this.FV_RoutingDetail.FindControl("tbRunTime")); TextBox tbMoveTime = (TextBox)(this.FV_RoutingDetail.FindControl("tbMoveTime")); TextBox tbTactTime = (TextBox)(this.FV_RoutingDetail.FindControl("tbTactTime")); TextBox tbActivity = (TextBox)(this.FV_RoutingDetail.FindControl("tbActivity")); if (Routingdetail != null) { tbCode.Text = Routingdetail.Id.ToString(); tbRouting.Text = Routingdetail.Routing.Code; tbStartDate.Text = Routingdetail.StartDate.ToString("yyyy-MM-dd"); if (Routingdetail.EndDate != null) { tbEndDate.Text = ((DateTime)Routingdetail.EndDate).ToString("yyyy-MM-dd"); } tbOperation.Text = Routingdetail.Operation.ToString(); tbReference.Text = Routingdetail.Reference; tbWorkCenter.Text = Routingdetail.WorkCenter.Code; tbLocation.Text = Routingdetail.Location == null ? string.Empty : Routingdetail.Location.Code; tbSetupTime.Text = Routingdetail.SetupTime.ToString("0.########"); tbRunTime.Text = Routingdetail.RunTime.ToString("0.########"); tbMoveTime.Text = Routingdetail.MoveTime.ToString("0.########"); tbTactTime.Text = Routingdetail.TactTime.ToString("0.########"); tbActivity.Text = Routingdetail.Activity; } }
public virtual void DeleteRoutingDetail(RoutingDetail entity) { entityDao.DeleteRoutingDetail(entity); }
public virtual void CreateRoutingDetail(RoutingDetail entity) { entityDao.CreateRoutingDetail(entity); }
public virtual void UpdateRoutingDetail(RoutingDetail entity) { entityDao.UpdateRoutingDetail(entity); }
public void InitPageParameter() { #region 已投料 IList <ProductLineInProcessLocationDetail> productLineIpList = new List <ProductLineInProcessLocationDetail>(); if (tbProductLine.Text.Trim() != string.Empty) { productLineIpList = TheProductLineInProcessLocationDetailMgr.GetProductLineInProcessLocationDetail(this.tbProductLine.Text.Trim(), BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE); } this.GV_List_Feeded.DataSource = productLineIpList; this.GV_List_Feeded.DataBind(); #endregion #region 新投料 //todo 根据flow得到Material的list IList <BomDetail> bomDetailList = new List <BomDetail>(); IList <MaterialIn> materialInList = new List <MaterialIn>(); if (this.tbProductLine.Text.Trim() != string.Empty) { bomDetailList = TheFlowMgr.GetBatchFeedBomDetail(this.tbProductLine.Text.Trim()); } //暂时放在页面,后面再抽出来 Flow flow = TheFlowMgr.LoadFlow(this.tbProductLine.Text.Trim(), true); if (bomDetailList != null && bomDetailList.Count > 0) { foreach (BomDetail bomDetail in bomDetailList) { MaterialIn materialIn = new MaterialIn(); materialIn.Location = bomDetail.Location; materialIn.Operation = bomDetail.Operation; materialIn.RawMaterial = bomDetail.Item; //来源库位查找逻辑BomDetail-->RoutingDetail-->FlowDetail-->Flow Location bomLocFrom = bomDetail.Location; if (flow.Routing != null) { //在Routing上查找,并检验Routing上的工序和BOM上的是否匹配 RoutingDetail routingDetail = TheRoutingDetailMgr.LoadRoutingDetail(flow.Routing, bomDetail.Operation, bomDetail.Reference); if (routingDetail != null) { if (bomLocFrom == null) { bomLocFrom = routingDetail.Location; } } } if (bomLocFrom == null) { bomLocFrom = bomDetail.DefaultLocation; } materialIn.Location = bomLocFrom; bool isInclude = false; foreach (MaterialIn m in materialInList) { if (m.Location.Code == materialIn.Location.Code && m.Operation == materialIn.Operation && m.RawMaterial.Code == materialIn.RawMaterial.Code) { isInclude = true; } } if (!isInclude) { materialInList.Add(materialIn); } } } this.GV_List.DataSource = materialInList; this.GV_List.DataBind(); #endregion }
public virtual void DeleteRoutingDetail(RoutingDetail entity) { Delete(entity); }
public void GenerateOrderDetailSubsidiary(OrderDetail orderDetail) { OrderHead orderHead = orderDetail.OrderHead; int maxOp = 0; //记录最大工序号,给成品收货时用 int minOp = 0; //记录最小工序号,给返工成品用 #region 把OrderDetail的收货单位和单位用量转换为BOM单位和单位用量 //fgUom,fgUnityQty代表接收一个orderDetail.Uom单位(等于订单的收货单位)的FG,等于单位(fgUom)有多少(fgUnityQty)值 Uom fgUom = orderDetail.Uom; decimal fgUnityQty = 1; //运输物品和生产的成品UnitQty默认为1 //如果和Bom上的单位不一致,转化为Bom上的单位,不然会导致物料回冲不正确。 if (orderDetail.Bom != null && orderDetail.Uom.Code.ToUpper() != orderDetail.Bom.Uom.Code.ToUpper()) { fgUom = orderDetail.Bom.Uom; fgUnityQty = this.uomConversionMgr.ConvertUomQty(orderDetail.Item, orderDetail.Uom, fgUnityQty, fgUom); } #endregion #region 创建OrderLocTrans if (orderDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K) { //程序一般不会运行到这里,套件的拆分都在前台进行 //用户在下订单的时候已经拆分了套件 //2010-1-19 dingxin throw new BusinessErrorException("Order.Error.CreateOrder.ItemTypeK", orderDetail.Item.Code); } else { if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT || orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_CUSTOMERGOODS || orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_SUBCONCTRACTING) { #region 采购,只需要记录入库事务RCT-PO this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_OUT, null, fgUnityQty, orderDetail.DefaultLocationFrom, false, orderDetail.HuLotSize, true, null, orderDetail.ItemVersion, this.locationMgr.GetRejectLocation()); this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_IN, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_PO, fgUnityQty, orderDetail.DefaultLocationTo, false, orderDetail.HuLotSize, true, null, orderDetail.ItemVersion, this.locationMgr.GetRejectLocation()); #endregion } else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION) { #region 销售,只需要记录出库事务ISS-SO this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_SO, fgUnityQty, orderDetail.DefaultLocationFrom, false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_IN, null, fgUnityQty, orderDetail.DefaultLocationTo, false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); #endregion } else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER) { #region 移库,需要记录出库事务ISS-TR和入库事务RCT-TR this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_TR, fgUnityQty, orderDetail.DefaultLocationFrom, false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_IN, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_TR, fgUnityQty, orderDetail.DefaultLocationTo, false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); #endregion } //else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_INSPECTION) //{ // #region 检验,需要记录出库事务ISS-TR和入库事务RCT-TR // this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, // fgUom, maxOp, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_TR, // fgUnityQty, orderDetail.DefaultLocationFrom, // false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); // this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, // fgUom, maxOp, BusinessConstants.IO_TYPE_IN, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_TR, // fgUnityQty, orderDetail.DefaultLocationTo, // false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); // #endregion //} else if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { #region 创建生产物料的OrderLocTrans //如果是生产订单,必须要有Bom FillBomForOrderDetail(orderDetail); IList <BomDetail> bomDetailList = this.bomDetailMgr.GetFlatBomDetail(orderDetail.Bom.Code, orderHead.StartTime); foreach (BomDetail bomDetail in bomDetailList) { #region 记录最大工序号 //最大工序号是从Bom上取还是从Routing上取? if (maxOp < bomDetail.Operation) { //记录最大工序号 maxOp = bomDetail.Operation; } #endregion #region 记录最小工序号 //最小工序号是从Bom上取还是从Routing上取? if (minOp > bomDetail.Operation || minOp == 0) { //记录最大工序号 minOp = bomDetail.Operation; } #endregion #region 查找物料的来源库位 //来源库位查找逻辑BomDetail-->RoutingDetail-->FlowDetail-->Flow Location bomLocFrom = bomDetail.Location; if (orderHead.Routing != null) { //在Routing上查找,并检验Routing上的工序和BOM上的是否匹配 RoutingDetail routingDetail = routingDetailMgr.LoadRoutingDetail(orderHead.Routing, bomDetail.Operation, bomDetail.Reference); if (routingDetail != null) { if (bomLocFrom == null) { bomLocFrom = routingDetail.Location; } //if (maxOp < routingDetail.Operation) //{ // //记录最大工序号 // maxOp = routingDetail.Operation; //} orderHead.AddOrderOperation(this.orderOperationMgr.GenerateOrderOperation(orderHead, routingDetail)); } //else //{ // //没有找到和BOM上相匹配的工序 // throw new BusinessErrorException("Order.Error.OpNotMatch", bomDetail.Bom.Code, bomDetail.Item.Code, routing.Code, bomDetail.Operation.ToString(), bomDetail.Reference); //} } if (bomLocFrom == null) { //取默认库位FlowDetail-->Flow bomLocFrom = orderDetail.DefaultLocationFrom; } //string bomLocFromType = bomLocFrom != null ? bomLocFrom.Type : null; #endregion #region 查找物料的目的库位 //目的库位,如果是生产类型,直接置为Null,其它情况FlowDetail-->Flow Location bomLocTo = (orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) ? orderDetail.DefaultLocationTo : null; //string bomLocToType = bomLocTo != null ? bomLocTo.Type : null; #endregion #region 生产物料,只需要记录出库事务ISS-TR this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, bomDetail.Item, bomDetail, bomDetail.Uom, bomDetail.Operation, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO, bomDetail.CalculatedQty * fgUnityQty, //返工,原材料数量默认等于0 bomLocFrom, bomDetail.IsShipScanHu, bomDetail.HuLotSize, bomDetail.NeedPrint, bomDetail.BackFlushMethod, null, this.locationMgr.GetRejectLocation()); #endregion } #endregion #region 生产成品,只需要记录入库事务RCT-WO this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, maxOp, BusinessConstants.IO_TYPE_IN, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_WO, fgUnityQty, orderDetail.DefaultLocationTo, false, orderDetail.HuLotSize, true, null, orderDetail.ItemVersion, this.locationMgr.GetRejectLocation()); //返工,把自己添加到物料中 if (orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RWO) { //Location loc = orderDetail.DefaultLocationTo.ActingLocation != null ? orderDetail.DefaultLocationTo.ActingLocation : orderDetail.DefaultLocationTo; Location loc = this.locationMgr.GetRejectLocation(); //todo 处理返工的成品是否需要扫描Hu,现在不扫描 //返工对成品的投料记RCT-WO事务 this.orderLocationTransactionMgr.GenerateOrderLocationTransaction(orderDetail, orderDetail.Item, null, fgUom, minOp, BusinessConstants.IO_TYPE_OUT, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_WO, fgUnityQty, loc, false, orderDetail.HuLotSize, true, null, null, this.locationMgr.GetRejectLocation()); } #endregion } } #endregion #region 生产,给没有Op的OrderLocTrans赋值maxOp if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { if (maxOp == 0) { EntityPreference entityPreference = this.entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL); int seqInterval = int.Parse(entityPreference.Value); maxOp = seqInterval; //默认工序号 } if (orderDetail.OrderLocationTransactions != null && orderDetail.OrderLocationTransactions.Count > 0) { foreach (OrderLocationTransaction orderLocationTransaction in orderDetail.OrderLocationTransactions) { if (orderLocationTransaction.Operation == 0) { orderLocationTransaction.Operation = maxOp; } } } } #endregion }
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); }
public void DeleteRoutingDetail(RoutingDetail routingDetail) { RoutingDetailMgr.DeleteRoutingDetail(routingDetail); }
public void CreateRoutingDetail(RoutingDetail routingDetail) { RoutingDetailMgr.CreateRoutingDetail(routingDetail); }
public void UpdateRoutingDetail(RoutingDetail routingDetail) { RoutingDetailMgr.UpdateRoutingDetail(routingDetail); }
public virtual void UpdateRoutingDetail(RoutingDetail entity) { Update(entity); }
protected void ODS_RoutingDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Routingdetail = (RoutingDetail)e.InputParameters[0]; string routingCode = ((TextBox)(this.FV_RoutingDetail.FindControl("tbRouting"))).Text.Trim(); string locationCode = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbLocation"))).Text.Trim(); string workCenterCode = ((Controls_TextBox)(this.FV_RoutingDetail.FindControl("tbWorkCenter"))).Text.Trim(); string startDate = ((TextBox)(this.FV_RoutingDetail.FindControl("tbStartDate"))).Text.Trim(); string endDate = ((TextBox)(this.FV_RoutingDetail.FindControl("tbEndDate"))).Text.Trim(); if (Routingdetail != null) { Routingdetail.Routing = TheRoutingMgr.LoadRouting(routingCode); Routingdetail.Location = TheLocationMgr.LoadLocation(locationCode); Routingdetail.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workCenterCode); } }
public virtual void CreateRoutingDetail(RoutingDetail entity) { Create(entity); }