/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnDel_Click() { try { int j = 0; if (gdvUnLoadCarMange.SelectedRows.Count > 0)//选中删除 { if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { //选中数量 int count = gdvUnLoadCarMange.SelectedRows.Count; string id = ""; //遍历 for (int i = 0; i < count; i++) { int busid = int.Parse(this.gdvUnLoadCarMange.SelectedRows[i].Cells["BusinessRecord_ID"].Value.ToString()); Expression <Func <BusinessRecord, bool> > funuserinfo = n => n.BusinessRecord_ID == busid; string strContent = LinQBaseDao.GetSingle("select smallTicket_Serialnumber from View_BusinessRecord_CarInfo where BusinessRecord_ID=" + busid).ToString(); if (BusinessRecordDAL.DeleteToMany(funuserinfo)) { j++; CommonalityEntity.WriteLogData("删除", "删除车牌号为:" + strContent + ",流水号为:" + strContent + "的过磅信息", CommonalityEntity.USERNAME);//添加操作日志 } } if (j == count) { MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else//没有选中 { MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { CommonalityEntity.WriteTextLog("卸货点管理 tsbtnDel_Click()+" + "".ToString()); } finally { LogInfoLoad(""); } }
/// <summary> /// 车辆授权 /// </summary> /// <param name="strID"></param> /// <param name="carName"></param> private void saveAuthorization(string strID, string carName) { Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(strID) && n.BusinessRecord_Type == CommonalityEntity.outWeight; Action <BusinessRecord> ap = s => { s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME; s.BusinessRecord_UnloadEmpowerTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_PrintinvoiceTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_UnloadEmpower = 1; s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim(); }; BusinessRecordDAL.Update(p, ap); LinQBaseDao.Query("update CarInOutRecord set CarInOutRecord_OutCheck='是',CarInOutRecord_OutCheckUser='******',CarInOutRecord_OutCheckTime='" + CommonalityEntity.GetServersTime() + "' where CarInOutRecord_ID =" + strID); CommonalityEntity.WriteLogData("地磅房授权", "地磅房:车辆" + carName + "出门授权", CommonalityEntity.USERNAME);//添加操作日志 MessageBox.Show("授权成功"); }
/// <summary> /// 卸货授权 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUnload_Click(object sender, EventArgs e) { strsql(); if (sql == "") { MessageBox.Show("没有该IC卡(小票)号的信息!"); return; } DataTable ds = LinQBaseDao.Query(sql).Tables[0]; if (ds.Rows.Count > 1) { if (ISFill(ds) == false) { return; } if (Convert.ToBoolean(ds.Rows[0]["CarInOutRecord_ISFulfill"].ToString())) { MessageBox.Show("该车辆已通行完成,无需授权!"); return; } string carinout = ds.Rows[0]["CarInOutRecord_ID"].ToString(); DataTable tableB = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + carinout).Tables[0]; for (int i = 0; i < tableB.Rows.Count; i++) { if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight) { if (tableB.Rows[i]["BusinessRecord_UnloadEmpower"].ToString() == "1") { MessageBox.Show("车辆已授权!"); return; } CheckMethod.AbnormalInformation = ""; CommonalityEntity.CarInoutid = carinout; if (Convert.ToBoolean(ds.Rows[0]["CarInOutRecord_Update"].ToString())) { CommonalityEntity.IsUpdatedri = true; sql = "Select * from ManagementStrategyRecord where ManagementStrategyRecord_State='启动' and ManagementStrategyRecord_CarType_ID in(select CarType_ID from CarType where CarType_Name='" + ds.Rows[0]["CarType_Name"].ToString() + "') and ManagementStrategyRecord_ControlInfo_ID in (select ControlInfo_ID from ControlInfo where ControlInfo_IDValue='450201' )"; } else { CommonalityEntity.IsUpdatedri = false; sql = "Select * from ManagementStrategy where ManagementStrategy_State='启动' and ManagementStrategy_CarType_ID in(select CarType_ID from CarType where CarType_Name='" + ds.Rows[0]["CarType_Name"].ToString() + "') and ManagementStrategy_ControlInfo_ID in (select ControlInfo_ID from ControlInfo where ControlInfo_IDValue='450201' )"; } checkPr.ExecutionMethod(sql); if (CheckMethod.AbnormalInformation != "") { MessageBox.Show("过磅重量异常,授权失败!"); return; } Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(carinout) && n.BusinessRecord_Type == CommonalityEntity.unloadFirstWeight; Action <BusinessRecord> ap = s => { s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME; s.BusinessRecord_UnloadEmpowerTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_PrintinvoiceTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_UnloadEmpower = 1; s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim(); }; if (BusinessRecordDAL.Update(p, ap)) { CommonalityEntity.WriteLogData("新增", "地磅房:车辆" + ds.Rows[0]["CarInfo_Name"].ToString() + "卸货授权", CommonalityEntity.USERNAME);//添加操作日志 MessageBox.Show("授权成功"); } } } } else { MessageBox.Show("车辆没有过磅,不能授权!"); return; } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (this.txtperson.Text.Trim() == "") { MessageBox.Show("过磅操作人不能为空!"); return; } if (this.txtWeight.Text.Trim() == "") { MessageBox.Show("过磅重量不能为空!"); return; } if (this.txtRemark.Text.Trim() == "") { MessageBox.Show("修改原因不能为空!"); return; } if (this.gdvUnLoadCarMange.SelectedRows.Count > 0)//选中行 { if (gdvUnLoadCarMange.SelectedRows.Count > 1) { MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Expression <Func <BusinessRecord, bool> > pc = n => n.BusinessRecord_ID == int.Parse(this.gdvUnLoadCarMange.SelectedRows[0].Cells["BusinessRecord_ID"].Value.ToString()); string id = ""; string strfront = ""; string strcontent = ""; Action <BusinessRecord> ap = s => { strfront = s.BusinessRecord_WeightPerson + "," + s.BusinessRecord_Weight + "," + s.BusinessRecord_Remark; s.BusinessRecord_WeightPerson = this.txtperson.Text; s.BusinessRecord_Weight = Convert.ToDouble(this.txtWeight.Text.Trim()); s.BusinessRecord_Remark = this.txtRemark.Text.Trim(); strcontent = s.BusinessRecord_WeightPerson + "," + s.BusinessRecord_Weight + "," + s.BusinessRecord_Remark; id = s.BusinessRecord_ID.ToString(); }; if (BusinessRecordDAL.Update(pc, ap)) { MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CommonalityEntity.WriteLogData("修改", "更新车牌号为:" + txtCar_Num.Text.Trim() + "的过磅信息;修改前:" + strfront + ";修改后:" + strcontent, CommonalityEntity.USERNAME);//添加操作日志 } else { MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch { CommonalityEntity.WriteTextLog("地磅房管理 btnUpdate_Click()" + "".ToString()); } finally { LogInfoLoad(""); Empty(); } }
/// <summary> /// 授权 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOutPass_Click(object sender, EventArgs e) { strsql(); if (sql == "") { MessageBox.Show("没有该IC卡(小票)号的信息!"); return; } DataTable ds = LinQBaseDao.Query(sql).Tables[0]; if (ds.Rows.Count > 1) { if (ISFill(ds) == false) { return; } string loadtype = ""; string type = ""; double wegiht1 = 0; double wegiht2 = 0; string carinout = ds.Rows[0]["CarInOutRecord_ID"].ToString(); DataTable tableB = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + carinout).Tables[0]; for (int i = 0; i < tableB.Rows.Count; i++) { if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadSecondWeight) { if (tableB.Rows[i]["BusinessRecord_UnloadEmpower"].ToString() == "1") { MessageBox.Show("车辆已卸货确认!"); return; } loadtype = CommonalityEntity.unloadSecondWeight; wegiht2 = Convert.ToDouble(tableB.Rows[i]["BusinessRecord_Weight"].ToString()); } if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight) { type = CommonalityEntity.unloadFirstWeight; wegiht1 = Convert.ToDouble(tableB.Rows[i]["BusinessRecord_Weight"].ToString()); } } if (loadtype == CommonalityEntity.unloadSecondWeight && type == "") { MessageBox.Show("没有卸货点第一次过磅"); return; } if (loadtype == CommonalityEntity.unloadSecondWeight && type == CommonalityEntity.unloadFirstWeight) { Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(carinout) && n.BusinessRecord_Type == CommonalityEntity.unloadSecondWeight; Action <BusinessRecord> ap = s => { s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME; s.BusinessRecord_UnloadEmpowerTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_PrintinvoiceTime = CommonalityEntity.GetServersTime(); s.BusinessRecord_UnloadEmpower = 1; s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim(); }; if (BusinessRecordDAL.Update(p, ap)) { CommonalityEntity.WriteLogData("新增", "地磅房:车辆" + ds.Rows[0]["CarInfo_Name"].ToString() + "卸货确认", CommonalityEntity.USERNAME);//添加操作日志 MessageBox.Show("确认成功"); } } } else { MessageBox.Show("车辆没有过磅,不能卸货确认!"); return; } }