lu
16 小时以前 5e376d06404a16cb3c82a93cff351c5315bbcfe3
DevApp/Gs.DevApp/DevFrm/Work/Frm_Repair.cs
@@ -1,15 +1,11 @@
using DevExpress.XtraEditors;
using Gs.DevApp.Entity;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -17,7 +13,9 @@
{
    public partial class Frm_Repair : DevExpress.XtraEditors.XtraForm
    {
        string _webServiceName = "SysLog/";
        string _webServiceName = "WorkRepair/";
        string goodTag = "OK";
        string badTag = "NG";
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        public Frm_Repair()
        {
@@ -25,20 +23,41 @@
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, this, null, "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            }, tips);
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
                txt_barCode111.Text = "";
                getModel(value, "", "", "", "");
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
            });
            }, lbGuid);
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            txt_barCode111.KeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Enter) { getModel(lbGuid.Text.Trim(), "", "", "", ""); };
            };
            btnGood.Click += (s, e) =>
            {
                getModel(lbGuid.Text.Trim(), txt_badDescription.TextTxt, txt_repairReson.TextTxt.Trim(), txt_repairMethd.TextTxt.Trim(), goodTag);
            };
            btnBad.Click += (s, e) =>
            {
                getModel(lbGuid.Text.Trim(), txt_badDescription.TextTxt, txt_repairReson.TextTxt.Trim(), txt_repairMethd.TextTxt.Trim(), badTag);
            };
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
            _filterList = Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1);
@@ -88,7 +107,7 @@
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim());
                getModel(lbGuid.Text.Trim(), "", "", "", "");
            else
            {
                //_filterList.Clear();
@@ -110,8 +129,9 @@
        /// <param name="pageSize">每页几条</param>
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "OPERATION_TIME", "desc,ABT_HNO desc", "", _sbSqlWhere.ToString());
            txt_barCode111.Text = "";
            gcMain1.DataSource = null; var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "a.createDate", "desc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -145,19 +165,43 @@
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        private void getModel(string strGuid)
        /// <summary>
        /// 读取实体
        /// </summary>
        /// <param name="strGuid"></param>
        /// <param name="_badXx"></param>
        /// <param name="_badYy"></param>
        /// <param name="_badDc"></param>
        /// <param name="_checkResult"></param>
        private void getModel(string strGuid, string _badXx, string _badYy, string _badDc, string _checkResult)
        {
            bool isEdit = false;
            if (toolBarMenu1.currentAction == "add") return;
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            if (!string.IsNullOrEmpty(_checkResult))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
                string _reason = txt_repairReson.TextTxt.Trim();
                if (string.IsNullOrEmpty(_reason))
                {
                    Toast vm = new Toast(0, "不良原因不能为空!");
                    vm.Show();
                    return;
                };
                string _meth = txt_repairMethd.TextTxt.Trim();
                if (string.IsNullOrEmpty(_meth))
                {
                    Toast vm = new Toast(0, "不良对策不能为空!");
                    vm.Show();
                    return;
                };
            }
            string _barCode = txt_barCode111.Text.Trim();
            var _obj = new
            {
                guid = strGuid,//主建
                barCode = _barCode,
                badXx = _badXx,//不良现像
                badYy = _badYy, //不良原因
                badDc = _badDc, //不良对策
                checkResult = _checkResult, //检测结果
            };
            try
            {
@@ -167,14 +211,72 @@
                {
                    dynamic dy = _rtn.rtnData;
                    lbGuid.Text = strGuid;
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit);
                    UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, false);
                    lbSum1.Text = dy.lbSum1;
                    lbSum2.Text = dy.lbSum2;
                    lbSum3.Text = dy.lbSum3;
                    prog1.Position = dy.jd;
                    txt_barCode111.ReadOnly = false;
                    string _repairResult = dy.repairResult;
                    if (!string.IsNullOrEmpty(_repairResult))
                    {
                        txt_repairReson.IsReadly = true;
                        txt_repairMethd.IsReadly = true;
                    }
                    else {
                        txt_repairReson.IsReadly = false;
                        txt_repairMethd.IsReadly = false;
                    }
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
                    {
                        array.Add(a);
                    }
                    DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        gcMx1.BindingContext = new BindingContext();
                        gcMx1.DataSource = dt;
                        gcMx1.ForceInitialize();
                        gvMx1.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
                    }
                    JArray array2 = new JArray();
                    foreach (var a in _job["rtnData"]["list2"])
                    {
                        array2.Add(a);
                    }
                    DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString());
                    if (dt2.Rows.Count > 0)
                    {
                        gcMx2.BindingContext = new BindingContext();
                        gcMx2.DataSource = dt2;
                        gcMx2.ForceInitialize();
                        gvMx2.BestFitColumns();
                        Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx2);
                    }
                    else
                    {
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                    }
                    string _msg = _rtn.rtnMsg;
                    if (!string.IsNullOrEmpty(_msg))
                    {
                        Toast vm = new Toast(1, _msg);
                        vm.Show();
                    };
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
    }