| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmBcPipeManage.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.YdmBcPipeManage
- {
- public partial class FrmScrapApplyFrim : FrmBase
- {
- public FrmScrapApplyFrim()
- {
- InitializeComponent();
- }
- private void FrmScrapApplyFrim_Load(object sender, EventArgs e)
- {
- DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- this.StartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- EntityHelper.ShowGridCaption<YdmBcScrapfrimEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- initDepartMent();
- }
- /// <summary>
- /// 所属权
- /// </summary>
- private void initDepartMent()
- {
- DataTable ds = ServerHelper.GetData("com.steering.ydm.bc.FrmDeleteMatBcM.doQueryDepartM", new object[] { }, ob);
- if (ds.Rows.Count > 0)
- {
- this.cmbDepartMent.DataSource = ds;
- cmbDepartMent.DisplayMember = "DEPARTMENT_NAME_P";
- cmbDepartMent.ValueMember = "DEPARTMENT_CODE_P";
- }
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- doQuery();
- break;
- case "FrimScarpApply":
- frimScarpApply();
- break;
- case "FrimScarpApplyNot":
- frimScarpApplyNot();
- break;
- case "CancelFrimScarpApply":
- cancelFrimScrapApply();
- break;
- case "Export":
- exportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
-
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string bathYear = "";
- string txtJudgeNo = "";
- string startTime = "";
- string endTim = "";
- if (this.chkTim.Checked)
- {
- bathYear = this.StartTime.Value.ToString("yyyyMM");
- }
- if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "")
- {
- txtJudgeNo = this.txtJugeNo.Text.Trim();
- }
- if (this.chkRegTime.Checked)
- {
- startTime = this.RegStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- endTim = this.RegEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
- }
- ArrayList parmList = new ArrayList();
- parmList.Add(bathYear);
- parmList.Add(txtJudgeNo);
- parmList.Add(startTime);
- parmList.Add(endTim);
-
- List<YdmBcScrapfrimEntity> listSource = EntityHelper.GetData<YdmBcScrapfrimEntity>(
- "com.steering.ydm.bc.FrmScrapApplyFrim.doQueryApply", new object[] { parmList, ultraOptionSet1.CheckedItem.DataValue.ToString(), this.CustomInfo, this.ValidDataPurviewIds }, this.ob);
- foreach(YdmBcScrapfrimEntity YdmBcScrapfrimEntity in listSource)
- {
- if (String.IsNullOrWhiteSpace(YdmBcScrapfrimEntity.FrimTime))
- {
- YdmBcScrapfrimEntity.TimeDiffe = "0.0天";
- }
- else {
- TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(YdmBcScrapfrimEntity.FrimTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture).Ticks);
- TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(YdmBcScrapfrimEntity.CreateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture).Ticks);
- YdmBcScrapfrimEntity.TimeDiffe = ts1.Subtract(ts2).TotalDays.ToString("0.0") + "天";
- }
- }
- ydmBcScrapfrimEntityBindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 审核
- /// </summary>
- private void frimScarpApply()
- {
- this.ultraGrid2.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要审核的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- YdmBcScrapfrimEntity matBcEntity = (YdmBcScrapfrimEntity)row.ListObject;
- matBcEntity.BelongCodeResponse = row.Cells["BelongCodeResponse"].Value.ToString();
- matBcEntity.BelongNameResponse = row.Cells["BelongCodeResponse"].Text;
- matBcEntity.FrimName = UserInfo.GetUserName();
- if (matBcEntity.BelongCodeResponse == "")
- {
- MessageUtil.ShowTips("审核时请确定责任单位!");
- return;
- }
- string ydmFrimEntity = JSONFormat.Format(matBcEntity);
- parmList.Add(ydmFrimEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmScrapApplyFrim";
- ccp.MethodName = "frimScarpApply";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("审核成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 审核不通过
- /// </summary>
- private void frimScarpApplyNot()
- {
- this.ultraGrid2.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要审核的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- YdmBcScrapfrimEntity matBcEntity = (YdmBcScrapfrimEntity)row.ListObject;
- matBcEntity.FrimName = UserInfo.GetUserName();
- string ydmFrimEntity = JSONFormat.Format(matBcEntity);
- parmList.Add(ydmFrimEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmScrapApplyFrim";
- ccp.MethodName = "frimScarpApplyNot";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("审核成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销废品的审核
- /// </summary>
- private void cancelFrimScrapApply()
- {
- this.ultraGrid2.UpdateData();
- string date = DateTime.Now.ToString("yyyyMM");
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要撤销审核的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- YdmBcScrapfrimEntity matBcEntity = (YdmBcScrapfrimEntity)row.ListObject;
- string ydmFrimEntity = JSONFormat.Format(matBcEntity);
- parmList.Add(ydmFrimEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmScrapApplyFrim";
- ccp.MethodName = "cancelFrimScrapApply";
- ccp.ServerParams = new object[] { parmList, date };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void exportData()
- {
- GridHelper.ulGridToExcel(ultraGrid2, "已审核废品数据汇总");
- }
- private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked;
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow uRow = this.ultraGrid2.ActiveRow;
- if (uRow.Cells["CraftNo"].Text.Trim() == "" || uRow.Cells["CraftPath"].Text.Trim() == "")
- {
- return;
- }
- BaseMethod.ViewCarft_No(uRow.Cells["CraftPath"].Text.Trim());
- }
- }
- }
|