public InspectOrder LoadInspectOrder(String inspectNo, bool includeDetail, bool isSort) { InspectOrder inspectOrder = this.LoadInspectOrder(inspectNo); if (includeDetail && inspectOrder.InspectOrderDetails != null && inspectOrder.InspectOrderDetails.Count > 0) { if (isSort) { InspectOrderDetailComparer inspectOrderDetailComparer = new InspectOrderDetailComparer(); IList <InspectOrderDetail> inspectOrderDetails = inspectOrder.InspectOrderDetails; List <InspectOrderDetail> targetInspectOrderDetails = new List <InspectOrderDetail>(); foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetails) { targetInspectOrderDetails.Add(inspectOrderDetail); } targetInspectOrderDetails.Sort(inspectOrderDetailComparer); inspectOrderDetails.Clear(); foreach (InspectOrderDetail targetInspectOrderDetail in targetInspectOrderDetails) { inspectOrderDetails.Add(targetInspectOrderDetail); } } } return(inspectOrder); }
protected override void SetBaseInfo(Resolver resolver) { if (resolver.CodePrefix == BusinessConstants.CODE_PREFIX_INSPECTION) { InspectOrder inspectOrder = inspectOrderMgr.CheckAndLoadInspectOrder(resolver.Input); if (inspectOrder.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("InspectOrder.Error.StatusIsNotValid", resolver.Input, inspectOrder.Status); } resolver.Code = inspectOrder.InspectNo; resolver.IsScanHu = inspectOrder.IsDetailHasHu; resolver.Status = inspectOrder.Status; if (resolver.IsScanHu) { resolver.PickBy = BusinessConstants.CODE_MASTER_PICKBY_HU; } else { resolver.PickBy = BusinessConstants.CODE_MASTER_PICKBY_ITEM; } } else { throw new BusinessErrorException("Common.Business.Error.BarCodeInvalid"); } }
protected override void GetDetail(Resolver resolver) { InspectOrder inspectOrder = inspectOrderMgr.LoadInspectOrder(resolver.Code, true); resolver.Transformers = TransformerHelper.ConvertInspectDetailToTransformer(inspectOrder.InspectOrderDetails); resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER; resolver.Result = languageMgr.TranslateMessage("MasterData.Inventory.CurrentInspectOrder", resolver.UserCode, resolver.Code); }
private ReceiptNote InspectOrder2ReceiptNote(InspectOrder inspectOrder) { ReceiptNote receiptNote = new ReceiptNote(); receiptNote.OrderNo = inspectOrder.InspectNo; receiptNote.CreateDate = inspectOrder.CreateDate; receiptNote.CreateUser = inspectOrder.CreateUser == null ? string.Empty : inspectOrder.CreateUser.Code; receiptNote.Status = inspectOrder.Status; return(receiptNote); }
public override IList <object> GetDataList(string code) { IList <object> list = new List <object>(); InspectOrder inspectOrderList = inspectOrderMgr.LoadInspectOrder(code, true, true); if (inspectOrderList != null) { list.Add(inspectOrderList); } return(list); }
//private Bom BomCompare(IList<BomDetail> bomScms, IList<MesScmsCompletedIssue> bomMes) //{ // Dictionary<string, string> updateDict = new Dictionary<string, string>(); // string[] delList = { }; // string[] insertList = { }; // foreach (BomDetail detail in bomScms) // { // foreach (MesScmsCompletedIssue mes in bomMes) // { // } // } // return null; // } private void ProcessInspectOrderIn(MesScmsTableIndex mesScmsTableIndex) { IList <MesScmsRepairMaterial> repairMaterialList = mesScmsRepairMaterialMgr.GetUpdateMesScmsRepairMaterial(); if (repairMaterialList != null && repairMaterialList.Count > 0) { List <string> rejList = repairMaterialList.Select(l => l.RejectNo).Distinct().ToList(); foreach (string rejNo in rejList) { IList <MesScmsRepairMaterial> rejMaterialList = repairMaterialList.Where(l => l.RejectNo == rejNo).ToList(); IDictionary <string, decimal> itemDic = new Dictionary <string, decimal>(); foreach (MesScmsRepairMaterial repairMaterial in rejMaterialList) { if (itemDic.ContainsKey(repairMaterial.ItemCode)) { itemDic[repairMaterial.ItemCode] += Convert.ToDecimal(repairMaterial.Qty); } else { itemDic.Add(repairMaterial.ItemCode, Convert.ToDecimal(repairMaterial.Qty)); } } try { Flow flow = flowMgr.LoadFlowByDesc(rejMaterialList[0].ProductLine); InspectOrder inspectOrder = inspectOrderMgr.CreateInspectOrder(flow.LocationFrom.Code, itemDic, userMgr.GetMonitorUser()); if (inspectOrder.InspectOrderDetails != null && inspectOrder.InspectOrderDetails.Count > 0) { foreach (InspectOrderDetail inspectOrderDetail in inspectOrder.InspectOrderDetails) { inspectOrderDetail.CurrentRejectedQty = inspectOrderDetail.InspectQty; } } inspectOrderMgr.PendInspectOrder(inspectOrder.InspectOrderDetails, userMgr.GetMonitorUser(), rejNo); foreach (MesScmsRepairMaterial repairMaterial in rejMaterialList) { mesScmsRepairMaterialMgr.Complete(repairMaterial); } } catch (Exception e) { this.CleanSession(); log.Error(repairMaterialList[0].RejectNo + " complete exception", e); continue; } } } mesScmsTableIndexMgr.Complete(mesScmsTableIndex); }
/* * 填充报表头 * * Param repack 报验单头对象 */ private void FillHead(InspectOrder inspectOrder) { //序号 this.SetRowCell(2, 6, inspectOrder.InspectNo); //部门/小组 //this.SetRowCell(5, 1, ); //班次 //this.SetRowCell(5, 3, inspectOrder ); //填写人 this.SetRowCell(5, 4, inspectOrder.CreateUser.Name); //日期 this.SetRowCell(5, 6, inspectOrder.CreateDate.ToString("yyyy-MM-dd HH:mm")); }
/* * 填充报表头 * * Param repack 报验单头对象 */ private void FillHead(InspectOrder inspectOrder) { string inspectCode = Utility.BarcodeHelper.GetBarcodeStr(inspectOrder.InspectNo, this.barCodeFontName); //报验单号 this.SetRowCell(2, 6, inspectCode); //报验单号 this.SetRowCell(3, 6, inspectOrder.InspectNo); //报验人 Create User: this.SetRowCell(5, 1, inspectOrder.CreateUser.Name); //报验时间 this.SetRowCell(5, 6, inspectOrder.CreateDate.ToString("yyyy-MM-dd HH:mm")); }
public void CreateInspectOrder(Resolver resolver) { IList<LocationLotDetail> locationLotDetailList = executeMgr.ConvertTransformersToLocationLotDetails(resolver.Transformers, false); if (locationLotDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } User user = userMgr.LoadUser(resolver.UserCode, false, true); InspectOrder inspectOrder = inspectOrderMgr.CreateInspectOrder(locationLotDetailList, user); resolver.Result = languageMgr.TranslateMessage("MasterData.InspectOrder.Create.Successfully", resolver.UserCode, inspectOrder.InspectNo); resolver.Transformers = null; resolver.Code = inspectOrder.InspectNo; resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER; }
public InspectOrder CheckAndLoadInspectOrder(string inspectOrderNo, bool includeDetail) { InspectOrder inspectOrder = this.LoadInspectOrder(inspectOrderNo); if (inspectOrder == null) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.InspectOrderNoNotExist", inspectOrderNo); } if (includeDetail && inspectOrder.InspectOrderDetails != null && inspectOrder.InspectOrderDetails.Count > 0) { } return(inspectOrder); }
public void InitPageParameter(string inspectNo, bool isWorkShop) { InspectOrder inspectOrder = TheInspectOrderMgr.LoadInspectOrder(inspectNo); this.lbInspectNo.Text = inspectOrder.InspectNo; this.lbCreateUser.Text = inspectOrder.CreateUser.Name; this.lbCreateDate.Text = inspectOrder.CreateDate.ToString("yyyy-MM-dd"); this.lbStatus.Text = inspectOrder.Status; this.IsPartQualified = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_ALLOW_PART_QUALIFIED).Value); this.btnQualified.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && !this.IsPartQualified && inspectOrder.IsDetailHasHu && !isWorkShop; this.btnUnqalified.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && !this.IsPartQualified && inspectOrder.IsDetailHasHu && !isWorkShop; this.btnInspect.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && (this.IsPartQualified || !inspectOrder.IsDetailHasHu) && !isWorkShop; this.btnUnqualifiedPrint.Visible = !isWorkShop; this.ucDetailList.IsPartQualified = this.IsPartQualified; this.ucDetailList.InitPageParameter(inspectNo, isWorkShop); }
protected void btnUnqualifiedPrint_Click(object sender, EventArgs e) { string inspectNo = this.lbInspectNo.Text; IList <object> list = new List <object>(); IList <InspectResult> inspectResultList = this.ucDetailList.PopulateUnqualifiedInspectOrder(); if (inspectResultList == null || inspectResultList.Count == 0) { ShowWarningMessage("MasterData.Inventory.InspectOrder.Unqualified.Empty"); return; } InspectOrder inspectOrder = TheInspectOrderMgr.LoadInspectOrder(inspectNo); list.Add(inspectOrder); list.Add(inspectResultList); string printUrl = TheReportMgr.WriteToFile("BelowBrade.xls", list); Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>"); this.ShowSuccessMessage("MasterData.Inventory.InspectOrder.Unqualified.Print.Successful"); }
protected void btnConfirm_Click(object sender, EventArgs e) { UpdateInspectItemDic(); bool hasDetail = false; if (this.InspectItemDic.Count == 0) { } else { foreach (string itemCode in this.InspectItemDic.Keys) { if (InspectItemDic[itemCode] != 0) { hasDetail = true; break; } } } if (!hasDetail) { ShowErrorMessage("MasterData.InspectOrder.Detail.Empty"); return; } try { InspectOrder inspectOrder = TheInspectOrderMgr.CreateInspectOrder(this.tbLocation.Text.Trim(), this.InspectItemDic, this.CurrentUser); ShowSuccessMessage("MasterData.InspectOrder.Create.Successfully", inspectOrder.InspectNo); if (CreateEvent != null) { CreateEvent(inspectOrder.InspectNo, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public static Transformer ConvertInspectOrderToTransformer(InspectOrder inspectOrder) { Transformer transformer = new Transformer(); foreach (InspectOrderDetail inspectDetail in inspectOrder.InspectOrderDetails) { TransformerDetail transformerDetail = new TransformerDetail(); transformerDetail.QualifiedQty = inspectDetail.QualifiedQty.HasValue ? inspectDetail.QualifiedQty.Value : 0; transformerDetail.RejectedQty = inspectDetail.RejectedQty.HasValue ? inspectDetail.RejectedQty.Value : 0; transformerDetail.CurrentQty = 0; transformerDetail.CurrentRejectQty = 0; transformerDetail.HuId = inspectOrder.IsDetailHasHu ? inspectDetail.LocationLotDetail.Hu.HuId : null; transformerDetail.Id = inspectDetail.Id; transformerDetail.ItemCode = inspectDetail.LocationLotDetail.Item.Code; transformerDetail.ItemDescription = inspectDetail.LocationLotDetail.Item.Description; transformerDetail.LocationCode = inspectDetail.LocationFrom.Code; transformerDetail.LocationLotDetId = inspectDetail.LocationLotDetail.Id; transformerDetail.LotNo = inspectDetail.LocationLotDetail.LotNo; if (inspectDetail.LocationLotDetail.Hu != null) { transformerDetail.Qty = inspectDetail.InspectQty / inspectDetail.LocationLotDetail.Hu.UnitQty; transformerDetail.UomCode = inspectDetail.LocationLotDetail.Hu.Uom.Code; transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Hu.UnitCount; } else { transformerDetail.Qty = inspectDetail.InspectQty; transformerDetail.UomCode = inspectDetail.LocationLotDetail.Item.Uom.Code; transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Item.UnitCount; } transformerDetail.LocationFromCode = inspectDetail.LocationFrom.Code; transformerDetail.LocationToCode = inspectDetail.LocationTo.Code; transformer.AddTransformerDetail(transformerDetail); } return(transformer); }
protected void btnPrint_Click(object sender, EventArgs e) { IList <object> list = new List <object>(); IList <InspectResult> inspectResultList = PopulateUnqualifiedInspectOrder(); if (inspectResultList.Count == 0) { ShowErrorMessage("Common.Business.Warn.DetailEmpty"); return; } string rejNo = string.Empty; if (inspectResultList[0].PrintNo == null || inspectResultList[0].PrintNo == string.Empty) { rejNo = TheNumberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION_REJECT); //不合格品单号 } else { rejNo = inspectResultList[0].PrintNo; } InspectOrder inspectOrder = new InspectOrder(); inspectOrder.InspectNo = rejNo; inspectOrder.CreateUser = this.CurrentUser; inspectOrder.CreateDate = DateTime.Now; list.Add(inspectOrder); list.Add(inspectResultList); string printUrl = TheReportMgr.WriteToFile("UnqualifiedGoods.xls", list); Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>"); this.ShowSuccessMessage("MasterData.Inventory.InspectOrder.Unqualified.Print.Successful"); this.GV_List.DataSource = null; this.GV_List.DataBind(); }
public void InitPageParameter(string inspectNo, bool isWorkShop) { this.InspectNo = inspectNo; InspectOrder inspectOrder = TheInspectOrderMgr.LoadInspectOrder(inspectNo, true); this.GV_List.DataSource = inspectOrder.InspectOrderDetails; this.GV_List.DataBind(); this.GV_List.Columns[7].Visible = inspectOrder.IsDetailHasHu; this.IsDetailHasHu = inspectOrder.IsDetailHasHu; if (this.IsPartQualified || !inspectOrder.IsDetailHasHu) { this.GV_List.Columns[13].Visible = true; this.GV_List.Columns[14].Visible = true; // this.GV_List.Columns[0].Visible = false; } else { //this.GV_List.Columns[0].Visible = true; this.GV_List.Columns[13].Visible = false; this.GV_List.Columns[14].Visible = false; } if (isWorkShop) { this.GV_List.Columns[0].Visible = false; this.GV_List.Columns[9].Visible = false; this.GV_List.Columns[10].Visible = false; this.GV_List.Columns[11].Visible = false; this.GV_List.Columns[12].Visible = false; this.GV_List.Columns[13].Visible = false; this.GV_List.Columns[14].Visible = false; this.GV_List.Columns[17].Visible = false; } }
public void PendInspectOrder(IList <InspectOrderDetail> inspectOrderDetailList, User user, string rejNo) { #region 过滤检验数量为0的检验明细 IList <InspectOrderDetail> noneZeroInspectOrderDetailList = new List <InspectOrderDetail>(); if (inspectOrderDetailList != null && inspectOrderDetailList.Count > 0) { foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetailList) { if (inspectOrderDetail.CurrentQualifiedQty > 0 || inspectOrderDetail.CurrentRejectedQty > 0) { noneZeroInspectOrderDetailList.Add(inspectOrderDetail); } } } if (noneZeroInspectOrderDetailList.Count == 0) { throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty"); } #endregion #region 循环检验单明细 IDictionary <string, InspectOrder> cachedInspectOrderDic = new Dictionary <string, InspectOrder>(); string irNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION_RESULT); //检验结果单号 IList <InspectOrderDetail> pendingList = new List <InspectOrderDetail>(); foreach (InspectOrderDetail inspectOrderDetail in noneZeroInspectOrderDetailList) { #region 缓存检验单头 InspectOrder inspectOrder = inspectOrderDetail.InspectOrder; if (!cachedInspectOrderDic.ContainsKey(inspectOrder.InspectNo)) { cachedInspectOrderDic.Add(inspectOrder.InspectNo, inspectOrder); } #endregion #region 检验数量 InspectOrderDetail oldInspectOrderDetail = this.inspectOrderDetailMgr.LoadInspectOrderDetail(inspectOrderDetail.Id); oldInspectOrderDetail.Disposition = inspectOrderDetail.Disposition; oldInspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.CurrentQualifiedQty; oldInspectOrderDetail.CurrentRejectedQty = inspectOrderDetail.CurrentRejectedQty; decimal totalInspectedQty = (oldInspectOrderDetail.QualifiedQty.HasValue ? oldInspectOrderDetail.QualifiedQty.Value : 0) + (oldInspectOrderDetail.RejectedQty.HasValue ? oldInspectOrderDetail.RejectedQty.Value : 0) + oldInspectOrderDetail.PendingQualifiedQty + oldInspectOrderDetail.PendingRejectedQty + oldInspectOrderDetail.CurrentQualifiedQty + oldInspectOrderDetail.CurrentRejectedQty; if (oldInspectOrderDetail.LocationLotDetail.Hu != null && oldInspectOrderDetail.InspectQty != totalInspectedQty) { //有条码的只能检验一次 throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.HuInspectQtyNotMatch", oldInspectOrderDetail.LocationLotDetail.Hu.HuId); } if (oldInspectOrderDetail.InspectQty < totalInspectedQty) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.InspectQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code); } #endregion #region 合格品 if (oldInspectOrderDetail.CurrentQualifiedQty > 0) { //更新待处理合格品数量 oldInspectOrderDetail.PendingQualifiedQty += oldInspectOrderDetail.CurrentQualifiedQty; } #endregion #region 合格品 if (oldInspectOrderDetail.CurrentRejectedQty > 0) { //更新不合格品数量 oldInspectOrderDetail.PendingRejectedQty += oldInspectOrderDetail.CurrentRejectedQty; } #endregion #region 保存检验结果 InspectResult inspectResult = new InspectResult(); inspectResult.InspectResultNo = irNo; inspectResult.InspectOrderDetail = oldInspectOrderDetail; inspectResult.QualifiedQty = oldInspectOrderDetail.CurrentQualifiedQty; inspectResult.RejectedQty = oldInspectOrderDetail.CurrentRejectedQty; inspectResult.CreateDate = DateTime.Now; inspectResult.CreateUser = user; inspectResult.LastModifyDate = DateTime.Now; inspectResult.LastModifyUser = user; inspectResult.PrintCount = 0; inspectResult.IsPrinted = false; if (rejNo != null && rejNo != string.Empty) { inspectResult.PrintNo = rejNo; inspectResult.IsPrinted = true; } this.inspectResultMgr.CreateInspectResult(inspectResult); #endregion #region 更新检验单明细 this.inspectOrderDetailMgr.UpdateInspectOrderDetail(oldInspectOrderDetail); #endregion #region 根据库位标记确认 if (!oldInspectOrderDetail.LocationTo.IsAutoConfirm) { oldInspectOrderDetail.CurrentQualifiedQty = 0; } if (!locationMgr.GetRejectLocation().IsAutoConfirm) { oldInspectOrderDetail.CurrentRejectedQty = 0; } if (oldInspectOrderDetail.CurrentQualifiedQty > 0 || oldInspectOrderDetail.CurrentRejectedQty > 0) { pendingList.Add(oldInspectOrderDetail); } #endregion } #endregion #region 将需要确认的自动确认 if (pendingList != null && pendingList.Count > 0) { ProcessInspectOrder(pendingList, user); } #endregion #region 更新检验单 DateTime dataTimeNow = DateTime.Now; foreach (InspectOrder oldInspectOrder in cachedInspectOrderDic.Values) { InspectOrder inspectOrder = this.LoadInspectOrder(oldInspectOrder.InspectNo); inspectOrder.LastModifyUser = user; inspectOrder.LastModifyDate = dataTimeNow; this.UpdateInspectOrder(inspectOrder); } #endregion }
public virtual void CreateInspectOrder(InspectOrder entity) { Create(entity); }
public InspectOrder CreateInspectOrder(IList <LocationLotDetail> locationLotDetailList, User user, string ipNo, string receiptNo, bool isSeperated) { IList <LocationLotDetail> noneZeroLocationLotDetailList = new List <LocationLotDetail>(); bool? isDetailHasHu = null; string region = null; if (locationLotDetailList != null && locationLotDetailList.Count > 0) { foreach (LocationLotDetail locationLotDetail in locationLotDetailList) { if (locationLotDetail.Location.Code == BusinessConstants.SYSTEM_LOCATION_INSPECT || locationLotDetail.Location.Code == BusinessConstants.SYSTEM_LOCATION_REJECT) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.LocationFrom", locationLotDetail.Location.Code); } if (locationLotDetail.CurrentInspectQty > 0) { if (isDetailHasHu == null) { isDetailHasHu = (locationLotDetail.Hu != null); } else if (isDetailHasHu != (locationLotDetail.Hu != null)) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.NotAllDetailHasHu"); } noneZeroLocationLotDetailList.Add(locationLotDetail); } if (region == null) { region = locationLotDetail.Location.Region.Code; } else if (region != locationLotDetail.Location.Region.Code) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.RegionNotEqual"); } } } if (noneZeroLocationLotDetailList.Count == 0) { throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty"); } #region 创建检验单头 DateTime dateTimeNow = DateTime.Now; InspectOrder inspectOrder = new InspectOrder(); inspectOrder.InspectNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION); inspectOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; inspectOrder.CreateUser = user; inspectOrder.CreateDate = dateTimeNow; inspectOrder.LastModifyUser = user; inspectOrder.LastModifyDate = dateTimeNow; inspectOrder.IsDetailHasHu = isDetailHasHu.Value; inspectOrder.IpNo = ipNo; inspectOrder.ReceiptNo = receiptNo; inspectOrder.IsSeperated = isSeperated; inspectOrder.Region = region; this.CreateInspectOrder(inspectOrder); #endregion #region 创建检验明细 foreach (LocationLotDetail locationLotDetail in noneZeroLocationLotDetailList) { //零件出库 this.locationMgr.InspectOut(locationLotDetail, user, false, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation()); //入待验库位 IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectIn(locationLotDetail, this.locationMgr.GetInspectLocation(), user, false, inspectOrder.InspectNo, null, null); if (inventoryTransactionList != null && inventoryTransactionList.Count > 0) { foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList) { InspectOrderDetail inspectOrderDetail = new InspectOrderDetail(); inspectOrderDetail.InspectOrder = inspectOrder; inspectOrderDetail.InspectQty = inventoryTransaction.Qty; inspectOrderDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId); inspectOrderDetail.LocationFrom = locationLotDetail.Location; inspectOrderDetail.LocationTo = locationLotDetail.InspectQualifyLocation != null ? locationLotDetail.InspectQualifyLocation : locationLotDetail.Location; this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail); inspectOrder.AddInspectOrderDetail(inspectOrderDetail); } } } #endregion return(inspectOrder); }
public override void CreateInspectOrder(InspectOrder entity) { entity.EstimateInspectDate = DateTime.Now; base.CreateInspectOrder(entity); }
public virtual void CreateInspectOrder(InspectOrder entity) { entityDao.CreateInspectOrder(entity); }
public virtual void UpdateInspectOrder(InspectOrder entity) { entityDao.UpdateInspectOrder(entity); }
protected override bool FillValuesImpl(String templateFileName, IList <object> list) { try { InspectOrder inspectOrder = (InspectOrder)list[0]; if (inspectOrder == null) { return(false); } IList <InspectOrderDetail> inspectOrderDetailsTemp = null; if (list.Count == 2) { inspectOrderDetailsTemp = (IList <InspectOrderDetail>)list[1]; } else { inspectOrderDetailsTemp = inspectOrder.InspectOrderDetails; } if (inspectOrderDetailsTemp == null || inspectOrderDetailsTemp.Count == 0) { return(false); } IList <InspectOrderDetail> inspectOrderDetails = new List <InspectOrderDetail>(); for (int i = 0; i < inspectOrderDetailsTemp.Count; i++) { InspectOrderDetail inspectOrderDetail = new InspectOrderDetail(); CloneHelper.CopyProperty(inspectOrderDetailsTemp[i], inspectOrderDetail); if (i == 0) { inspectOrderDetails.Add(inspectOrderDetail); } else { InspectOrderDetail inspectOrderDetailPrev = inspectOrderDetails[inspectOrderDetails.Count - 1]; if (inspectOrderDetail.LocationLotDetail.Item.Code == inspectOrderDetailPrev.LocationLotDetail.Item.Code && inspectOrderDetail.LocationFrom.Code == inspectOrderDetailPrev.LocationFrom.Code && inspectOrderDetail.LocationTo.Code == inspectOrderDetailPrev.LocationTo.Code && ( ( inspectOrderDetail.LocationLotDetail.Hu != null && inspectOrderDetail.LocationLotDetail.Hu.Uom.Code == inspectOrderDetailPrev.LocationLotDetail.Hu.Uom.Code && inspectOrderDetail.LocationLotDetail.Hu.UnitCount == inspectOrderDetailPrev.LocationLotDetail.Hu.UnitCount) || ( inspectOrderDetail.LocationLotDetail.Hu == null && inspectOrderDetail.LocationLotDetail.Item.Uom.Code == inspectOrderDetailPrev.LocationLotDetail.Item.Uom.Code && inspectOrderDetail.LocationLotDetail.Item.UnitCount == inspectOrderDetailPrev.LocationLotDetail.Item.UnitCount ) ) ) { //待检数 if (inspectOrderDetailPrev.InspectQty != null) { inspectOrderDetailPrev.InspectQty += inspectOrderDetail.InspectQty; } //合格数 if (inspectOrderDetailPrev.QualifiedQty != null) { inspectOrderDetailPrev.QualifiedQty += inspectOrderDetail.QualifiedQty; } //不合格数 if (inspectOrderDetailPrev.RejectedQty != null) { inspectOrderDetailPrev.RejectedQty += inspectOrderDetail.RejectedQty; } } else { inspectOrderDetails.Add(inspectOrderDetail); } } } this.barCodeFontName = this.GetBarcodeFontName(2, 6); //this.SetRowCellBarCode(0, 2, 6); this.CopyPage(inspectOrderDetails.Count); this.FillHead(inspectOrder); int pageIndex = 1; int rowIndex = 0; int rowTotal = 0; foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetails) { //物料号 this.SetRowCell(pageIndex, rowIndex, 0, inspectOrderDetail.LocationLotDetail.Item.Code); //物料描述 this.SetRowCell(pageIndex, rowIndex, 1, inspectOrderDetail.LocationLotDetail.Item.Description); //"单位Unit" this.SetRowCell(pageIndex, rowIndex, 2, inspectOrderDetail.LocationLotDetail.Item.Uom.Code); //"单包装UC" this.SetRowCell(pageIndex, rowIndex, 3, inspectOrderDetail.LocationLotDetail.Item.UnitCount.ToString("0.########")); //来源库位 this.SetRowCell(pageIndex, rowIndex, 4, inspectOrderDetail.LocationFrom.Code); //目的库位 this.SetRowCell(pageIndex, rowIndex, 5, inspectOrderDetail.LocationTo.Code); //待检数 this.SetRowCell(pageIndex, rowIndex, 6, inspectOrderDetail.InspectQty == null ? string.Empty : inspectOrderDetail.InspectQty.ToString("0.########")); //合格数 this.SetRowCell(pageIndex, rowIndex, 7, inspectOrderDetail.QualifiedQty == null ? string.Empty : inspectOrderDetail.QualifiedQty.Value.ToString("0.########")); //不合格数 this.SetRowCell(pageIndex, rowIndex, 8, inspectOrderDetail.RejectedQty == null ? string.Empty : inspectOrderDetail.RejectedQty.Value.ToString("0.########")); if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行 { pageIndex++; rowIndex = 0; } else { rowIndex++; } rowTotal++; } this.sheet.DisplayGridlines = false; this.sheet.IsPrintGridlines = false; if (inspectOrder.IsPrinted == null || inspectOrder.IsPrinted == false) { inspectOrder.IsPrinted = true; inspectOrderMgr.UpdateInspectOrder(inspectOrder); } } catch (Exception) { return(false); } return(true); }
public virtual void UpdateInspectOrder(InspectOrder entity) { Update(entity); }
public InspectOrder CreateInspectOrder(string locationCode, IDictionary <string, decimal> itemQtyDic, User user) { if (locationCode == BusinessConstants.SYSTEM_LOCATION_INSPECT || locationCode == BusinessConstants.SYSTEM_LOCATION_REJECT) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.LocationFrom", locationCode); } #region 创建检验单头 DateTime dateTimeNow = DateTime.Now; InspectOrder inspectOrder = new InspectOrder(); inspectOrder.InspectNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION); inspectOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; inspectOrder.CreateUser = user; inspectOrder.CreateDate = dateTimeNow; inspectOrder.LastModifyUser = user; inspectOrder.LastModifyDate = dateTimeNow; inspectOrder.IsDetailHasHu = false; inspectOrder.IsSeperated = true; Location location = this.locationMgr.CheckAndLoadLocation(locationCode); inspectOrder.Region = location.Region.Code; this.CreateInspectOrder(inspectOrder); #endregion #region 创建检验明细 if (itemQtyDic != null && itemQtyDic.Count > 0) { foreach (string itemCode in itemQtyDic.Keys) { if (itemQtyDic[itemCode] == 0) { continue; } Item item = this.itemMgr.CheckAndLoadItem(itemCode); //零件出库 IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectOut(location, item, itemQtyDic[itemCode], user, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation()); //入待验库位 foreach (InventoryTransaction outInventoryTransaction in inventoryTransactionList) { IList <InventoryTransaction> inInventoryTransactionList = this.locationMgr.InspectIn(item, 0 - outInventoryTransaction.Qty, user, inspectOrder.InspectNo, outInventoryTransaction.PlannedBill, location); if (inInventoryTransactionList != null && inInventoryTransactionList.Count > 0) { foreach (InventoryTransaction inInventoryTransaction in inInventoryTransactionList) { InspectOrderDetail inspectOrderDetail = new InspectOrderDetail(); inspectOrderDetail.InspectOrder = inspectOrder; inspectOrderDetail.InspectQty = inInventoryTransaction.Qty; inspectOrderDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inInventoryTransaction.LocationLotDetailId); inspectOrderDetail.LocationFrom = location; inspectOrderDetail.LocationTo = location; this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail); inspectOrder.AddInspectOrderDetail(inspectOrderDetail); } } } } } #endregion return(inspectOrder); }
public virtual void DeleteInspectOrder(InspectOrder entity) { Delete(entity); }
public IList <InspectOrderDetail> GetInspectOrderDetail(InspectOrder inspectOrder) { return(GetInspectOrderDetail(inspectOrder.InspectNo)); }
public void ProcessInspectOrder(IList <InspectOrderDetail> inspectOrderDetailList, User user) { #region 过滤检验数量为0的检验明细 IList <InspectOrderDetail> noneZeroInspectOrderDetailList = new List <InspectOrderDetail>(); if (inspectOrderDetailList != null && inspectOrderDetailList.Count > 0) { foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetailList) { if (inspectOrderDetail.CurrentQualifiedQty > 0 || inspectOrderDetail.CurrentRejectedQty > 0) { noneZeroInspectOrderDetailList.Add(inspectOrderDetail); } } } if (noneZeroInspectOrderDetailList.Count == 0) { throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty"); } #endregion #region 循环检验单明细 IDictionary <string, InspectOrder> cachedInspectOrderDic = new Dictionary <string, InspectOrder>(); //string inrNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION_RESULT); //检验结果单号 foreach (InspectOrderDetail inspectOrderDetail in noneZeroInspectOrderDetailList) { #region 缓存检验单头 InspectOrder inspectOrder = inspectOrderDetail.InspectOrder; if (!cachedInspectOrderDic.ContainsKey(inspectOrder.InspectNo)) { cachedInspectOrderDic.Add(inspectOrder.InspectNo, inspectOrder); } #endregion #region 检验数量 InspectOrderDetail oldInspectOrderDetail = this.inspectOrderDetailMgr.LoadInspectOrderDetail(inspectOrderDetail.Id); //oldInspectOrderDetail.Disposition = inspectOrderDetail.Disposition; oldInspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.CurrentQualifiedQty; oldInspectOrderDetail.CurrentRejectedQty = inspectOrderDetail.CurrentRejectedQty; if (oldInspectOrderDetail.LocationLotDetail.Hu != null) { if (oldInspectOrderDetail.PendingQualifiedQty != inspectOrderDetail.CurrentQualifiedQty && oldInspectOrderDetail.PendingRejectedQty != inspectOrderDetail.CurrentRejectedQty) { //有条码的只能检验一次 throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.HuInspectQtyNotMatch", oldInspectOrderDetail.LocationLotDetail.Hu.HuId); } } else { if (oldInspectOrderDetail.PendingQualifiedQty < inspectOrderDetail.CurrentQualifiedQty) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.QualifyQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code); } if (oldInspectOrderDetail.PendingRejectedQty < inspectOrderDetail.CurrentRejectedQty) { throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.RejectQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code); } } #endregion #region 合格品 if (oldInspectOrderDetail.CurrentQualifiedQty > 0) { oldInspectOrderDetail.LocationLotDetail.CurrentInspectQty = oldInspectOrderDetail.CurrentQualifiedQty; //出待验库位 this.locationMgr.InspectOut(oldInspectOrderDetail.LocationLotDetail, user, true, inspectOrder.InspectNo, oldInspectOrderDetail.LocationTo); //入合格品库位 this.locationMgr.InspectIn(oldInspectOrderDetail.LocationLotDetail, oldInspectOrderDetail.LocationTo, oldInspectOrderDetail.CurrentStorageBin, user, true, inspectOrder.InspectNo, null, inspectOrderDetail.Id); //更新合格品数量 if (!oldInspectOrderDetail.QualifiedQty.HasValue) { oldInspectOrderDetail.QualifiedQty = 0; } oldInspectOrderDetail.QualifiedQty += oldInspectOrderDetail.CurrentQualifiedQty; oldInspectOrderDetail.PendingQualifiedQty -= oldInspectOrderDetail.CurrentQualifiedQty; } #endregion #region 合格品 if (oldInspectOrderDetail.CurrentRejectedQty > 0) { oldInspectOrderDetail.LocationLotDetail.CurrentInspectQty = oldInspectOrderDetail.CurrentRejectedQty; //出待验库位 this.locationMgr.InspectOut(oldInspectOrderDetail.LocationLotDetail, user, false, inspectOrder.InspectNo, this.locationMgr.GetRejectLocation()); //入不合格品库位 this.locationMgr.InspectIn(oldInspectOrderDetail.LocationLotDetail, this.locationMgr.GetRejectLocation(), user, false, inspectOrder.InspectNo, null, inspectOrderDetail.Id); //更新不合格品数量 if (!oldInspectOrderDetail.RejectedQty.HasValue) { oldInspectOrderDetail.RejectedQty = 0; } oldInspectOrderDetail.RejectedQty += oldInspectOrderDetail.CurrentRejectedQty; oldInspectOrderDetail.PendingRejectedQty -= oldInspectOrderDetail.CurrentRejectedQty; } #endregion #region 更新检验单明细 this.inspectOrderDetailMgr.UpdateInspectOrderDetail(oldInspectOrderDetail); #endregion } #endregion #region 更新检验单 DateTime dataTimeNow = DateTime.Now; foreach (InspectOrder oldInspectOrder in cachedInspectOrderDic.Values) { InspectOrder inspectOrder = this.LoadInspectOrder(oldInspectOrder.InspectNo); inspectOrder.LastModifyUser = user; inspectOrder.LastModifyDate = dataTimeNow; bool allClose = true; IList <InspectOrderDetail> detailList = inspectOrderDetailMgr.GetInspectOrderDetail(inspectOrder); foreach (InspectOrderDetail inspectOrderDetail in detailList) { if (inspectOrderDetail.InspectQty != (inspectOrderDetail.QualifiedQty.HasValue ? inspectOrderDetail.QualifiedQty.Value : 0) + (inspectOrderDetail.RejectedQty.HasValue ? inspectOrderDetail.RejectedQty.Value : 0)) { allClose = false; break; } } if (allClose) { inspectOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE; } this.UpdateInspectOrder(inspectOrder); } #endregion }
public InspectOrder CreateFgInspectOrder(string locationCode, IDictionary <string, decimal> itemFgQtyDic, User user) { #region 创建检验单头 DateTime dateTimeNow = DateTime.Now; InspectOrder inspectOrder = new InspectOrder(); inspectOrder.InspectNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION); inspectOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; inspectOrder.CreateUser = user; inspectOrder.CreateDate = dateTimeNow; inspectOrder.LastModifyUser = user; inspectOrder.LastModifyDate = dateTimeNow; inspectOrder.IsDetailHasHu = false; inspectOrder.IsSeperated = true; inspectOrder.Region = this.locationMgr.CheckAndLoadLocation(locationCode).Region.Code; this.CreateInspectOrder(inspectOrder); #endregion #region 创建检验明细 if (itemFgQtyDic != null && itemFgQtyDic.Count > 0) { Location location = this.locationMgr.CheckAndLoadLocation(locationCode); string itemCode = string.Empty; string fgCode = string.Empty; string defectClassification = string.Empty; string defectFactor = string.Empty; foreach (string itemFgCode in itemFgQtyDic.Keys) { if (itemFgQtyDic[itemFgCode] == 0) { continue; } string[] itemFg = itemFgCode.Split('-'); itemCode = itemFg[0]; fgCode = itemFg[1]; defectClassification = itemFg[2]; defectFactor = itemFg[3]; Item item = this.itemMgr.CheckAndLoadItem(itemCode); //零件出库 this.locationMgr.InspectOut(location, item, itemFgQtyDic[itemFgCode], user, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation()); //入待验库位 IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectIn(item, itemFgQtyDic[itemFgCode], user, inspectOrder.InspectNo, null, location); if (inventoryTransactionList != null && inventoryTransactionList.Count > 0) { foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList) { InspectOrderDetail inspectOrderDetail = new InspectOrderDetail(); inspectOrderDetail.InspectOrder = inspectOrder; inspectOrderDetail.InspectQty = inventoryTransaction.Qty; inspectOrderDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId); inspectOrderDetail.LocationFrom = location; inspectOrderDetail.LocationTo = location; inspectOrderDetail.FinishGoods = this.itemMgr.LoadItem(fgCode); inspectOrderDetail.DefectClassification = defectClassification; inspectOrderDetail.DefectFactor = defectFactor; this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail); inspectOrder.AddInspectOrderDetail(inspectOrderDetail); } } } } #endregion return(inspectOrder); }
public virtual void DeleteInspectOrder(InspectOrder entity) { entityDao.DeleteInspectOrder(entity); }