lu
2025-04-01 f121cd2803748763d7abb9509e049bd6e62e8844
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -1,18 +1,13 @@
using DevExpress.Utils.DirectXPaint;
using DevExpress.XtraBars.Alerter;
using DevExpress.XtraBars.Alerter;
using DevExpress.XtraBars.ToastNotifications;
using DevExpress.XtraEditors;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
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;
namespace Gs.DevApp.DevFrm.Work
@@ -20,22 +15,38 @@
    public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm
    {
        string _webServiceName = "WorkCollect/";
        public Frm_Work01()
        string fGx = "";
        string fBc = "";
        public Frm_Work01(string _fGx, string _fBc)
        {
            InitializeComponent();
            this.fGx = _fGx;
            this.fBc = _fBc;
            txt_gx.Text = fGx;
            txt_bc.Text = fBc;
            txt_barCode.KeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Enter) { getModel(); };
                if (e.KeyCode == Keys.Enter) { getModel("", ""); };
            };
            btnGood.Click += (s, e) =>
            {
                getModel("", "√");
            };
            btnBad.Click += (s, e) => {
                getModel("", "×");
            };
        }
        private void getModel()
        /// <summary>
        ///
        /// </summary>
        /// <param name="_checkVal">检测值</param>
        /// <param name="_checkResult">检测结果</param>
        private void getModel(string _checkVal, string _checkResult)
        {
            string _barCode =txt_barCode.Text.Trim();
            //string _guid = "";
            string _barCode = txt_barCode.Text.Trim();
            string _inBz = ""; ; //备注
            string _checkVal = ""; ; //检测值
            string _checkResult = ""; ; //检测结果
            if (string.IsNullOrEmpty(_barCode))
            {
                ToolBox.MsgHelper.ShowError("请先扫码!");
@@ -43,11 +54,13 @@
            }
            var _obj = new
            {
              //  guid = _guid,
                barCode = _barCode,
                inBz = _inBz,
                checkVal = _checkVal,
                checkResult = _checkResult,
                processNo = txt_gx.Text.Trim(),//工序
                banCi = txt_bc.Text.Trim(),//班次
                gongWei = txt_gw.Text.Trim(),//工位
            };
            try
            {
@@ -56,6 +69,13 @@
                if (_rtn.rtnCode > 0)
                {
                    dynamic dy = _rtn.rtnData;
                    txt_gdbh.Text = dy.gdbh;
                    txt_itemNo.Text = dy.itemNo;
                    txt_itemName.Text = dy.itemName;
                    txt_itemModel.Text = dy.itemModel;
                    txt_sjXt.Text = dy.sjXt;
                    txt_sjDate.Text = dy.sjDate;
                    txt_yjDate.Text = dy.yjDate;
                    JObject _job = JObject.Parse(strJson);
                    JArray array = new JArray();
                    foreach (var a in _job["rtnData"]["list"])
@@ -94,22 +114,25 @@
                        Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2);
                    }
                    string _msg = _rtn.rtnMsg;
                    //设置单窗口出现弹出的速度
                    this.alertControl1.FormDisplaySpeed = DevExpress.XtraBars.Alerter.AlertFormDisplaySpeed.Fast;
                    //设置显示多少时间窗口会自动关闭 以毫秒为单位
                    this.alertControl1.AutoFormDelay = 3000;
                    //设置提出窗口的显示的位置
                    this.alertControl1.FormLocation = DevExpress.XtraBars.Alerter.AlertFormLocation.BottomRight;
                    this.alertControl1.Show(this, "提示!", _msg);
                    if (!string.IsNullOrEmpty(_msg))
                    {
                        //设置单窗口出现弹出的速度
                        this.alertControl1.FormDisplaySpeed = DevExpress.XtraBars.Alerter.AlertFormDisplaySpeed.Fast;
                        //设置显示多少时间窗口会自动关闭 以毫秒为单位
                        this.alertControl1.AutoFormDelay = 3000;
                        //设置提出窗口的显示的位置
                        this.alertControl1.FormLocation = DevExpress.XtraBars.Alerter.AlertFormLocation.BottomLeft;
                        this.alertControl1.Show(this, "提示!", _msg);
                    };
                }
                else
                    ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    ToolBox.MsgHelper.ShowError("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.Warning("提示:" + ex.Message);
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
    }
}