/// <summary> /// 收货 /// </summary> private void tsbShouHuoClick() { if (MessageBox.Show("确定要收货吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { bool b = UpdateQCinfo("质检中");//修改质检状态为继续质检 if (b == false) { MessageBox.Show("操作失败!"); return; } foreach (int item in QCInfoIDS) { Expression <Func <QCInfo, bool> > fnQCiNFO = n => n.QCInfo_ID == item; Action <QCInfo> ACQCInfo = q => { q.QCInfo_RECV_RMA_METHOD = "收货"; q.QCInfo_REMARK = txtRemork.Text.Trim(); }; bool bol = QCInfoDAL.Update(fnQCiNFO, ACQCInfo); if (bol == true) { Expression <Func <Unusual, bool> > fnUnusual = n => n.Unusual_QCInfo_ID == item && n.Unusual_State == "未处理"; var Unusuals = UnusualDAL.Query(fnUnusual); foreach (var u in Unusuals) { Expression <Func <Unusual, bool> > fnU = n => n.Unusual_Id == u.Unusual_Id; Action <Unusual> AcUnusual_Id = a => { a.Unusual_State = "已处理"; a.Unusual_handle_UserId = Convert.ToInt32(Common.USERID); a.Unusual_handle_Result = "收货"; if (CardPeoples != "") { a.Unusual_Remork = "异常处理授权人:" + CardPeoples; } else { a.Unusual_Remork = ""; } }; UnusualDAL.Update(fnU, AcUnusual_Id); } } } MessageBox.Show("操作成功!"); } catch { MessageBox.Show("操作失败!"); } } }
/// <summary> /// 修改质检状态 /// </summary> /// <param name="dicName">字典名称</param> private bool UpdateQCinfo(string dicName) { int num = 0; DataTable statisIdDT = LinQBaseDao.Query("select Dictionary_ID from Dictionary where Dictionary_Name='" + dicName + "'").Tables[0]; if (QCInfoIDS.Count > 0) { int statisId = Convert.ToInt32(statisIdDT.Rows[0][0]); foreach (int item in QCInfoIDS)//循环质检编号 { Expression <Func <QCInfo, bool> > fnQCiNFO = n => n.QCInfo_ID == item; Action <QCInfo> ACQCInfo = q => { q.QCInfo_Dictionary_ID = statisId; q.QCInfo_RECV_RMA_METHOD = null; q.QCInfo_REMARK = txtRemork.Text.Trim(); }; bool b = QCInfoDAL.Update(fnQCiNFO, ACQCInfo); if (b == true) { Expression <Func <Unusual, bool> > fnUnusual = n => n.Unusual_QCInfo_ID == item && n.Unusual_State == "未处理"; var Unusuals = UnusualDAL.Query(fnUnusual); foreach (var u in Unusuals) { Expression <Func <Unusual, bool> > fnU = n => n.Unusual_Id == u.Unusual_Id; Action <Unusual> AcUnusual_Id = a => { a.Unusual_State = "已处理"; a.Unusual_handle_UserId = Convert.ToInt32(Common.USERID); if (dicName == "质检中") { a.Unusual_handle_Result = "继续质检"; } else { a.Unusual_handle_Result = "暂停质检"; } if (CardPeoples != "") { a.Unusual_Remork = "异常处理授权人:" + CardPeoples; } else { a.Unusual_Remork = ""; } }; bool bl = UnusualDAL.Update(fnU, AcUnusual_Id); if (bl) { num++; } } } } } if (num > 0) { return(true); } return(false); }