/// <summary> /// 保存 /// </summary> private void btnSave_Click(object sender, EventArgs e) { QC_Sample_Mix sample = this.curData; veh.LoadDataByWhere("NoticeBillId=@NoticeBillId", this.curData.NoticeBillId); if (string.IsNullOrEmpty(sample.NoticeBillId)) { MessageBox.Show("没有车辆信息,不能保存。"); return; } if (string.IsNullOrEmpty(sample.CardID)) { MessageBox.Show("还没有刷卡。"); return; } if (veh.Count > 0) { sample.WLLX = veh[0].WLLX; } //if (veh[0].WLLX == "火运") //{ sample.NoticeBillId = veh[0].Sample_Veh_ID.ToString(); } sample.SampleType = SampleType.抽查样; sample.Sample_Cylx = this.Cylx; sample.MixCount = 1; sample.MixPlanCount = 1; sample.SampleState = SampleState.组批完成; sample.Sample_TBZD = true; sample.ShouTong_User = LocalInfo.Current.user.ID; sample.ShouTong_Time = DateTime.Now; if (sample.DataState == DataRowState.Added) { sample.MixUser = LocalInfo.Current.user.ID; sample.Mix_Time = DateTime.Now; examineSamples.Insert(0, sample); } sample.SaveCheckItems = true; sample.Save(); btnUnBindCard.Visible = false; CreateSample(); QC_Sample_Mix.UpdateInspectMainSample(); MessageBox.Show("保存完成"); }
/// <summary> /// 保存 /// </summary> private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(currentData.WpCode)) { MessageBox.Show("作业点信息不能为空。"); return; } if (string.IsNullOrEmpty(currentData.MatPK)) { MessageBox.Show("物料信息不能为空。"); return; } if (currentData.VehSamples.Count == 0) { MessageBox.Show("请先刷取样卡。"); return; } currentData.SampleType = SampleType.校验样; currentData.ShouTong_User = LocalInfo.Current.user.ID; currentData.ShouTong_Time = DateTime.Now; currentData.MixPlanCount = currentData.VehSamples.Count; if (currentData.DataState == DataRowState.Added) { currentData.SupplierCode = DbContext.GetSeq("校验样" + DateTime.Today.ToString("yyyyMMdd"), 2); currentData.MixUser = LocalInfo.Current.user.ID; currentData.Mix_Time = DateTime.Now; mixSamples.Insert(0, currentData); } currentData.SaveVehSamples = true; currentData.SaveCheckItems = true; currentData.Save(); MessageBox.Show("保存成功"); }