private void MES501JobTxForm_Shown(object sender, EventArgs e) { MES501PortalForm frmPortal = new MES501PortalForm(); if (frmPortal.ShowDialog() == DialogResult.OK) { macCode = frmPortal.MacCode; shiftCode = frmPortal.ShiftCode; processCode = frmPortal.ProcessCode; this.mESM202TaskDetailBindingSource.DataSource = taskService.GetProductQuery().Where(a => a.MacCode == macCode && a.ShiftCode == shiftCode && a.FQty < a.JobQty).ToList(); } }
void mESM202TaskBindingSource_CurrentChanged(object sender, EventArgs e) { var tempData = this.mESM202TaskBindingSource.Current as MES_M202_Task; if (tempData != null) { var TaskDtlList = TaskService.GetProductQuery().Where(a => a.TaskNo == tempData.TaskNo).ToList(); foreach (var taskDtl in TaskDtlList) { var planDetail = planDetailService.GetById(taskDtl.PlanDetailId.ToGuid()); if (planDetail != null) { taskDtl.PlanSumQty = planDetail.SumQty; taskDtl.PlanFQty = planDetail.FQty; } } this.mESM202TaskDetailBindingSource.DataSource = TaskDtlList; } else { this.mESM202TaskDetailBindingSource.DataSource = null; } }
protected override void InitData() { //级别 SetGridLookUpEdit(repositoryItemLevel, codeService.GetCodeDataByCodeId("PLLEVEL"), 1); //状态 SetGridLookUpEdit(repositoryItemStatus, codeService.GetCodeDataByCodeId("PLSTATUS"), 1); //班次 var codeData = codeService.GetCodeDataByCodeId("SHIFT"); SetGridLookUpEdit(repositoryItemShift, codeData, 1); //机台 codeData = codeService.GetCodeDataByCodeId("MACHINE"); SetGridLookUpEdit(repositoryItemMac, codeData, 1); //产品 var productData = productService.GetProductInputData(); SetGridLookUpEdit(repositoryProduct, productData, 1); //客户 var customerData = customerServer.GetCustomerInputData(); SetGridLookUpEdit(repositoryItemCustomer, customerData, 1); repositoryItemCustomer.DisplayMember = "Value"; //计划单 var planData = planDetailService.GetInputList(); SetGridLookUpEdit(repositoryItemPlan, planData, 5); //repositoryItemPlan.DisplayMember = "Value"; //repositoryItemPlan.View.Columns[0].Caption = "计划单号"; repositoryItemPlan.View.Columns[1].Caption = "SO工单"; repositoryItemPlan.View.Columns[2].Caption = "料号"; repositoryItemPlan.View.Columns[3].Caption = "品名"; repositoryItemPlan.View.Columns[4].Caption = "数量"; repositoryItemPlan.View.Columns[5].Caption = "完成数量"; this.mESM202TaskBindingSource.DataSource = tempData; var TaskDtlList = TaskService.GetProductQuery().Where(a => a.TaskNo == tempData.TaskNo).ToList(); foreach (var taskDtl in TaskDtlList) { var planDetail = planDetailService.GetById(taskDtl.PlanDetailId.ToGuid()); if (planDetail != null) { taskDtl.PlanSumQty = planDetail.SumQty; taskDtl.PlanFQty = planDetail.FQty; } } var count = TaskDtlList.Count; //新增自动添加20空行 for (int i = 0; i < 20 - count; i++) { MES_M202_Task_Detail taskdtl = new MES_M202_Task_Detail(); taskdtl.TaskNo = tempData.TaskNo; taskdtl.FQty = 0; taskdtl.JobQty = 0; TaskDtlList.Add(taskdtl); } this.mESM202TaskDetailBindingSource.DataSource = TaskDtlList; //this.gridProduct.BestFitColumns(); //this.gridMaterial.BestFitColumns(); }
/// <summary> /// 处理输入的工作单号信息 /// 1.先判断是否存在,存在则修改 /// 2.如果不存在则新增 /// </summary> /// <param name="jobNo"></param> /// <param name="processCode"></param> private void OnHandelSearch(string jobLotNo, string processCode) { //ItemClickEventArgs e = new ItemClickEventArgs(){e.Item.Caption } var jobLotTx = jobtxService.GetJobTxQuery().Where(a => a.JobNo == jobLotNo && a.ProcessCode == processCode).FirstOrDefault(); if (jobLotTx != null) { //var jobLotTxList = this.mESM501JobTxBindingSource.DataSource as List<erp> this.mESM501JobTxBindingSource.Remove(jobLotTx); this.mESM501JobTxBindingSource.Add(jobLotTx); //指定查找到的位置 this.mESM501JobTxBindingSource.Position = this.mESM501JobTxBindingSource.IndexOf(jobLotTx); } else { //var taskDetail = taskService.GetProductQuery().Where(a => a.JobNo == jobNo).FirstOrDefault(); var taskJobLot = taskJobLotService.GetQuery().Where(a => a.JobLotNo == jobLotNo).FirstOrDefault(); if (taskJobLot == null) { throw new AppException("没有对应的生产批次号,请检查"); } var taskDetail = taskService.GetProductQuery().Where(a => a.TaskNo == taskJobLot.JobNo).FirstOrDefault(); if (taskDetail == null) { throw new AppException("没有对应的跟踪单号,请检查"); } this.mESM501JobTxBindingSource.AddNew(); var jobtx = this.mESM501JobTxBindingSource.Current as MES_M501_JobTx; jobtx.PLNo = taskDetail.PLNo; jobtx.SONo = taskDetail.SONo; jobtx.SOQty = taskDetail.SOQty ?? 0; jobtx.TaskNo = taskDetail.TaskNo; jobtx.CustCode = taskDetail.CustCode; jobtx.JobNo = taskJobLot.JobLotNo; jobtx.PartNo = taskDetail.PartNo; //jobtx.PartType = taskDetail.PartType; //jobtx.PartSpec = taskDetail.PartSpec; jobtx.ProcessCode = processCode; //jobtx.ProcessFlow = taskDetail.ProcessFlow; var product = productService.GetProduct().Where(a => a.PartNo == taskDetail.PartNo).Select(a => new { a.PartSpec, a.PartType, a.ProcessFlow }).FirstOrDefault(); jobtx.PartSpec = product.PartSpec; jobtx.PartType = product.PartType; jobtx.PFCode = product.ProcessFlow; this.mESM501JobTxBindingSource.ResetCurrentItem(); //2016-4-5 var prodInfoList = productService.GetProdInfoByProdutCode(jobtx.PartNo).Where(a => a.ProcessCode == jobtx.ProcessCode).ToList() .Select(a => new MES_M501_JobTxProdInfo() { CompCode = a.CompCode, JobNo = jobtx.JobNo, PFCode = a.PFCode, ProcessCode = a.ProcessCode, TechCode = a.TechCode, TechType = a.TechType, TechContent = a.TechContent, TechSeqNo = a.TechSeqNo }).OrderBy(a => a.TechSeqNo).ToList(); this.mESM501JobTxProdInfoBindingSource.DataSource = prodInfoList; } toolStrip1.Visible = true; dataLayoutControl1.OptionsView.IsReadOnly = DevExpress.Utils.DefaultBoolean.False; gridJobTxDetail.OptionsBehavior.ReadOnly = false; gridProdInfo.OptionsBehavior.ReadOnly = false; gridControlJobTx.Enabled = false; var jobTxDetailList = this.mESM501JobTxDetailBindingSource.DataSource as List <MES_M501_JobTxDetail>; var count = jobTxDetailList.Count; for (int i = 0; i < 8 - count; i++) { MES_M501_JobTxDetail jobtxDetail = new MES_M501_JobTxDetail(); jobTxDetailList.Add(jobtxDetail); } this.mESM501JobTxDetailBindingSource.ResetBindings(false); this.txtModel.Focus(); }