fqc
lu
2025-04-09 4e8057788238516770131bb399bd39c2b0d70006
DevApp/Gs.DevApp/DevFrm/FQC/Frm_FqcDetect01Check.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -24,12 +25,12 @@
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            this.toolBarMenu1.btnChkClick += ToolBarMenu1_btnZhiLiangChkClick;
            this.toolBarMenu1.getXmlConfig();
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fsubmitTxt", "", (value) =>
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "modifyFlagTxt", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            }, tips);
@@ -44,36 +45,6 @@
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged;
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            txt_suppId.getSuppler("");
            txt_lineId.getSuppler("");
            txt_itemId.Click += (s, e) =>
            {
                string _lineId = txt_lineId.GetId();
                if (string.IsNullOrEmpty(_lineId))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请先选择产线!");
                    return;
                }
                var frm = new SelectFqcItem(_lineId);
                frm.UpdateParent += (ss, ee) =>
                {
                    try
                    {
                        var lst = new List<dynamic>();
                        lst = ee.DynamicList;
                        txt_itemId.Text = lst[0].itemId;
                        txt_itemModel.Text = lst[0].itemModel;
                        txt_itemName.Text = lst[0].itemName;
                        txt_itemNo.Text = lst[0].itemNo;
                        txt_lotNo.Text = lst[0].gdbh;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                };
                frm.ShowDialog();
            };
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
@@ -130,7 +101,7 @@
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 分页事件
        /// </summary>
@@ -178,63 +149,14 @@
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///提交检验事件
        /// 质量审核
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnJianYanClick(object sender, EventArgs e)
        private void ToolBarMenu1_btnZhiLiangChkClick(object sender, EventArgs e)
        {
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_releaseNo, gridView1, "lotNo");
            toolBarMenu1.guidKey = rowGuid;
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定提交检验吗?"))
                return;
            if (txt_fcheckResu.Text.Trim() == "不合格")
            {
                if (string.IsNullOrEmpty(txt_remarks.Text.Trim()))
                {
                    MsgHelper.Warning("单据为不合格时,请填写备注说明!");
                    return;
                }
            };
            var _obj = new
            {
                guid = rowGuid,
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "EditModelSubmit",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning("提示:" + _rtn.rtnData.outMsg);
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                    {
                        getModel(lbGuid.Text.Trim(), "0");
                    }
                    int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                    gridView1.FocusedRowHandle = rowHandle;
                    int _inFieldValue = 1;
                    UtilityHelper.SetCheckIco(gridView1, "fsubmitTxt", "", "iqcDate", picCheckBox, this, _inFieldValue.ToString());
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
            _toolCk(1);
        }
        /// <summary>
        /// 取消事件
        /// </summary>
@@ -245,7 +167,6 @@
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
        }
        /// <summary>
        /// 刷新事件
        /// </summary>
@@ -268,7 +189,7 @@
                getPageList(this.pageBar1.CurrentPage);
            }
        }
        /// <summary>
        /// 修改事件
        /// </summary>
@@ -307,75 +228,94 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            string _txt_djType = txt_djType.Text.Trim();
            string _txt_fbatchQty = txt_fbatchQty.Text.Trim();
            string _txt_lifnr = txt_lifnr.Text.Trim();
            string _txt_suppId = txt_suppId.GetId();
            string _txt_lineId = txt_lineId.GetId();
            string _txt_itemId = txt_itemId.Text.Trim();
            string _txt_remarks = txt_remarks.Text.Trim();
            string _txt_workNo = txt_workNo.GetCode();
            string _txt_epTag = txt_epTag.Text.Trim();
            string _freceQty = txt_freceQty.Text.Trim();
            string _txt_fngHandle = txt_fngHandle.Text.Trim();
            string _txt_fmrmode = txt_fmrmode.GetCode();
            string _txt_fzrId = txt_fzrId.GetId();
            string _txt_workNo = txt_workNo.Text.Trim();
            string _txt_msg = txt_msg.TextTxt;
            string _txt_fmanageNo = txt_fmanageNo.Text.Trim();
            string _txt_lotNo2 = txt_lotNo2.Text.Trim();
            string _txt_lotNo1 = txt_lotNo1.Text.Trim();
            string _txt_lotNo = txt_lotNo.Text.Trim();
            if (txt_djType.SelectedIndex <= 0)
            string _txt_zrType=txt_zrType.Text.Trim();
            if (txt_freceQty.SelectedIndex <= 0)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("单据类型不能为空!");
                txt_djType.Focus();
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择判定结果!");
                txt_freceQty.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_txt_fbatchQty.Trim()))
            //当为不合格时,要选择处置结果
            if (txt_freceQty.SelectedIndex != 1)
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("抽检数量不能为空!");
                txt_fbatchQty.Focus();
                return;
                if (txt_fngHandle.SelectedIndex <= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择处置结果!");
                    txt_fngHandle.Focus();
                    return;
                }
                if (_txt_fzrId.Length<= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择责任人!");
                    txt_fzrId.Focus();
                    return;
                }
                if (txt_zrType.SelectedIndex <= 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("请选择责任判定!");
                    txt_zrType.Focus();
                    return;
                }
                //当处置结果为反工时,要选择工序和反工编号
                if (txt_fngHandle.SelectedIndex == 1)
                {
                    if (string.IsNullOrEmpty(_txt_workNo))
                    {
                        Gs.DevApp.ToolBox.MsgHelper.Warning("请填写反工单号!");
                        txt_workNo.Focus();
                        return;
                    }
                    if (string.IsNullOrEmpty(_txt_fmrmode))
                    {
                        Gs.DevApp.ToolBox.MsgHelper.Warning("请填选择反工工序!");
                        txt_fmrmode.Focus();
                        return;
                    }
                }
                else {
                    if (!string.IsNullOrEmpty(_txt_workNo))
                    {
                        Gs.DevApp.ToolBox.MsgHelper.Warning("不需要填写反工单号!");
                        txt_workNo.Focus();
                        return;
                    }
                    if (!string.IsNullOrEmpty(_txt_fmrmode))
                    {
                        Gs.DevApp.ToolBox.MsgHelper.Warning("不需要选择反工工序!");
                        txt_fmrmode.Focus();
                        return;
                    }
                }
            }
            if (string.IsNullOrEmpty(_txt_lineId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("产线不能为空!");
                txt_lineId.Focus();
                return;
            //当为合格时,就不应该选择其它项目了
            else {
                if (( _txt_fmrmode.Length + _txt_fzrId.Length + _txt_workNo.Length) > 0  || txt_zrType.SelectedIndex>0 || txt_fngHandle.SelectedIndex > 0)
                {
                    Gs.DevApp.ToolBox.MsgHelper.Warning("当判定结果为合格时,就不应该选择其它项目了!");
                    txt_freceQty.Focus();
                    return;
                }
            }
            if (string.IsNullOrEmpty(_txt_itemId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("产品不能为空!");
                txt_itemId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_txt_itemId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("产品不能为空!");
                txt_itemId.Focus();
                return;
            }
            if (string.IsNullOrEmpty(_txt_lotNo.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("工单号不能为空!");
                txt_lotNo.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                djType = _txt_djType,
                fbatchQty = _txt_fbatchQty,
                lifnr = _txt_lifnr,
                suppId = _txt_suppId,
                lineId = _txt_lineId,
                itemId = _txt_itemId,
                remarks = _txt_remarks,
                workNo = _txt_workNo,
                epTag = _txt_epTag,
                freceQty = _freceQty,
                fngHandle = _txt_fngHandle,
                fzrId = _txt_fzrId,
                workNo = _txt_workNo,
                fmrmode = _txt_fmrmode,
                msg = _txt_msg,
                fmanageNo = _txt_fmanageNo,
                lotNo2 = _txt_lotNo2,
                lotNo1 = _txt_lotNo1,
                lotNo = _txt_lotNo
                zrType= _txt_zrType,
                edtType = 1
            };
            try
            {
@@ -385,7 +325,6 @@
                if (_rtn.rtnCode > 0)
                {
                    lbGuid.Text = _rtn.rtnData.outGuid;
                    txt_releaseNo.Text = _rtn.rtnData.outNo;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false);
                    this.setEable(false);
@@ -407,7 +346,7 @@
        private void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            // _sbSqlWhere += " and isnull(fsubmit,0)=0";
            _sbSqlWhere += " and isnull(fsubmit,0)=1";
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
@@ -566,5 +505,80 @@
            //btnLoad.Enabled = bl;
            //btnIpt.Text = (bl == true ? "录入样本" : "查看样本");
        }
        /// <summary>
        /// 工具条事件
        /// </summary>
        /// <param name="inFieldValue"></param>
        private void _toolCk(int _inFieldValue)
        {
            string strMsg = "";
            switch (_inFieldValue)
            {
                case 1:
                    strMsg = "审核";
                    break;
            };
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?"))
                return;
            if (_inFieldValue == 1)
            {
                if (txt_fcheckResu.Text == "不合格")
                {
                    //if (txt_fngHandle.Text.Trim().Length == 0)
                    //{
                    //    MsgHelper.Warning("单据为不合格时请选择处理方式!");
                    //    return;
                    //}
                }
            }
            var _obj = new
            {
                guid = rowGuid,
                inFieldValue = _inFieldValue,
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "EditModelSubmitZhiLiang",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0)
                {
                    if (_inFieldValue >= 0)
                    {
                        if (xtraTabControl1.SelectedTabPageIndex == 1)
                        {
                            getModel(lbGuid.Text.Trim(), "0");
                        }
                        int rowHandle = gridView1.LocateByValue(1, gridView1.Columns["guid"], rowGuid);
                        gridView1.FocusedRowHandle = rowHandle;
                        UtilityHelper.SetCheckIco(gridView1, "modifyFlagTxt", "modify1By", "modify1Date", picCheckBox, this, _inFieldValue.ToString());
                    }
                    else
                    {
                        //if (xtraTabControl1.SelectedTabPageIndex == 1)
                        //    getModel(lbGuid.Text.Trim());
                        //else
                        //    getPageList(this.pageBar1.CurrentPage);
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
                        getPageList(this.pageBar1.CurrentPage);
                    }
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
    }
}