/// <summary> /// 搜索的方法 /// </summary> private void GetDictionarySeach() { try { sqlwhere = " 1=1"; string name = this.cbxName.Text.Trim(); string value = this.txtDictionaryValue.Text.Trim(); string dicID = this.cbxDicname.SelectedValue.ToString(); if (!string.IsNullOrEmpty(name))//字典名称 { sqlwhere += String.Format(" and Dictionary_Name like '%{0}%'", name); } if (!string.IsNullOrEmpty(value))//字典名称 { sqlwhere += String.Format(" and Dictionary_Value like '%{0}%'", value); } if (!string.IsNullOrEmpty(dicID))//字典名称 { string strvalue = LinQBaseDao.GetSingle("select Dictionary_ID from Dictionary where Dictionary_ID=" + dicID).ToString(); sqlwhere += String.Format(" and Dictionary_ID=" + dicID + " or Dictionary_OtherID = {0}", strvalue); } } catch { CommonalityEntity.WriteTextLog("DictionaryForm.GetDictionarySeach异常:"); } finally { LogInfoLoad(""); } }
/// <summary> /// 得到时间差 /// </summary> /// <returns></returns> public static string GetTime(string d) { string times = ""; try { if (d.Length < 21) { return("0"); } string y = "20" + d.Substring(0, 2); string m = d.Substring(2, 2); string dd = d.Substring(4, 2); string h = d.Substring(6, 2); string mi = d.Substring(8, 2); string ss = d.Substring(10, 2); string time = y + "-" + m + "-" + dd + " " + h + ":" + mi + ":" + ss; DateTime dt = DateTime.Parse(time); t = dt; string sqltime = "select top 1 DATEDIFF(MINUTE,'" + dt + "',GETDATE()) from eh_CarPic "; var ds = LinQBaseDao.GetSingle(sqltime); times = ds.ToString(); } catch (Exception ex) { common.WriteTextLog("ImageFile GetTime()" + ex.Message); } return(times); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { string name = txtName.Text.Trim(); if (string.IsNullOrEmpty(name)) { MessageBox.Show(this, "客户端名称不能为空"); return; } if (btnSave.Text == "添加") { if (ClientDAL.ISClientInfoName(name)) { MessageBox.Show(this, "客户端名称已存在"); return; } int id = 0; ClientInfo client = new ClientInfo(); client.Client_NAME = name; client.Client_Dictionary_ID = Convert.ToInt32(cmbState.SelectedValue); client.Client_Phone = txtPhone.Text.Trim(); client.Client_ADDRESS = txtAddres.Text.Trim(); client.Client_REMARK = txtRemark.Text.Trim(); if (ClientDAL.InsertOneClientInfo(client, out id)) { MessageBox.Show("添加成功!"); Empty(); } else { MessageBox.Show("添加失败!"); } } else { if (cid == 0) { return; } object obj = LinQBaseDao.GetSingle("select count(0) from ClientInfo where Client_ID !=" + cid + " and Client_NAME='" + name + "'"); if (Convert.ToInt32(obj.ToString()) > 0) { MessageBox.Show(this, "客户端名称已存在"); return; } Expression <Func <ClientInfo, bool> > exp = n => n.Client_ID == cid; Action <ClientInfo> ap = s => { s.Client_NAME = name; s.Client_Dictionary_ID = Convert.ToInt32(cmbState.SelectedValue); s.Client_Phone = txtPhone.Text.Trim(); s.Client_ADDRESS = txtAddres.Text.Trim(); s.Client_REMARK = txtRemark.Text.Trim(); }; ClientDAL.Update(exp, ap); Empty(); } LoadData(""); }
/// <summary> /// 双击组件时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvBusinessType_DoubleClick(object sender, EventArgs e) { this.btnUpdate.Enabled = true; this.btnSave.Enabled = false; if (this.dgvBusinessType.SelectedRows.Count > 0)//选中行 { if (dgvBusinessType.SelectedRows.Count > 1) { MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //修改的值 int ID = int.Parse(this.dgvBusinessType.SelectedRows[0].Cells["BusinessType_ID"].Value.ToString()); Expression <Func <BusinessType, bool> > funviewinto = n => n.BusinessType_ID == ID; foreach (var n in BusinessTypeDAL.QueryView(funviewinto)) { if (n.BusinessType_Name != null) { // 业务类别名称 this.txtBusinessType_Name.Text = n.BusinessType_Name; } if (n.BusinessType_CarType_ID != null && n.BusinessType_CarType_ID > 0) { cmbCarType.Text = LinQBaseDao.GetSingle("select CarType_Name from CarType where CarType_ID=" + n.BusinessType_CarType_ID).ToString(); } if (n.BusinessType_State != null) { // 业务类别状态 this.cbxBusinessType_State.Text = n.BusinessType_State; } if (n.BusinessType_Loaded != null) { //装货类型 this.cbxBusinessType_Loaded.Text = n.BusinessType_Loaded; } if (n.BusinessType_Use != null) { //业务类别用途 this.txtBusinessType_Use.Text = n.BusinessType_Use; } if (n.BusinessType_Content != null) { // 业务类别描述 this.txtBusinessType_Content.Text = n.BusinessType_Content; } if (n.BusinessType_Remark != null) { // 业务类别备注 this.txtBusinessType_Remark.Text = n.BusinessType_Remark; } break; } } } else { MessageBox.Show("请选择要修改的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// 绑定数据 /// </summary> public void InstrumentList() { try { this.btnUpdate.Visible = false; this.btnqk.Visible = false; this.btnAdd.Enabled = true; int pageNum = Convert.ToInt32(this.txtCurrentPage2.Text); int pagesize = Convert.ToInt32(tscbxPageSize2.SelectedItem.ToString()); string sql = "select top (" + pagesize + ") PolicyConfiguration_Id,Client_NAME,Collection_Name,Instrument_Name from dbo.PolicyConfigurationInfo join dbo.ClientInfo on PolicyConfiguration_Client_ID=Client_ID join dbo.CollectionInfo on PolicyConfiguration_Collection_ID=Collection_ID join InstrumentInfo on PolicyConfiguration_Instrument_ID=Instrument_ID where PolicyConfiguration_Id not in (select top (" + (pageNum - 1) * pagesize + ") PolicyConfiguration_Id from dbo.PolicyConfigurationInfo join dbo.ClientInfo on PolicyConfiguration_Client_ID=Client_ID join dbo.CollectionInfo on PolicyConfiguration_Collection_ID=Collection_ID join InstrumentInfo on PolicyConfiguration_Instrument_ID=Instrument_ID)"; dgvPolicyConfigurationInfo.Columns.Clear(); DataGridViewColumnADD("编号", "PolicyConfiguration_Id", dgvPolicyConfigurationInfo); DataGridViewColumnADD("客户端PC", "Client_NAME", dgvPolicyConfigurationInfo); DataGridViewColumnADD("采集端", "Collection_Name", dgvPolicyConfigurationInfo); DataGridViewColumnADD("仪表", "Instrument_Name", dgvPolicyConfigurationInfo); dgvPolicyConfigurationInfo.DataSource = LinQBaseDao.Query(sql).Tables[0]; dgvPolicyConfigurationInfo.AllowUserToAddRows = false;//隐藏最后空白行 sql = "select count(*) from dbo.PolicyConfigurationInfo join dbo.ClientInfo on PolicyConfiguration_Client_ID=Client_ID join dbo.CollectionInfo on PolicyConfiguration_Collection_ID=Collection_ID join InstrumentInfo on PolicyConfiguration_Instrument_ID=Instrument_ID"; string sums = LinQBaseDao.GetSingle(sql).ToString(); if (sums != "") { zongyeshu = int.Parse(sums) / 10; if (int.Parse(sums) % 10 != 0) { zongyeshu += 1; } } lblPageCount2.Text = "共" + zongyeshu + "页";//把查询出来的总行数显示出来 empty(); } catch (Exception) { } }
/// <summary> /// 生成排队号 /// </summary> /// <returns></returns> public static string GetSortValue(string CarType_Value) { //取得最大排队序号 string sortSql = "Select max(SortNumberInfo_sortValue) from SortNumberInfo"; int sort_Value = 0; object sortObj = LinQBaseDao.GetSingle(sortSql); if (sortObj != null) { sort_Value = int.Parse(sortObj.ToString()); } else { sort_Value = 0; } //排队号 if (sort_Value > 9999) { sort_Value = 0; } if (SystemClass.PosistionValue != "" && CarType_Value != "") { return(SystemClass.PosistionValue + CarType_Value + (sort_Value + 1).ToString()); } else { return(""); } }
/// <summary> /// 生成小票号 /// </summary> /// <returns></returns> public static string GetSerialnumber() { //取得最大小票序号 string smallSql = "select top 1 SmallTicket_Serialnumber from SmallTicket order by SmallTicket_ID desc"; string css = "000000000000"; if (LinQBaseDao.GetSingle(smallSql) != null) { css = LinQBaseDao.GetSingle(smallSql).ToString(); } int cs = int.Parse(css.Substring(6, css.Length - 6).ToString()); if (cs > 999999) { cs = 0; } //获取门岗当前最大排队序号 string number = Number(cs);//得到排队序号 //设置小票号 string year = CommonalityEntity.GetServersTime().Year.ToString().Substring(2, 2); string moth = ""; if (int.Parse(CommonalityEntity.GetServersTime().Month.ToString()) < 10) { moth = "0" + CommonalityEntity.GetServersTime().Month.ToString(); } else { moth = CommonalityEntity.GetServersTime().Month.ToString(); } return(year + moth + SystemClass.PosistionValue + number); }
/// <summary> /// 绑定数据 /// </summary> public void BingList() { try { this.btnUpdate.Visible = false; this.btnqk.Visible = false; this.btnADD.Enabled = true; int pageNum = Convert.ToInt32(this.txtCurrentPage1.Text); int pagesize = Convert.ToInt32(tscbxPageSize1.SelectedItem.ToString()); string sql = "select top (" + pagesize + ") Instrument_ID,(select Collection_Name from CollectionInfo where Collection_ID=Instrument_Collection_ID) as Collection_Name,(select UserName from UserInfo2 where UserId=Instrument_UserID) as UserName,(select Client_NAME from ClientInfo where Client_ID in(select Collection_Client_ID from CollectionInfo where Collection_ID=Instrument_Collection_ID)) as Client_NAME,Instrument_Name,case Instrument_Type when '0' then '水分检测员' else '保安部水分检测员' end as Instrument_Type from InstrumentInfo where Instrument_ID not in (select top (" + ((pageNum - 1) * pagesize) + ") Instrument_ID from dbo.InstrumentInfo)"; dgvInstrumentInfo.DataSource = LinQBaseDao.Query(sql).Tables[0]; dgvInstrumentInfo.AllowUserToAddRows = false;//隐藏最后空白行 sql = "select count(0) from InstrumentInfo"; string sums = LinQBaseDao.GetSingle(sql).ToString(); if (sums != "") { zongyeshu = int.Parse(sums) / 10; if (int.Parse(sums) % 10 != 0) { zongyeshu += 1; } } lblPageCount2.Text = "共" + zongyeshu + "页";//把查询出来的总行数显示出来 empty(); } catch (Exception) { } }
private void comboxMenuTypeOrderBind() { int maxID = Convert.ToInt32(LinQBaseDao.GetSingle("select max(MenuType_ID+1) From dbo.MenuType")); int[] arr = new int[maxID + 1]; for (int i = 0; i <= maxID; i++) { arr[i] = i + 1; } comboxMenuTypeOrder.DataSource = arr; }
/// <summary> /// 删除选中行数据的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbtnDelPosition() { try { int j = 0; if (dgvPositionList.SelectedRows.Count > 0)//选中删除 { if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { //选中数量 int count = dgvPositionList.SelectedRows.Count; string id = ""; //遍历 for (int i = 0; i < count; i++) { int position_id = int.Parse(this.dgvPositionList.SelectedRows[i].Cells["Position_ID"].Value.ToString()); Expression <Func <Position, bool> > funuserinfo = n => n.Position_ID == position_id; string strContent = LinQBaseDao.GetSingle("select Position_Name from Position where Position_ID=" + position_id).ToString(); if (PositionDAL.DeleteToMany(funuserinfo)) { j++; CommonalityEntity.WriteLogData("删除", "删除门岗名称为:" + strContent + " 的信息", common.USERNAME);//添加日志 } } if (j == 0) { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //重新查询门岗值的最大值 countID = PositionDAL.MaxID("select MAX(Position_Value) from Position"); txtPosition_Value.Text = "0" + (countID + 1); } } } else//没有选中 { MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { common.WriteTextLog("门岗管理 tbtnDelPosition()+"); } finally { LogInfoLoad(""); } }
/// <summary> /// 绑定车辆信息 /// </summary> private void GetCarInfo() { if (CommonalityEntity.CarInfo_ID == "") { MessageBox.Show("参数错误"); this.Close(); } else { string sql = "Select * from CarInfo where CarInfo_ID=" + CommonalityEntity.CarInfo_ID + ""; CarInfo carinfo = new CarInfo(); carinfo = CarInfoDAL.GetViewCarInfoName(sql).FirstOrDefault(); if (carinfo.CarInfo_ID > 0) { txtCarInfo_Carriage.Text = carinfo.CarInfo_Carriage; txtCarInfo_Height.Text = carinfo.CarInfo_Height; txtCarInfo_Type.Text = carinfo.CarInfo_Type; txtCarInfo_Weight.Text = carinfo.CarInfo_Weight; txtCarName.Text = carinfo.CarInfo_Name; txtCustomerInfo_ADD.Text = carinfo.CarInfo_LevelWaste; txtRemark.Text = carinfo.CarInfo_Remark; txtUserName.Text = carinfo.CarInfo_Operate; txtState.Text = carinfo.CarInfo_State; string typeSql = "Select CarType_Name from CarType where CarType_ID=" + carinfo.CarInfo_CarType_ID + ""; object typeObj = null; typeObj = LinQBaseDao.GetSingle(typeSql); if (typeObj != null) { txtCarType_Name.Text = typeObj.ToString(); } if (Convert.ToBoolean(carinfo.CarInfo_Bail)) { chkCarInfo_Bail.Checked = true; } else { chkCarInfo_Bail.Checked = false; } sql = "select StaffInfo_Name,StaffInfo_Identity,StaffInfo_Phone ,CarType_Name,CustomerInfo_Name from View_CarState where CarInfo_ID=" + CommonalityEntity.CarInfo_ID; DataTable dt = LinQBaseDao.Query(sql).Tables[0]; if (dt.Rows.Count > 0) { txtCur.Text = dt.Rows[0]["CustomerInfo_Name"].ToString(); txtCarType_Name.Text = dt.Rows[0]["CarType_Name"].ToString(); txtStaffName.Text = dt.Rows[0]["StaffInfo_Name"].ToString(); txtStaInds.Text = dt.Rows[0]["StaffInfo_Identity"].ToString(); txtStaPhone.Text = dt.Rows[0]["StaffInfo_Phone"].ToString(); } } } }
/// <summary> /// 绑定车辆信息 /// </summary> private void GetCarInfo() { if (CommonalityEntity.CarInfo_ID == "") { MessageBox.Show("参数错误"); this.Close(); } else { string sql = "Select * from CarInfo where CarInfo_ID=" + CommonalityEntity.CarInfo_ID + ""; CarInfo carinfo = new CarInfo(); carinfo = CarInfoDAL.GetViewCarInfoName(sql).FirstOrDefault(); if (carinfo.CarInfo_ID > 0) { txtCarInfo_Carriage.Text = carinfo.CarInfo_Carriage; txtCarInfo_Height.Text = carinfo.CarInfo_Height; txtCarInfo_Type.Text = carinfo.CarInfo_Type; txtCarInfo_Weight.Text = carinfo.CarInfo_Weight; txtCarName.Text = carinfo.CarInfo_Name; txtCustomerInfo_ADD.Text = carinfo.CarInfo_LevelWaste; txtRemark.Text = carinfo.CarInfo_Remark; txtUserName.Text = carinfo.CarInfo_Operate; txtState.Text = carinfo.CarInfo_State; string typeSql = "Select CarType_Name from CarType where CarType_ID=" + carinfo.CarInfo_CarType_ID + ""; object typeObj = null; typeObj = LinQBaseDao.GetSingle(typeSql); if (typeObj != null) { txtCarType_Name.Text = typeObj.ToString(); } if (carinfo.CarInfo_CustomerInfo_ID > 0 && carinfo.CarInfo_CustomerInfo_ID != null) { string cuSql = "Select CustomerInfo_Name from CustomerInfo where CustomerInfo_ID=" + carinfo.CarInfo_CustomerInfo_ID + ""; object cuObj = null; cuObj = LinQBaseDao.GetSingle(cuSql); if (cuObj != null) { txtCur.Text = cuObj.ToString(); } } if (carinfo.CarInfo_Bail == "true") { chkCarInfo_Bail.Checked = false; } else { chkCarInfo_Bail.Checked = true; } } } }
private void LoadData() { BindCBX(); sqlWhere = " where 1=1 "; if (cbxSelPROD.Text.Trim() != "") { sqlWhere += " and Unusualstandard_PROD like '%" + cbxSelPROD.Text.Trim() + "%'"; } int numh = int.Parse(tscbxPageSize2.Text); int ye = int.Parse(txtCurrentPage2.Text); DGVUnusual.DataSource = LinQBaseDao.Query("select top(" + numh + ")* from Unusualstandard " + sqlWhere + " and Unusualstandard_ID not in(select top(" + (numh * (ye - 1)) + " )Unusualstandard_ID from Unusualstandard " + sqlWhere + ") ").Tables[0]; counts = (numh + int.Parse(LinQBaseDao.GetSingle("select count(*) from Unusualstandard " + sqlWhere).ToString())) / numh; }
/// <summary> /// 数据绑定事件 /// </summary> /// <param name="where"></param> public void Bangding_Load(string where) { form_loading = new Form_Loading(); form_loading.ShowLoading(this); form_loading.Text = "车辆登记数据加载中..."; int numh = int.Parse(tscbxPageSize2.Text); int numy = int.Parse(txtCurrentPage2.Text); string countsql = "select COUNT (1) from dbo.DRAW_EXAM_INTERFACE left join dbo.Packets on DRAW_EXAM_INTERFACE.DRAW_EXAM_INTERFACE_ID=Packets.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID "; if (where != "") { countsql = countsql + " where " + where; } //根据拼接出来的SQL语句查询出总行数 string tiaoshu = LinQBaseDao.GetSingle(countsql).ToString(); zongyeshu = (numh + int.Parse(tiaoshu)) / numh; lblPageCount2.Text = "共" + zongyeshu + "页|共" + tiaoshu + "条";//把查询出来的总行数显示出来 int countnum = int.Parse(LinQBaseDao.GetSingle(countsql).ToString()); //总行数 int rows = int.Parse(tscbxPageSize2.Text); //每页显示的行数 //lieramo begin update 20160901 //string sql = "select top(" + numh + ") DRAW_EXAM_INTERFACE_ID,REF_NO,CNTR_NO,SHIPMENT_NO,COMPANY_ID,PO_NO,PROD_ID,Packets_ID,WEIGHT_TICKET_NO,WEIGHT_DATE,NO_OF_BALES,IS_FINISHED,CREATE_BY,CREATE_DTTM,FINISHED_BY,FINISHED_DTTM,DEGRADE_MOISTURE_PERCT,DEGRADE_MATERIAL_PERCT,DEGRADE_OUTTHROWS_PERCT,IS_DengJi,Packets_DTS,Packets_this,Packets_Time from dbo.DRAW_EXAM_INTERFACE left join dbo.Packets on DRAW_EXAM_INTERFACE.DRAW_EXAM_INTERFACE_ID=Packets.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID where "; string sql = "select top(" + numh + ") supplyName,DRAW_EXAM_INTERFACE_ID,REF_NO,CNTR_NO,SHIPMENT_NO,COMPANY_ID,PO_NO,PROD_ID,Packets_ID,WEIGHT_TICKET_NO,WEIGHT_DATE,NO_OF_BALES,IS_FINISHED,CREATE_BY,CREATE_DTTM,FINISHED_BY,FINISHED_DTTM,DEGRADE_MOISTURE_PERCT,DEGRADE_MATERIAL_PERCT,DEGRADE_OUTTHROWS_PERCT,IS_DengJi,Packets_DTS,Packets_this,Packets_Time from dbo.DRAW_EXAM_INTERFACE left join dbo.Packets on DRAW_EXAM_INTERFACE.DRAW_EXAM_INTERFACE_ID=Packets.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID where "; //end update string sql2 = "DRAW_EXAM_INTERFACE_ID not in (select top(" + (numh * (numy - 1)) + ")DRAW_EXAM_INTERFACE_ID from dbo.DRAW_EXAM_INTERFACE left join dbo.Packets on DRAW_EXAM_INTERFACE.DRAW_EXAM_INTERFACE_ID=Packets.Packets_QCInfo_DRAW_EXAM_INTERFACE_ID "; string orderby = " order by WEIGHT_DATE desc "; if (where.Length > 0) { sql = sql + where + " and " + sql2 + " where " + where + orderby + " ) " + orderby; } else { sql = sql + sql2 + orderby + " ) " + orderby; } DataSet ds = LinQBaseDao.Query(sql); try { lvwUserList.DataSource = ds.Tables[0]; } catch (Exception) { } form_loading.CloseLoading(this); }
/// <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(""); } }
private void comboxCarType_SelectedIndexChanged(object sender, EventArgs e) { int s = Convert.ToInt32(comboxCarType.SelectedIndex.ToString()); if (s >= 0) { if (comboxCarType.SelectedValue.ToString() != "System.Data.DataRowView") { string busSql = " select Driveway_Name from Driveway where Driveway_ID in (select top(5) DrivewayStrategy_Driveway_ID from DrivewayStrategy where DrivewayStrategy_Name in (select CarType_DriSName from CarType where CarType_ID=" + comboxCarType.SelectedValue.ToString() + ") and charindex('" + SystemClass.PositionName + "',DrivewayStrategy_Record )>0 order by DrivewayStrategy_Sort) and Driveway_Type='进'"; object obj = LinQBaseDao.GetSingle(busSql); if (obj != null) { comboxDriveway.Text = obj.ToString(); } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cbxDicname_SelectedIndexChanged(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(cbxDicname.SelectedValue.ToString())) { string strvalue = LinQBaseDao.GetSingle("select Dictionary_ID from Dictionary where Dictionary_ID='" + cbxDicname.SelectedValue.ToString() + "'").ToString(); DataTable dt = LinQBaseDao.Query("select Dictionary_Name,Dictionary_ID from Dictionary where Dictionary_OtherID='" + strvalue + "'").Tables[0]; this.cbxName.DataSource = dt; this.cbxName.DisplayMember = "Dictionary_Name"; this.cbxName.ValueMember = "Dictionary_ID"; this.cbxName.SelectedValue = -1; } } catch { } }
/// <summary> /// 修改字典所属显示 /// </summary> private void DataBindingComplete() { if (this.dgvDictioanry.Rows.Count != 0) { for (int i = 0; i < this.dgvDictioanry.Rows.Count; i++) { string id = dgvDictioanry.Rows[i].Cells["Dictionary_OtherID"].Value.ToString(); if (id == "0") { dgvDictioanry.Rows[i].Cells["DicName"].Value = null; } else { string str = "select Dictionary_Name from Dictionary where Dictionary_ID=" + id; string strvalue = LinQBaseDao.GetSingle(str).ToString(); dgvDictioanry.Rows[i].Cells["DicName"].Value = strvalue; } } } }
/// <summary> /// 打印方法水分空报表 /// </summary> private void dayin(string DRAW_EXAM_INTERFACE_id) { try { int id = Convert.ToInt32(DRAW_EXAM_INTERFACE_id); Common.intQCInfo_ID = Convert.ToInt32(LinQBaseDao.GetSingle(" select QCInfo_ID from QCInfo where QCInfo_DRAW_EXAM_INTERFACE_ID=" + id).ToString()); DialogResult di = MessageBox.Show("是否预览再打印?", "系统提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); if (di.Equals(DialogResult.Yes)) { Form1 fr = new Form1(); fr.Show(); } else if (di.Equals(DialogResult.No)) { WordPringOut word = new WordPringOut(Common.intQCInfo_ID.ToString(), winWordControl1); } } catch (Exception) { } }
/// <summary> /// 记录打印记录 /// </summary> private void AddPrintRecord() { try { string strsql = " select SortNumberInfo_ID from SortNumberInfo where SortNumberInfo_SmallTicket_ID in (select SmallTicket_ID from SmallTicket where SmallTicket_CarInfo_ID='" + carinfoid + "') order by SortNumberInfo_ID desc "; prdObj = LinQBaseDao.GetSingle(strsql); //记录打印 PrintRecord prd = new PrintRecord(); prd.PrintRecord_Time = CommonalityEntity.GetServersTime(); prd.PrintRecord_Remark = ""; prd.PrintRecord_Operate = CommonalityEntity.USERNAME; if (!string.IsNullOrEmpty(prdObj.ToString())) { prd.PrintRecord_SortNumberInfo_ID = int.Parse(prdObj.ToString()); } PrintInfoDAL.InsertPrint(prd); printPreviewDialog.Close(); } catch (Exception) { } }
/// <summary> /// 是否登记过 /// </summary> /// <returns>true 已登记, false 未登记</returns> private bool YesNoDengJi(int DRAW_EXAM_INTERFACE_ID) { bool rbool = true; string strSQl = "select count(*) from DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + DRAW_EXAM_INTERFACE_ID + " and IS_DengJi='Y'"; object obj = LinQBaseDao.GetSingle(strSQl); int rint = 0; if (obj != null) { int.TryParse(obj.ToString(), out rint); if (rint <= 0) { rbool = false; } else { rbool = true; } } return(rbool); }
private void printMenu_Click(object sender, EventArgs e) { try { if (lvwUserList.SelectedRows.Count > 0) { int id = Convert.ToInt32(lvwUserList.SelectedRows[0].Cells["DRAW_EXAM_INTERFACE_ID"].Value); Common.intQCInfo_ID = Convert.ToInt32(LinQBaseDao.GetSingle(" select QCInfo_ID from QCInfo where QCInfo_DRAW_EXAM_INTERFACE_ID=" + id).ToString()); DialogResult di = MessageBox.Show("是否预览再打印?", "系统提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); if (di.Equals(DialogResult.Yes)) { Form1 fr = new Form1(); fr.Show(); } else if (di.Equals(DialogResult.No)) { WordPringOut word = new WordPringOut(Common.intQCInfo_ID.ToString(), winWordControl1); } } } catch (Exception) { } }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { string name = txtCollectionName.Text.Trim(); if (string.IsNullOrEmpty(name)) { MessageBox.Show(this, "采集端名称不能为空"); return; } if (cmbClient.SelectedIndex < 0) { MessageBox.Show(this, "请选择客户端"); return; } if (btnSave.Text == "添加") { if (ClientDAL.ISClientInfoName(name)) { MessageBox.Show(this, "采集端名称已存在"); return; } int id = 0; CollectionInfo client = new CollectionInfo(); client.Collection_Name = name; client.Collection_Client_ID = Convert.ToInt32(cmbClient.SelectedValue); client.Collection_Remark = txtRemark.Text.Trim(); if (CollectionDAL.InsertOneQCRecord(client)) { MessageBox.Show("添加成功!"); Empty(); } else { MessageBox.Show("添加失败!"); } } else { if (cid == 0) { return; } object obj = LinQBaseDao.GetSingle("select count(0) from CollectionInfo where Collection_ID !=" + cid + " and Collection_Name='" + name + "'"); if (Convert.ToInt32(obj.ToString()) > 0) { MessageBox.Show(this, "采集端名称已存在"); return; } Expression <Func <CollectionInfo, bool> > exp = n => n.Collection_ID == cid; Action <CollectionInfo> ap = s => { s.Collection_Name = name; s.Collection_Client_ID = Convert.ToInt32(cmbClient.SelectedValue); s.Collection_Remark = txtRemark.Text.Trim(); }; CollectionDAL.Update(exp, ap); Empty(); } LoadData(""); }
/// <summary> /// 修改通行策略 /// </summary> private void updateDri(string dname) { //通行策略没有改变 if (drisname == dname) { return; } //该车辆类型之前没有通行策略,现在才配置 if (string.IsNullOrEmpty(drisname)) { return; } DataTable dtdi = LinQBaseDao.Query(" select DrivewayStrategy_ID, DrivewayStrategy_Driveway_ID,DrivewayStrategy_Sort from DrivewayStrategy where DrivewayStrategy_State='启动' and DrivewayStrategy_Name='" + dname + "' order by DrivewayStrategy_Sort").Tables[0]; string sids = "";//通行策略ID字符串 string sortr = ""; if (dtdi.Rows.Count > 0) { for (int i = 0; i < dtdi.Rows.Count; i++) { sids += dtdi.Rows[i][0].ToString() + ","; if (dtdi.Rows[i][2].ToString() == "1") { sortr = "无序"; } else { sortr = "有序"; } } int driid = Convert.ToInt32(dtdi.Rows[0][1].ToString());//通道ID sids = sids.TrimEnd(','); #region 排队中车辆 DataTable dtstate = LinQBaseDao.Query("select CarInfo_ID,CarInOutRecord_ID,CarInOutRecord_DrivewayStrategyS,SortNumberInfo_ID,SortNumberInfo_PositionValue,SortNumberInfo_DrivewayValue,SmallTicket_ID from View_CarState where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and (SortNumberInfo_TongXing='排队中' or SortNumberInfo_TongXing='待通行') ").Tables[0]; if (dtstate.Rows.Count > 0) { //门岗值 string sortnumberinfo_positionvalue = LinQBaseDao.GetSingle("select p.Position_Value from Position p,Driveway d where d.Driveway_Position_ID=p.Position_ID and d.Driveway_ID= " + driid).ToString(); //通道值 string sortnumberinfo_drivewayvalue = LinQBaseDao.GetSingle("select Driveway_Value from Driveway where Driveway_ID=" + driid).ToString(); // 修改DrivewayStrategy 的CarInOutRecord_Update状态为1 LinQBaseDao.Query("update View_CarState set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_Driveway_ID='" + driid + "',CarInOutRecord_Sort='" + sortr + "',CarInOutRecord_Remark='" + dname + "' where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and (SortNumberInfo_TongXing='排队中' or SortNumberInfo_TongXing='待通行') "); LinQBaseDao.Query("update View_CarState set SortNumberInfo_PositionValue='" + sortnumberinfo_positionvalue + "',SortNumberInfo_DrivewayValue='" + sortnumberinfo_drivewayvalue + "' where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_ISEffective=1 and (SortNumberInfo_TongXing='排队中' or SortNumberInfo_TongXing='待通行')"); } #endregion #region 已进厂车辆 //单次进出门岗,已进厂车辆修改出厂通行策略 dtstate = LinQBaseDao.Query("select CarInOutRecord_ID,CarInOutRecord_DrivewayStrategyS from View_CarState where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_TongXing='已进厂'").Tables[0]; if (dtstate.Rows.Count > 0) { string drivstr = ""; string[] drivstrs = sids.Split(','); int count = 0; foreach (var item in drivstrs) { count++; drivstr += item.ToString() + ","; } drivstr = drivstr.TrimEnd(','); if (count == 2) { drivstr = drivstr.Substring(0, drivstr.IndexOf(',')); LinQBaseDao.Query("update View_CarState set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_DrivewayStrategy_IDS='" + drivstr + "',CarInOutRecord_Sort='" + sortr + "',CarInOutRecord_Remark='" + dname + "' where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_TongXing='已进厂' "); } else { LinQBaseDao.Query("update View_CarState set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_Sort='" + sortr + "',CarInOutRecord_Remark='" + dname + "' where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_TongXing='已进厂' "); } } #endregion #region 已出厂 业务未完成车辆 dtstate = LinQBaseDao.Query("select CarInOutRecord_ID,CarInOutRecord_DrivewayStrategyS from View_CarState where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_TongXing='已出厂' and CarInOutRecord_ISFulfill=0 ").Tables[0]; if (dtstate.Rows.Count > 0) { LinQBaseDao.Query("update View_CarState set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_Sort='" + sortr + "',CarInOutRecord_Remark='" + dname + "' where CarInOutRecord_Update=0 and CarType_ID=" + intCarTypeID + " and SortNumberInfo_TongXing='已出厂' "); } #endregion } }
private void timer1_Tick(object sender, EventArgs e) { try { //查询质检中的数据并且已检测水分或正在检测水分的数据 DataTable QcInfoDT = LinQBaseDao.Query(" SELECT top(100)* from QCInfo,DRAW_EXAM_INTERFACE where QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID and QCInfo_ID in (select QCRecord_QCInfo_ID from QCRecord,TestItems where QCRecord_TestItems_ID = 1 ) and QCInfo_Dictionary_ID =8 order by QCInfo_ID desc ").Tables[0]; string qcids = ""; string strsql = ""; if (QcInfoDT.Rows.Count > 0) { for (int s = 0; s < QcInfoDT.Rows.Count; s++) { //筛选出正在检测水分的数据 int mcount = Convert.ToInt32(LinQBaseDao.GetSingle(" select COUNT(0) from QCRecord where QCRecord_QCInfo_ID=" + QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + " and QCRecord_TestItems_ID=1 and QCRecord_RESULT is null").ToString()); if (!string.IsNullOrEmpty(QcInfoDT.Rows[s]["QCInfo_MOIST_Count"].ToString())) { if (mcount != 0) { if (mcount < Convert.ToInt32(QcInfoDT.Rows[s]["QCInfo_MOIST_Count"].ToString())) { if (QcInfoDT.Rows[s]["QCInfo_Dictionary_ID"].ToString() != "19") { qcids += QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + ","; } } } } } if (!string.IsNullOrEmpty(qcids)) { strsql = " SELECT top(100) * from QCInfo,DRAW_EXAM_INTERFACE where QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID and QCInfo_ID in (" + qcids.TrimEnd(',') + ") order by QCInfo_ID desc"; QcInfoDT = LinQBaseDao.Query(strsql).Tables[0]; } else { if (sy > 5) { sy = 0; lblCarNoA.Text = ""; lbltypeA.Text = ""; lblWaterA.Text = ""; lblAVGA.Text = ""; lblOA1.Text = ""; lblOA2.Text = ""; lblOA3.Text = ""; lblOA4.Text = ""; lblCarNOB.Text = ""; lblTypeB.Text = ""; lblWaterB.Text = ""; lblAVGB.Text = ""; lblOB1.Text = ""; lblOB2.Text = ""; lblOB3.Text = ""; lblOB4.Text = ""; } sy++; return; } if (QcInfoDT.Rows.Count == 1) { lblCarNOB.Text = ""; lblTypeB.Text = ""; lblWaterB.Text = ""; lblAVGB.Text = ""; lblOB1.Text = ""; lblOB2.Text = ""; lblOB3.Text = ""; lblOB4.Text = ""; } #region //循环质检信息 每次2条信息 for (int i = 0; i < 2; i++) { if (num + i >= QcInfoDT.Rows.Count) { num = 0; return; } int QCInfo_ID = Convert.ToInt32(QcInfoDT.Rows[num + i]["QCInfo_ID"]); //质检编号 string CNTR_NO = QcInfoDT.Rows[num + i]["CNTR_NO"].ToString(); //车牌 string PROD_ID = QcInfoDT.Rows[num + i]["PROD_ID"].ToString(); //纸种 if (PROD_ID.Length >= 8) { PROD_ID = PROD_ID.Substring(0, 8); } string BWeight = QcInfoDT.Rows[num + i]["QCInfo_BAGWeight"].ToString(); //总包重 string PWeight = QcInfoDT.Rows[num + i]["QCInfo_PAPER_SCALE"].ToString(); //杂纸比例 // string PWeight = QcInfoDT.Rows[num + i]["QCInfo_PAPER_WEIGHT"].ToString() ;//杂纸 string MWeight = QcInfoDT.Rows[num + i]["QCInfo_MATERIAL_SCALE"].ToString(); //杂质比例 //string MWeight = QcInfoDT.Rows[num + i]["QCInfo_MATERIAL_WEIGHT"].ToString() ;//杂质 if (!string.IsNullOrEmpty(BWeight)) { BWeight = Convert.ToInt32(Convert.ToDouble(BWeight)).ToString(); } if (!string.IsNullOrEmpty(PWeight)) { PWeight = Convert.ToDouble(PWeight).ToString(); } if (!string.IsNullOrEmpty(MWeight)) { MWeight = Convert.ToDouble(MWeight).ToString(); } string avgWate = ""; if (QcInfoDT.Rows[num + i]["QCInfo_MOIST_PER_SAMPLE"].ToString() != "") { //总平均水分 avgWate = QcInfoDT.Rows[num + i]["QCInfo_MOIST_PER_SAMPLE"].ToString();//平均水分 } else { // 拆包后平均水分 if (QcInfoDT.Rows[num + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString() != "") { avgWate = QcInfoDT.Rows[num + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString(); } else { //拆包前 if (QcInfoDT.Rows[num + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString() != "") { avgWate = QcInfoDT.Rows[num + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString(); } } } string wate = ""; //实时水分 string state = ""; //状态 //根据质检编号查询QCRecord_RESULT > 0 的质检详细信息 排倒序 DataTable QCRecordDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_QCInfo_ID=" + QCInfo_ID + " order by QCRecord_ID desc").Tables[0]; if (QCRecordDT.Rows.Count > 0) { string testItem = QCRecordDT.Rows[0]["TestItems_NAME"].ToString();//检测项目名称 //根据质检编号查询QCRecord_RESULT > 0 的2条水分质检详细信息 排倒序 DataTable wateDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_RESULT > 0 and QCRecord_QCInfo_ID=" + QCInfo_ID + " and Tes_TestItems_ID=1 order by QCRecord_ID desc").Tables[0]; //赋值实时水分,这里有2条就显示2条,否则显示一条 if (wateDT.Rows.Count > 1) { wate = wateDT.Rows[0]["QCRecord_RESULT"].ToString(); } else if (wateDT.Rows.Count == 1) { wate = wateDT.Rows[0]["QCRecord_RESULT"].ToString(); } if (testItem == "水分检测" || testItem == "拆包后水分检测" || testItem == "拆包前水分检测") { //状态为测水判断 state = "测水"; } //状态为分拣判断 if (testItem == "重量检测" || testItem == "废纸包重" || testItem == "杂质" || testItem == "杂纸") { state = "分拣"; } //状态为退货判断 if (testItem == "退货还包" || QcInfoDT.Rows[num + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "退货") { state = "退货"; } if (QcInfoDT.Rows[num + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "收货") { state = "收货"; } } //if (CEQCINFO_ID==1) //{ // i=i + 1; //} switch (i) { //第一行 case 0: if (lblCarNoA.Text != CNTR_NO) { lblCarNoA.Text = CNTR_NO; } if (lbltypeA.Text != PROD_ID) { lbltypeA.Text = PROD_ID; } if (lblWaterA.Text != wate) { lblWaterA.Text = wate; } if (lblAVGA.Text != avgWate) { lblAVGA.Text = avgWate; } lblOA1.Text = BWeight; lblOA2.Text = PWeight; lblOA3.Text = MWeight; lblOA4.Text = state; break; //第二行 case 1: if (lblCarNOB.Text != CNTR_NO) { lblCarNOB.Text = CNTR_NO; } if (lblTypeB.Text != PROD_ID) { lblTypeB.Text = PROD_ID; } if (lblWaterB.Text != wate) { lblWaterB.Text = wate; } if (lblAVGB.Text != avgWate) { lblAVGB.Text = avgWate; } lblOB1.Text = BWeight; lblOB2.Text = PWeight; lblOB3.Text = MWeight; lblOB4.Text = state; break; default: break; } } #endregion num += 2; } } catch { } }
private void timer2_Tick(object sender, EventArgs e) { try { string qcids = ""; string qcid = ""; //查询所有质检中的数据+完成质检并且规定时间以内的 DataTable QcInfoDT = LinQBaseDao.Query(" SELECT top(100)* from QCInfo,DRAW_EXAM_INTERFACE where QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID and (QCInfo_Dictionary_ID in (7,8) or (QCIInfo_EndTime >= '" + DateTime.Now.AddMinutes(endTime) + "' and QCInfo_Dictionary_ID=19)) order by QCInfo_ID desc ").Tables[0]; if (QcInfoDT.Rows.Count > 0) { for (int s = 0; s < QcInfoDT.Rows.Count; s++) { //筛选出正在检测水分的数据 int qcrcount = Convert.ToInt32(LinQBaseDao.GetSingle(" select COUNT(0) from QCRecord where QCRecord_QCInfo_ID=" + QcInfoDT.Rows[s]["QCInfo_ID"].ToString()).ToString()); if (qcrcount <= 0) { qcids += QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + ","; } int mcount = Convert.ToInt32(LinQBaseDao.GetSingle(" select COUNT(0) from QCRecord where QCRecord_QCInfo_ID=" + QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + " and QCRecord_TestItems_ID=1 and QCRecord_RESULT is null").ToString()); if (!string.IsNullOrEmpty(QcInfoDT.Rows[s]["QCInfo_MOIST_Count"].ToString())) { if (mcount != 0) { if (mcount < Convert.ToInt32(QcInfoDT.Rows[s]["QCInfo_MOIST_Count"].ToString())) { if (QcInfoDT.Rows[s]["QCInfo_Dictionary_ID"].ToString() != "19") { qcids += QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + ","; } } } else { object obj = LinQBaseDao.GetSingle("select QCRecord_TIME from QCRecord where QCRecord_QCInfo_ID =" + QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + " and QCRecord_TestItems_ID in (1,3,4) order by QCRecord_QCCOUNT desc"); if (obj != null) { DateTime dtqcrtime = Convert.ToDateTime(obj.ToString()); TimeSpan tspan = Common.GetServersTime() - dtqcrtime; if (tspan.TotalSeconds < 30) { qcid += QcInfoDT.Rows[s]["QCInfo_ID"].ToString() + ","; } } } } } if (!string.IsNullOrEmpty(qcid)) { //完成水分检测30秒以内的数据 string strsql = " SELECT top(100) * from QCInfo,DRAW_EXAM_INTERFACE where QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID and QCInfo_ID in (" + qcid.TrimEnd(',') + ") order by QCInfo_ID desc "; QcInfoDT = LinQBaseDao.Query(strsql).Tables[0]; } else { if (!string.IsNullOrEmpty(qcids)) { string strsql = " SELECT top(100)* from QCInfo,DRAW_EXAM_INTERFACE where QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID and QCInfo_ID not in (" + qcids.TrimEnd(',') + ") and (QCInfo_Dictionary_ID in (7,8) or (QCIInfo_EndTime >= '" + DateTime.Now.AddMinutes(endTime) + "' and QCInfo_Dictionary_ID=19)) order by QCInfo_ID desc "; QcInfoDT = LinQBaseDao.Query(strsql).Tables[0]; } } if (QcInfoDT.Rows.Count == 1) { lblCarNoD.Text = ""; lblTypeD.Text = ""; lblWaterD.Text = ""; lblAVGD.Text = ""; lblOD1.Text = ""; lblOD2.Text = ""; lblOD3.Text = ""; lblOD4.Text = ""; } #region //循环质检信息 每次2条信息 for (int i = 0; i < 2; i++) { if (num1 + i >= QcInfoDT.Rows.Count) { num1 = 0; return; } int QCInfo_ID = Convert.ToInt32(QcInfoDT.Rows[num1 + i]["QCInfo_ID"]); //质检编号 string CNTR_NO = QcInfoDT.Rows[num1 + i]["CNTR_NO"].ToString(); //车牌 string PROD_ID = QcInfoDT.Rows[num1 + i]["PROD_ID"].ToString(); //纸种 if (PROD_ID.Length >= 8) { PROD_ID = PROD_ID.Substring(0, 8); } string BWeight = QcInfoDT.Rows[num1 + i]["QCInfo_BAGWeight"].ToString(); //总包重 string PWeight = QcInfoDT.Rows[num1 + i]["QCInfo_PAPER_SCALE"].ToString(); //杂纸比例 // string PWeight = QcInfoDT.Rows[num1 + i]["QCInfo_PAPER_WEIGHT"].ToString() ;//杂纸 string MWeight = QcInfoDT.Rows[num1 + i]["QCInfo_MATERIAL_SCALE"].ToString(); //杂质比例 //string MWeight = QcInfoDT.Rows[num1 + i]["QCInfo_MATERIAL_WEIGHT"].ToString() ;//杂质 if (!string.IsNullOrEmpty(BWeight)) { BWeight = Convert.ToInt32(Convert.ToDouble(BWeight)).ToString(); } if (!string.IsNullOrEmpty(PWeight)) { PWeight = Convert.ToDouble(PWeight).ToString(); } if (!string.IsNullOrEmpty(MWeight)) { MWeight = Convert.ToDouble(MWeight).ToString(); } string avgWate = ""; if (QcInfoDT.Rows[num1 + i]["QCInfo_MOIST_PER_SAMPLE"].ToString() != "") { //总平均水分 avgWate = QcInfoDT.Rows[num1 + i]["QCInfo_MOIST_PER_SAMPLE"].ToString();//平均水分 } else { // 拆包后平均水分 if (QcInfoDT.Rows[num1 + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString() != "") { avgWate = QcInfoDT.Rows[num1 + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString(); } else { //拆包前 if (QcInfoDT.Rows[num1 + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString() != "") { avgWate = QcInfoDT.Rows[num1 + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString(); } } } string wate = ""; //实时水分 string state = ""; //状态 //根据质检编号查询QCRecord_RESULT > 0 的质检详细信息 排倒序 DataTable QCRecordDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_QCInfo_ID=" + QCInfo_ID + " order by QCRecord_ID desc").Tables[0]; if (QCRecordDT.Rows.Count > 0) { string testItem = QCRecordDT.Rows[0]["TestItems_NAME"].ToString();//检测项目名称 //根据质检编号查询QCRecord_RESULT > 0 的2条水分质检详细信息 排倒序 DataTable wateDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_RESULT > 0 and QCRecord_QCInfo_ID=" + QCInfo_ID + " and Tes_TestItems_ID=1 order by QCRecord_ID desc").Tables[0]; //赋值实时水分,这里有2条就显示2条,否则显示一条 if (wateDT.Rows.Count > 1) { string testItemB = wateDT.Rows[1]["TestItems_NAME"].ToString(); wate = wateDT.Rows[0]["QCRecord_RESULT"].ToString(); } else if (wateDT.Rows.Count == 1) { wate = wateDT.Rows[0]["QCRecord_RESULT"].ToString(); } if (testItem == "水分检测" || testItem == "拆包后水分检测" || testItem == "拆包前水分检测") { //状态为测水判断 state = "测水"; } //状态为分拣判断 if (testItem == "重量检测" || testItem == "废纸包重" || testItem == "杂质" || testItem == "杂纸") { state = "分拣"; } //状态为退货判断 if (testItem == "退货还包" || QcInfoDT.Rows[num1 + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "退货") { state = "退货"; } if (QcInfoDT.Rows[num1 + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "收货") { state = "收货"; } if (string.IsNullOrEmpty(BWeight)) { object objq = LinQBaseDao.GetSingle("select SUM(QCRecord_RESULT) from QCRecord where QCRecord_QCInfo_ID=" + QCInfo_ID + " and QCRecord_TestItems_ID=5"); if (objq != null) { BWeight = Convert.ToInt32(objq).ToString(); } } if (state == "测水") { if (string.IsNullOrEmpty(wate)) { if (BWeight == "" && PWeight == "" && MWeight == "") { break; } } } } switch (i) { //第三行 case 0: if (lblCarNoC.Text != CNTR_NO) { lblCarNoC.Text = CNTR_NO; } if (lblTypeC.Text != PROD_ID) { lblTypeC.Text = PROD_ID; } if (lblWaterC.Text != wate) { lblWaterC.Text = wate; } if (lblAVGC.Text != avgWate) { lblAVGC.Text = avgWate; } lblOC1.Text = BWeight; lblOC2.Text = PWeight; lblOC3.Text = MWeight; lblOC4.Text = state; break; case 1: if (lblCarNoD.Text != CNTR_NO) { lblCarNoD.Text = CNTR_NO; } if (lblTypeD.Text != PROD_ID) { lblTypeD.Text = PROD_ID; } if (lblWaterD.Text != wate) { lblWaterD.Text = wate; } if (lblAVGD.Text != avgWate) { lblAVGD.Text = avgWate; } lblOD1.Text = BWeight; lblOD2.Text = PWeight; lblOD3.Text = MWeight; lblOD4.Text = state; break; default: break; } } #endregion num1 += 2; if (!string.IsNullOrEmpty(qcid)) { Thread.Sleep(30000); } } } catch { } }
/// <summary> /// 加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LEDPreviewForm_Load(object sender, EventArgs e) { try { DataTable dts = LinQBaseDao.Query("select CarType_ID,CarType_DriSName from CarType where CarType_State='启动'").Tables[0]; if (dts.Rows.Count > 0) { for (int i = 0; i < dts.Rows.Count; i++) { int kk = Convert.ToInt32(LinQBaseDao.GetSingle("select count(0) from ManagementStrategy where ManagementStrategy_DriSName='" + dts.Rows[i][1].ToString() + "' and ManagementStrategy_ControlInfo_ID in(select ControlInfo_ID from ControlInfo where ControlInfo_Name='排队') and ManagementStrategy_State='启动' ").ToString()); if (kk == 0) { cartypeid += dts.Rows[i][0].ToString() + ","; } } } cartypeid = cartypeid.TrimEnd(','); //读取LED配置项 string sql = "select * from PositionLED where PositionLED_State='启动' and PositionLED_Position_ID=" + SystemClass.PositionID + ""; pled = PositionLEDDAL.GetLED(sql); //加载时将窗体显示位置修改到指定位置 int X = Convert.ToInt32(pled.PositionLED_X); int Y = Convert.ToInt32(pled.PositionLED_Y); this.Location = new Point(X, Y); fontsize = Convert.ToInt32(pled.PositionLED_FontSize); //判断当前门岗是否有LED的配置信息 if (pled.PositionLED_ID <= 0) { lbltishi.Visible = true; lblleixingting.Visible = false; lblleixingzhi.Visible = false; lblChePaiting.Visible = false; lblpaiduihaoting.Visible = false; lblMenGangting.Visible = false; lblTongDaoting.Visible = false; lbltishi.Text = "当前登录门岗\r\n暂无LED显示配置信息,\r\n请先配置对应门岗显示信息!!!"; return; } else { try { //读取配置的高宽(高度与宽度是反的) int weight = Convert.ToInt32(pled.PositionLED_ScreenWeight); int heifht = Convert.ToInt32(pled.PositionLED_ScreenHeight); this.Size = new Size(weight, heifht); //读取配置的字体颜色 string s = pled.PositionLED_Color; int cd = s.Length - 8; yanse = s.Substring(7, cd); if (pled.PositionLED_Type == 1) { timer1.Enabled = true; BindCountting(); BindTypeting(); Bindting(); } else if (pled.PositionLED_Type == 2) { lblhuanyingyu.Visible = true; lblleixingting.Visible = false; lblleixingzhi.Visible = false; lblChePaiting.Visible = false; lblpaiduihaoting.Visible = false; lblMenGangting.Visible = false; lblTongDaoting.Visible = false; lblhuanyingyu.Text = pled.PositionLED_Remark.ToString(); return; } } catch { //将类型的循环标识加1 typecountting = typecountting + 1; if (typecountting >= typeting) { typecountting = 0; } BindTypeting(); Bindting(); } } } catch { } }
/// <summary> /// 黑名单升级与降级 /// </summary> /// <param name="Id">车辆ID、驾驶员ID、公司ID</param> /// <param name="type">黑名单类型:1代表车,2代表驾驶员,3代表公司</param> /// <param name="isbool">true为升级,false为降级</param> /// <returns></returns> public static bool ISBacklist(int Id, int type, bool isbool) { bool retust = true; try { string strsql = ""; if (type == 1) { strsql = "select * from Blacklist where Blacklist_CarInfo_ID=" + Id; } else if (type == 2) { strsql = "select * from Blacklist where Blacklist_StaffInfo_ID=" + Id; } else { strsql = "select * from Blacklist where Blacklist_CustomerInfo_ID=" + Id; } DataTable dt = LinQBaseDao.Query(strsql).Tables[0]; if (dt.Rows.Count < 0) { return(retust = false); } int blacklistid = Convert.ToInt32(dt.Rows[0]["Blacklist_ID"].ToString()); string strDicid = dt.Rows[0]["Blacklist_Dictionary_ID"].ToString(); int upcount = Convert.ToInt32(dt.Rows[0]["Blacklist_UpgradeCount"].ToString()); //升级次数 int downcount = Convert.ToInt32(dt.Rows[0]["Blacklist_DowngradeCount"].ToString()); //降级次数 DataTable dtdic = LinQBaseDao.Query("select * from Dictionary where Dictionary_ID=" + strDicid).Tables[0]; int DicSpareint1 = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Spare_int1"].ToString()); //升级上限次数 int DicSpareint2 = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Spare_int2"].ToString()); //降级上限次数 int dicsort = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Sort"].ToString()); string otherid = dtdic.Rows[0]["Dictionary_OtherID"].ToString(); //升级 if (isbool) { upcount += 1; if (upcount >= DicSpareint1) { int strsort = Convert.ToInt32(LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID = " + otherid + "order by Dictionary_Sort desc").ToString()); if (dicsort > strsort) { string strstate = LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " and Dictionary_Sort=" + strsort + 1).ToString(); Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid; Action <Blacklist> ap = s => { s.Blacklist_State = strstate; s.Blacklist_Dictionary_ID = 5; s.Blacklist_UpgradeCount = upcount - DicSpareint1; }; if (BlacklistDAL.Update(p, ap)) { return(retust = true); } return(retust = false); } return(retust = false); } else { Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid; Action <Blacklist> ap = s => { s.Blacklist_UpgradeCount = upcount; }; BlacklistDAL.Update(p, ap); return(retust = false); } } else { downcount += 1; //降级 if (downcount >= DicSpareint2) { int strsort = Convert.ToInt32(LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " order by Dictionary_Sort desc").ToString()); if (dicsort > strsort) { string strstate = LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " and Dictionary_Sort=" + strsort + -1).ToString(); Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid; Action <Blacklist> ap = s => { s.Blacklist_State = strstate; s.Blacklist_Dictionary_ID = downcount - DicSpareint2; }; if (BlacklistDAL.Update(p, ap)) { return(retust = true); } return(retust = false); } return(retust = false); } else { Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid; Action <Blacklist> ap = s => { s.Blacklist_UpgradeCount = upcount; }; BlacklistDAL.Update(p, ap); return(retust = false); } } } catch { return(retust = false); } }
private void btnSave_Click(object sender, EventArgs e) { try { string Packets_this = ""; if (txtPack1.Text.Trim() != "") { Packets_this += txtPack1.Text.Trim() + ","; } if (txtPack2.Text.Trim() != "") { Packets_this += txtPack2.Text.Trim() + ","; } if (txtPack3.Text.Trim() != "") { Packets_this += txtPack3.Text.Trim() + ","; } if (txtPack4.Text.Trim() != "") { Packets_this += txtPack4.Text.Trim() + ","; } Packets_this = Packets_this.TrimEnd(','); string[] Packets_thisList = Packets_this.Split(','); string[] dtsList = lblPackets_DTS.Text.Split(','); foreach (string item in Packets_thisList) { foreach (string it in dtsList) { if (it == item) { MessageBox.Show("抽包号码“" + it + "”与DTS重复!"); return; } } } DataTable dtq = LinQBaseDao.Query("select QCInfo_ID from QCInfo where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text + " order by QCInfo_ID desc ").Tables[0]; if (dtq.Rows.Count > 0) { int moistcount = Convert.ToInt32(LinQBaseDao.GetSingle("select COUNT(0) from QCRecord where QCRecord_QCInfo_ID =" + dtq.Rows[0][0].ToString() + " and QCRecord_TestItems_ID in (1,3,4)")); if (moistcount > 0) { MessageBox.Show(this, "已开始测水,不能再抽包"); return; } } if (lblPackets_ID.Text.Trim() != "") { Expression <Func <Packets, bool> > fnP = n => n.Packets_ID == Convert.ToInt32(lblPackets_ID.Text.Trim()); Action <Packets> a = n => { n.Packets_this = Packets_this; }; if (PacketsDAL.Update(fnP, a)) { //抽包后修改qcinfo表 抽包总数和总抽包号 string bags = lblPackets_DTS.Text + "," + Packets_this; if (dtq.Rows.Count > 0) { Common.GetSumWaterCount(Convert.ToInt32(dtq.Rows[0][0].ToString())); LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + ",QCInfo_MOIST_Count=" + Common.SumWaterCount + " where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text); } else { LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + " where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text); } MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } LoadData(""); } } catch { } }
/// <summary> /// “修改” 按钮的单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { try { if (this.dgvDictioanry.SelectedRows.Count <= 0)//选中行 { MessageBox.Show("请选择要修改的项!"); return; } else { if (dgvDictioanry.SelectedRows.Count > 1) { MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { bool issystem = Convert.ToBoolean(LinQBaseDao.GetSingle("select Dictionary_IsSystem from Dictionary where Dictionary_ID=" + this.dgvDictioanry.SelectedRows[0].Cells["Dictionary_ID"].Value.ToString()).ToString()); if (issystem) { MessageBox.Show("不能修改系统数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // 定义变量保存 string strDictionaryName = this.txtDictionary_Name.Text.Trim(); string strDictionaryValue = this.txtDictionary_Value.Text.Trim(); // 开始验证 if (string.IsNullOrEmpty(strDictionaryName)) { MessageBox.Show("请您输入字典名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(strDictionaryValue)) { MessageBox.Show("请您输入字典值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } bool flag = true; if (this.comboxDictionary_State.Text.Trim() == "启动") { flag = true; } else { flag = false; } bool falg = true; if (this.comboxDictionary_IsLower.Text.Trim() == "是") { falg = true; } else { falg = false; } string other = "0"; if (this.comboxDictionary_OtherID.SelectedValue != null) { other = this.comboxDictionary_OtherID.SelectedValue.ToString(); } else { other = "0"; } if (!btnCheck()) { return; // 去重复 } Expression <Func <Dictionary, bool> > p = n => n.Dictionary_ID == int.Parse(this.dgvDictioanry.SelectedRows[0].Cells["Dictionary_ID"].Value.ToString()); string strfront = ""; string strContent = ""; Action <Dictionary> ap = s => { strfront = s.Dictionary_Name + "," + s.Dictionary_Value + "," + s.Dictionary_State + "," + s.Dictionary_OtherID + "," + s.Dictionary_ISLower + "," + s.Dictionary_Remark; s.Dictionary_Name = this.txtDictionary_Name.Text.Trim(); s.Dictionary_Value = this.txtDictionary_Value.Text.Trim(); s.Dictionary_State = flag; s.Dictionary_OtherID = int.Parse(other); s.Dictionary_ISLower = falg; s.Dictionary_Remark = this.txtDictionary_Remark.Text.Trim(); strContent = s.Dictionary_Name + "," + s.Dictionary_Value + "," + s.Dictionary_State + "," + s.Dictionary_OtherID + "," + s.Dictionary_ISLower + "," + s.Dictionary_Remark; }; if (DictionaryDAL.UpdateDictionary(p, ap)) { MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CommonalityEntity.WriteLogData("修改", "修改前:" + strfront + ";修改后:" + strContent, CommonalityEntity.USERNAME);//添加日志 } else { MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch { CommonalityEntity.WriteTextLog("字典管理 btnUpdate_Click()"); } finally { LogInfoLoad(""); BindDictionaryOther(); this.btnUpdate.Enabled = false; this.btnSave.Enabled = true; Empty(); // 调用清空的方法 } }