雅琪诺MES智能条码管理系统
zgq
2021-01-20 efe6576abc12737e898ead7b5d2307cf90faee58
Merge branch 'master' of http://101.37.171.70:10101/r/YqnMes
3个文件已修改
680 ■■■■■ 已修改文件
SCM.sln 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SCM/单据资料/Gy_BarCodeDetailList.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SCM/单据资料/Sc_ICMOReportToBarCode.cs 652 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SCM.sln
@@ -13,8 +13,6 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{1EAB90A5-F2E0-4E1F-A787-ABE182EDB86E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DBUtility", "DBUtility\DBUtility.csproj", "{F2098F1B-4FA1-49BB-91EA-AB3522008F28}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
@@ -80,18 +78,6 @@
        {1EAB90A5-F2E0-4E1F-A787-ABE182EDB86E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
        {1EAB90A5-F2E0-4E1F-A787-ABE182EDB86E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
        {1EAB90A5-F2E0-4E1F-A787-ABE182EDB86E}.Release|x86.ActiveCfg = Release|Any CPU
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|Mixed Platforms.Build.0 = Debug|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|x86.ActiveCfg = Debug|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Debug|x86.Build.0 = Debug|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|Any CPU.Build.0 = Release|Any CPU
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|Mixed Platforms.ActiveCfg = Release|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|Mixed Platforms.Build.0 = Release|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|x86.ActiveCfg = Release|x86
        {F2098F1B-4FA1-49BB-91EA-AB3522008F28}.Release|x86.Build.0 = Release|x86
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
SCM/µ¥¾Ý×ÊÁÏ/Gy_BarCodeDetailList.cs
@@ -64,18 +64,8 @@
                whereBuilder.Append(" and d.FNUMBER like ''%"+textBox1.Text+"%''");
            if (!string.IsNullOrEmpty(textBox2.Text))
                whereBuilder.Append(" and b.FLOT_TEXT like ''%"+textBox2.Text+"%''");
            if (comboBox1.Text != "全部")
            {
                if(comboBox1.Text=="合格品")
                {
                    whereBuilder.Append(" and c.HProdLev=''''");
                }
                else
                {
                    whereBuilder.Append(" and c.HProdLev=''" + comboBox1.Text + "''");
                }
            }
            if(comboBox1.Text!="全部")
                whereBuilder.Append(" and c.HProdLev=''" + comboBox1.Text+"''");
            if (!string.IsNullOrEmpty(textBox4.Text))
                whereBuilder.Append(" and g.HName like ''%"+textBox4.Text+"%''");
            if (!string.IsNullOrEmpty(textBox5.Text))
SCM/µ¥¾Ý×ÊÁÏ/Sc_ICMOReportToBarCode.cs
@@ -1,5 +1,4 @@
<<<<<<< HEAD
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -69,7 +68,7 @@
            oWeb.Url = SCM.ClsPub1.WEBSURL;
            //
            frmCondition = new frmBillQueryCondition_Base();
            this.Text = ModCaption;
            this.Text = ModCaption;
            oSumGrid.ogrdMain = grdSub;  //初始化 new
            oSumGrid.oGridsum = grdSum;
            initGrid();
@@ -78,7 +77,7 @@
            cmbFQMB.Items.Add(this.Text);
            cmbFQMB.SelectedIndex = 0;
            if(DBUtility.ClsPub.CurUserName.ToLower()=="admin")
            if (DBUtility.ClsPub.CurUserName.ToLower() == "admin")
            {
                txtHDQQty.ReadOnly = false;
                txtHKSQty.ReadOnly = false;
@@ -115,7 +114,7 @@
        //时间控件
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled=false;
            timer1.Enabled = false;
            Sub_ClearBill();
        }
@@ -123,7 +122,7 @@
        {
            timer2.Enabled = false;
            //
            if (ClsIni.ReadIni("COMINFO", "txtPortName", DBUtility.ClsPub.AppPath + @"/HXERP.ini").Contains("没有找到")==false)
            if (ClsIni.ReadIni("COMINFO", "txtPortName", DBUtility.ClsPub.AppPath + @"/HXERP.ini").Contains("没有找到") == false)
            {
                txtPortName.Text = ClsIni.ReadIni("COMINFO", "txtPortName", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtBaudRate.Text = ClsIni.ReadIni("COMINFO", "txtBaudRate", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
@@ -245,7 +244,7 @@
                txtHSYQty.Text = oTable.Rows[0]["未生成条码数量"].ToString();
                txtHKSQty.Text = lblHNowQty.Text;
                txtHDQQty.Text = lblHNowQty.Text;
                if (DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text)>0)
                if (DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text) > 0)
                {
                    txtHSJQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text), 1);
                }
@@ -256,7 +255,7 @@
                DisplayMain();
                //DisplaySub();
            }
            catch(Exception e)
            catch (Exception e)
            {
                MessageBox.Show("读取失败!" + e.Message);
            }
@@ -269,7 +268,7 @@
            string sSql = "";
            string sWhere = "";
            //过滤条件 
            sSql = " exec h_p_Sc_ICMOReportToBarCode_All   '" + HSourceBillTypeID + "'," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString();
            sSql = " exec h_p_Sc_ICMOReportToBarCode_All   '" + HSourceBillTypeID + "'," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString();
            //
            DSet = oWeb.getDataSetBySQL(sSql, "h_p_Sc_ICMOReportToBarCode_All", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
@@ -279,7 +278,7 @@
                return;
            }
            //
            if (DSet.Tables[0].Rows.Count>0)
            if (DSet.Tables[0].Rows.Count > 0)
            {
                grdMain.DataSource = DSet.Tables[0].DefaultView;
            }
@@ -298,7 +297,7 @@
            ClsPub1.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol);
            /////////////////////////////
            txtHRelationQty.Text = DBUtility.ClsPub.isDoule(DSet.Tables[2].Rows[0]["关联数量"], 1);
            if(DBUtility.ClsPub.isDoule(txtHSumQty.Text) - DBUtility.ClsPub.isDoule(txtHRelationQty.Text)>=0)
            if (DBUtility.ClsPub.isDoule(txtHSumQty.Text) - DBUtility.ClsPub.isDoule(txtHRelationQty.Text) >= 0)
            {
                txtHSYQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHSumQty.Text) - DBUtility.ClsPub.isDoule(txtHRelationQty.Text), 1);
            }
@@ -316,7 +315,7 @@
            string sWhere = "";
            //过滤条件 
            sSql = " exec h_p_Sc_ICMOReportToBarCode_Sub   '" + HSourceBillTypeID + "'," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString();
            //
            DSet = oWeb.getDataSetBySQL(sSql, "h_p_Sc_ICMOReportToBarCode_Sub", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
@@ -348,12 +347,12 @@
        //预览
        int CurRows = 0;
        #endregion
@@ -367,11 +366,11 @@
            if (oDept.RefreshView(sWhere))
            {
                this.txtHDeptID.Text = oDept.oModel.HName;
                this.txtHDeptID.Tag = oDept.oModel.HItemID.ToString();
                this.txtHDeptID.Tag = oDept.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHDeptID.Text = "";
                this.txtHDeptID.Text = "";
            }
        }
@@ -518,19 +517,19 @@
                //    cmdHSaveBill.Enabled = true;
                //    return false;
                //}
                if (DBUtility.ClsPub.isLong(txtHEmpID.Tag) == 0 || DBUtility.ClsPub.isLong(txtHEmpID2.Tag) == 0 )
                if (DBUtility.ClsPub.isLong(txtHEmpID.Tag) == 0 || DBUtility.ClsPub.isLong(txtHEmpID2.Tag) == 0)
                {
                    MessageBox.Show("职员1或者职员2没有选择!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                if (DBUtility.ClsPub.isLong(txtHGroupID.Tag) == 0 )
                if (DBUtility.ClsPub.isLong(txtHGroupID.Tag) == 0)
                {
                    MessageBox.Show("班组没有选择!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                //根据源单 ç”Ÿæˆæ¡å½¢ç  å¹¶ä¿å­˜å¦‚数据库
                HNumber = DBUtility.ClsPub.isStrNull(txtHMaterName.Tag);
@@ -540,549 +539,6 @@
                sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
                sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
                sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
=======
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using gregn6Lib;
using Pub_Class;
using System.Threading;
using System.IO.Ports;
namespace SCM
{
    public partial class Sc_ICMOReportToBarCode : Form
    {
        public Sc_ICMOReportToBarCode()
        {
            InitializeComponent();
        }
        public frmBillQueryCondition_Base frmCondition;
        public string ModCaption = "成品分切在线检验";
        public string ModName = "Sc_ICMOReportToBarCode";
        public string HSourceBillTypeID = "";   //单据类型
        public string HSourceBillType = "";     //单据类型名称
        public string HSourceBillNo = "";
        public Int64 HSourceInterID = 0;
        public Int64 HSourceEntryID = 0;
        public int HTMCol = 0;
        public int HMaterIDCol = 1;
        Pub_Class.ClsGridListSum oSumGrid = new Pub_Class.ClsGridListSum();
        public Int32 iTopRow = 0;//画横线
        SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
        //
        #region  å›ºå®šä»£ç 
        //清空界面
        public void Sub_ClearBill()
        {
            //清空界面控件 for æŽ§ä»¶
            foreach (Control ct in gbUp.Controls)
            {
                switch (ct.GetType().Name)
                {
                    case "ComboBox":
                        ((ComboBox)ct).SelectedIndex = 0;
                        break;
                    case "TextBox":
                        ((TextBox)ct).Text = "";
                        break;
                    case "DateTimePicker":
                        ((DateTimePicker)ct).Value = DateTime.Today;
                        break;
                    default:
                        break;
                }
            }
            //
            txtHMaker.Text = ClsPub.CurUserName;
            initGrid();
        }
        private void Sc_ICMOReportToBarCode_Load(object sender, EventArgs e)
        {
            //设置动态URL
            oWeb.Url = SCM.ClsPub1.WEBSURL;
            //
            frmCondition = new frmBillQueryCondition_Base();
            this.Text = ModCaption;
            oSumGrid.ogrdMain = grdSub;  //初始化 new
            oSumGrid.oGridsum = grdSum;
            initGrid();
            //cmbHBillType.SelectedIndex = 0;
            //cmbHSourceBillType.SelectedIndex = 0;
            cmbFQMB.Items.Add(this.Text);
            cmbFQMB.SelectedIndex = 0;
            if(DBUtility.ClsPub.CurUserName.ToLower()=="admin")
            {
                txtHDQQty.ReadOnly = false;
                txtHKSQty.ReadOnly = false;
            }
        }
        //初始化网格
        private void initGrid()
        {
            ClsPub1.initGridList(grdMain, this.Name);
            ClsPub1.initGridList(grdSub, this.Name + "grdSub");
            ClsPub1.initGridFst(grdEmp, this.Name + "grdEmp");
            grdMain.RowTemplate.Height = 30;
            grdMain.RowTemplate.MinimumHeight = 30;
            grdMain.RowsDefaultCellStyle.Font = new Font("宋体", 15);
            grdMain.ReadOnly = true;
            grdSub.RowTemplate.Height = 30;
            grdSub.RowTemplate.MinimumHeight = 30;
            grdSub.RowsDefaultCellStyle.Font = new Font("宋体", 15);
            grdSub.ReadOnly = true;
            grdEmp.RowTemplate.Height = 30;
            grdEmp.RowTemplate.MinimumHeight = 30;
            grdEmp.RowsDefaultCellStyle.Font = new Font("宋体", 15);
            grdEmp.ReadOnly = false;
            //DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name);
            //DBUtility.Xt_BaseBillFun.initGridList(grdSub, this.Name + "grdSub");
            DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
            DBUtility.Xt_BaseBillFun.GetGrid(grdSub, this.Name + "grdSub");
            DBUtility.Xt_BaseBillFun.GetGrid(grdEmp, this.Name + "grdEmp");
        }
        //时间控件
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled=false;
            Sub_ClearBill();
        }
        private void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Enabled = false;
            //
            if (ClsIni.ReadIni("COMINFO", "txtPortName", DBUtility.ClsPub.AppPath + @"/HXERP.ini").Contains("没有找到")==false)
            {
                txtPortName.Text = ClsIni.ReadIni("COMINFO", "txtPortName", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtBaudRate.Text = ClsIni.ReadIni("COMINFO", "txtBaudRate", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                cmbParity.Text = ClsIni.ReadIni("COMINFO", "cmbParity", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtDataBits.Text = ClsIni.ReadIni("COMINFO", "txtDataBits", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                cmbStopBits.Text = ClsIni.ReadIni("COMINFO", "cmbStopBits", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtHSend0.Text = ClsIni.ReadIni("COMINFO", "txtHSend0", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtHSend.Text = ClsIni.ReadIni("COMINFO", "txtHSend", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtHSourceID.Text = ClsIni.ReadIni("COMINFO", "txtHSourceID", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                txtHSourceID.Tag = ClsIni.ReadIni("COMINFO", "txtHSourceIDTag", DBUtility.ClsPub.AppPath + @"/HXERP.ini");
                this.Text = this.Text + "-" + txtHSourceID.Text;
            }
            //初始化串口
            ComDevice = new SerialPort();
            ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived);//绑定事件
            string[] PortNames = SerialPort.GetPortNames();
            //打开串口
            OpenCom();
        }
        //退出
        private void tc_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private void grdMain_Paint(object sender, PaintEventArgs e)
        {
            GraphicsGrid();
        }
        private void GraphicsGrid()
        {
            //画底线
            DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
            //画横线
            DBUtility.Xt_BaseBillFun.GraphicsRowGrid(grdMain, iTopRow, iTopRow + 50, Fun_GetCol("hmainid"));
        }
        private Int32 Fun_GetCol(string sCol)
        {
            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
        }
        //保存列宽
        private void bclk_Click(object sender, EventArgs e)
        {
            DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
            DBUtility.Xt_BaseBillFun.SaveGrid(grdSub, this.Name + "grdSub");
            DBUtility.Xt_BaseBillFun.SaveGrid(grdEmp, this.Name + "grdEmp");
        }
        //默认列宽
        private void mrlk_Click(object sender, EventArgs e)
        {
            DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
            DBUtility.Xt_BaseBillFun.DefaultGridView(grdSub, this.Name + "grdSub");
            DBUtility.Xt_BaseBillFun.DefaultGridView(grdEmp, this.Name + "grdEmp");
        }
        #endregion
        #region è¿”回源单信息
        private void xd_Click(object sender, EventArgs e)
        {
        }
        private void Display(string SourceBillType, Int64 HSourceBillInterID, Int64 HSourceBillEntryID)
        {
            DataSet Ds;
            //生产订单
            if (SourceBillType == "生产订单")
            {
                //得到信息
                Ds = oWeb.getDataSetBySQL("select * from h_v_IFCLD_ICMOList where hmainid=" + HSourceBillInterID + " and hsubid=" + HSourceBillEntryID, "h_v_IFCLD_ICMOList", ref DBUtility.ClsPub.sExeReturnInfo);
                //写入信息
                Sub_WriteInForm(Ds.Tables[0], 0);
            }
            //收料通知单
            if (SourceBillType == "收料通知单")
            {
                //得到信息
                Ds = oWeb.getDataSetBySQL("select * from h_v_IF_POInStockList where hmainid=" + HSourceBillInterID + " and hsubid=" + HSourceBillEntryID, "h_v_IF_POInStockList", ref DBUtility.ClsPub.sExeReturnInfo);
                //写入信息
                Sub_WriteInForm(Ds.Tables[0], 0);
            }
            //生产汇报单
            if (SourceBillType == "生产汇报单")
            {
                //得到信息
                Ds = oWeb.getDataSetBySQL("select * from h_v_IF_ICMOReportBillList where hmainid=" + HSourceBillInterID + " and hsubid=" + HSourceBillEntryID, "h_v_IF_POInStockList", ref DBUtility.ClsPub.sExeReturnInfo);
                //写入信息
                Sub_WriteInForm(Ds.Tables[0], 0);
            }
        }
        //根据TABLE写入界面
        private void Sub_WriteInForm(DataTable oTable, int i)
        {
            try
            {
                txtHSourceBillNo.Text = oTable.Rows[0]["单据号"].ToString();
                txtHMaterNumber.Text = oTable.Rows[0]["物料代码"].ToString();
                txtHOldMaterNumber.Text = oTable.Rows[0]["旧物料编码"].ToString();
                txtHMaterNumber.Tag = oTable.Rows[0]["HMaterID"].ToString();
                txtHMaterName.Text = oTable.Rows[0]["物料名称"].ToString();
                txtHMaterName.Tag = oTable.Rows[0]["HMaterID"].ToString();
                txtHMaterModel.Text = oTable.Rows[0]["规格型号"].ToString();
                txtHUnitName.Text = oTable.Rows[0]["计量单位"].ToString();
                txtHUnitName.Tag = oTable.Rows[0]["HUnitID"].ToString();
                txtHBatchNo.Text = oTable.Rows[0]["批次"].ToString();
                txtHSumQty.Text = oTable.Rows[0]["数量"].ToString();
                txtHRelationQty.Text = oTable.Rows[0]["已生成条码数量"].ToString();
                txtHSYQty.Text = oTable.Rows[0]["未生成条码数量"].ToString();
                txtHKSQty.Text = lblHNowQty.Text;
                txtHDQQty.Text = lblHNowQty.Text;
                if (DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text)>0)
                {
                    txtHSJQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text), 1);
                }
                else
                {
                    txtHSJQty.Text = "0";
                }
                DisplayMain();
                //DisplaySub();
            }
            catch(Exception e)
            {
                MessageBox.Show("读取失败!" + e.Message);
            }
        }
        private void DisplayMain()
        {
            DataSet DSet;
            string sSql = "";
            string sWhere = "";
            //过滤条件
            sSql = " exec h_p_Sc_ICMOReportToBarCode_All   '" + HSourceBillTypeID + "'," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString();
            //
            DSet = oWeb.getDataSetBySQL(sSql, "h_p_Sc_ICMOReportToBarCode_All", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DSet == null)
            {
                MessageBox.Show("没有返回任何结果,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
                return;
            }
            //
            if (DSet.Tables[0].Rows.Count>0)
            {
                grdMain.DataSource = DSet.Tables[0].DefaultView;
            }
            //冻结
            int FrCol = DBUtility.ClsPub.isInt(0);
            string s = "是";
            ClsPub1.DisplayGrid(grdMain, this.Name, s, FrCol);
            //画线
            //Total();
            ///////////////////////////////////////////
            if (DSet.Tables[1].Rows.Count > 0)
            {
                grdSub.DataSource = DSet.Tables[1].DefaultView;
            }
            //冻结
            ClsPub1.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol);
            /////////////////////////////
            txtHRelationQty.Text = DBUtility.ClsPub.isDoule(DSet.Tables[2].Rows[0]["关联数量"], 1);
            if(DBUtility.ClsPub.isDoule(txtHSumQty.Text) - DBUtility.ClsPub.isDoule(txtHRelationQty.Text)>=0)
            {
                txtHSYQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHSumQty.Text) - DBUtility.ClsPub.isDoule(txtHRelationQty.Text), 1);
            }
            else
            {
                txtHSYQty.Text = "0";
            }
            //////////////////////////
        }
        private void DisplaySub()
        {
            DataSet DSet;
            string sSql = "";
            string sWhere = "";
            //过滤条件
            sSql = " exec h_p_Sc_ICMOReportToBarCode_Sub   '" + HSourceBillTypeID + "'," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString();
            //
            DSet = oWeb.getDataSetBySQL(sSql, "h_p_Sc_ICMOReportToBarCode_Sub", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DSet == null)
            {
                MessageBox.Show("没有返回任何结果,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
                return;
            }
            //
            grdSub.DataSource = DSet.Tables[0].DefaultView;
            //冻结
            int FrCol = DBUtility.ClsPub.isInt(0);
            string s = "是";
            ClsPub1.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol);
            //画线
            //Total();
        }
        #endregion
        #region  //打印设置
        GridppReport Report;
        string sBarCode = "";
        //预览
        int CurRows = 0;
        #endregion
        #region ç•Œé¢æŽ§ä»¶å¤„理
        private void cmdHDeptID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Department_View oDept = new SCM.ClsIF_Department_View();
            string sWhere = "";
            if (oDept.RefreshView(sWhere))
            {
                this.txtHDeptID.Text = oDept.oModel.HName;
                this.txtHDeptID.Tag = oDept.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHDeptID.Text = "";
            }
        }
        private void txtHDeptID_TextChanged(object sender, EventArgs e)
        {
            BLL.ClsPub_BLL.Sub_ClearText(txtHDeptID);
        }
        #endregion
        //选择源单
        private void cmdHSourceBillNo_Click(object sender, EventArgs e)
        {
            Gy_SourceBillList_Touch oGy_SourceBillList_Touch = new Gy_SourceBillList_Touch();
            oGy_SourceBillList_Touch.HSourceBillType = HSourceBillType;//类型名称
            oGy_SourceBillList_Touch.ShowDialog();
            if (oGy_SourceBillList_Touch.OKTag == 1)
            {
                //根据选中的源单内码和子内码,返回相应信息
                HSourceEntryID = oGy_SourceBillList_Touch.HSelEntryID;
                HSourceInterID = oGy_SourceBillList_Touch.HSelInterID;
                HSourceBillTypeID = oGy_SourceBillList_Touch.HSourceBillTypeID;
                HSourceBillNo = oGy_SourceBillList_Touch.HSourceBillNo;
                Display(HSourceBillType, oGy_SourceBillList_Touch.HSelInterID, oGy_SourceBillList_Touch.HSelEntryID);
            }
            else
            {
                HSourceEntryID = 0;
                HSourceInterID = 0;
                HSourceBillTypeID = "";
                HSourceBillNo = "";
            }
        }
        //
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            CloseCom();
            this.Close();
        }
        private void label19_Click(object sender, EventArgs e)
        {
        }
        public bool SaveBill(string sType)
        {
            try
            {
                int LSHlen = 2;             //流水号长度
                int SumLen = 10;            //总长度
                string TM = "";             //条码
                string HNumber = "";        //物料代码
                double HSumQty = 0;         //产品数量
                double HMinQty = 0;         //最小包装数
                int HBQty = 0;              //箱数
                double HQty = 0;            //数量
                string WeiShu = "";         //尾数
                int LSH = 0;                //流水号
                string LSH2 = "";           //流水号转换成字符
                string sDate = "";          //日期
                string sYear = "";          //å¹´
                string sPeriod = "";        //月
                string sDay = "";           //日
                string HBatchNo = "";       //批次
                int k = 0;
                int n = 0;                  //同一批生成条码中的第几条
                string sTMNumber = "";      //条码自定义前缀
                DataSet Ds;
                //
                string HWei = "";      //尾数
                HBarCode = "";
                string HBarCodeType = "";
                Int64 HMaterID = 0;
                Int64 HAuxPropID = 0;
                Int64 HUnitID = 0;
                double HQty2 = 0;
                string HBatchNo2 = "";
                Int64 HSupID = 0;
                Int64 HGroupID = 0;
                int HPrintQty = 0;
                Int64 HBarcodeNo = 0;       //托号
                Int64 HBarcodeQtys = 0;     //总托数
                Int64 HDeptID = 0;
                Int64 HWhID = 0;
                Int64 HSPID = 0;
                string HRemark = "";
                string HMaterName = "";
                string HMaterModel = "";
                string HPinfan = "";
                string HMTONo = "";
                Int64 HCusID = 0;
                string HCusType = "";
                DateTime HEndDate;
                string HWorkLineName = "";
                DateTime HBeginDate;
                string HSeOrderBillNo = "";
                string HJiaYe2 = "";
                string HPressModel = "";
                string HCusModel = "";
                string HMaterialModel = "";
                string HColor = "";
                string HLogo = "";
                string HPackageSize = "";
                double HMaterialJQty = 0;
                double HMaterialMQty = 0;
                string HCustomBatchNo = "";
                string HGBBarCode = "";
                string POOrderBillNo = "";
                //
                cmdHSaveBill.Enabled = false;
                //判断是否存在 æºå•信息;
                if (HSourceInterID <= 0 || HSourceEntryID <= 0 || DBUtility.ClsPub.isLong(txtHMaterName.Tag) <= 0 || DBUtility.ClsPub.isLong(txtHUnitName.Tag) <= 0)//判断是否有源单
                {
                    MessageBox.Show("没有选单!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                if (DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text) >= 0)
                {
                    txtHSJQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHDQQty.Text) - DBUtility.ClsPub.isDoule(txtHKSQty.Text), 1); //实际米数= å½“前米数-开始米数
                    lblHRelQty.Text = txtHSJQty.Text;
                }
                else
                {
                    if (MessageBox.Show("当前米数小于开始米数,是否确定要清零开始米数", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        txtHKSQty.Text = "0";
                        txtHSJQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHDQQty.Text), 1); //实际米数= å½“前米数-开始米数
                        lblHRelQty.Text = txtHSJQty.Text;
                    }
                }
                if (DBUtility.ClsPub.isDoule(txtHSJQty.Text) <= 0)
                {
                    MessageBox.Show("当前数量不能小于等于0!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                //if (DBUtility.ClsPub.isDoule(txtHSYQty.Text) <= 0)
                //{
                //    MessageBox.Show("剩余数量已经为0,不能在裁切!");
                //    cmdHSaveBill.Enabled = true;
                //    return false;
                //}
                if (DBUtility.ClsPub.isLong(txtHEmpID.Tag) == 0 || DBUtility.ClsPub.isLong(txtHEmpID2.Tag) == 0 )
                {
                    MessageBox.Show("职员1或者职员2没有选择!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                if (DBUtility.ClsPub.isLong(txtHGroupID.Tag) == 0 )
                {
                    MessageBox.Show("班组没有选择!");
                    cmdHSaveBill.Enabled = true;
                    return false;
                }
                //根据源单 ç”Ÿæˆæ¡å½¢ç  å¹¶ä¿å­˜å¦‚数据库
                HNumber = DBUtility.ClsPub.isStrNull(txtHMaterName.Tag);
                HBatchNo = DBUtility.ClsPub.isStrNull(txtHBatchNo.Text);
                sDate = dtpHDate.Value.ToShortDateString();
                sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
                sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
                sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
                sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
>>>>>>> parent of d95a654 (nothing)
                sDay = sDay.Substring(sDay.Length - 2, 2);
                //条码前缀 = ç»„织代码 + ç‰©æ–™å†…码 + å¹´ + æœˆ + æ—¥
@@ -1224,11 +680,11 @@
                            + ",'" + HPressModel + "','" + HCusModel + "','" + HMaterialModel + "','" + HColor + "','" + sDate + "'"
                            + ",'" + HLogo + "','" + HPackageSize + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + ",'" + HCustomBatchNo + "'"
                            + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HBeginDate.ToShortDateString() + "','" + HSeOrderBillNo + "','" + HGBBarCode + "'"
                            + ",'" + POOrderBillNo + "'" + "," + DBUtility.ClsPub.isLong(txtHSourceID.Tag)
                            + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','"+ txtHReasonList.Text + "','"+ HRemark + "')";
                            + ",'" + POOrderBillNo + "'" + "," + DBUtility.ClsPub.isLong(txtHSourceID.Tag)
                            + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + txtHReasonList.Text + "','" + HRemark + "')";
                oWeb.getRunProc(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo);
                //刷新界面
                DisplayMain();
                //DisplaySub();  
@@ -1242,7 +698,7 @@
                {
                    Report.Print(false);
                }
                Thread.Sleep(500);
                if (HSourceBillType != "生产汇报单")
@@ -1275,7 +731,7 @@
        private void Sub_SetReport(string sOpenTmp)
        {
            //判断行数
            Report = new GridppReport();
            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
@@ -1380,7 +836,7 @@
        {
            if (!ComDevice.IsOpen)
            {
                try
                {
                    ComDevice.PortName = txtPortName.Text;
@@ -1405,7 +861,7 @@
                        default:
                            break;
                    }
                    ComDevice.DataBits = int.Parse(txtDataBits.Text);
                    switch (cmbStopBits.SelectedItem.ToString())
                    {
@@ -1424,14 +880,14 @@
                        default:
                            break;
                    }
                    ComDevice.Open();
                    ComDevice.Open();
                    lblComStatus.Text = "串口状态:开启";
                    timer3.Enabled = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("打开串口失败!" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show("打开串口失败!" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
@@ -1472,19 +928,19 @@
        {
            if (!ComDevice.IsOpen)
            {
            }
            else
            {
                try
                {
                    ComDevice.Close();
                    ComDevice.Close();
                    lblComStatus.Text = "串口状态:关闭";
                    timer3.Enabled = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
@@ -1493,7 +949,7 @@
        //设备清零
        private void cmdHSetZero_Click(object sender, EventArgs e)
        {
            cmdHSetZero.Enabled=false;
            cmdHSetZero.Enabled = false;
            byte[] sendData = strToHexByte(txtHSend0.Text);
            SendData(sendData);
            txtHSJQty.Text = "0";
@@ -1521,13 +977,13 @@
        }
         /// <summary>
        /// <summary>
        /// å‘送数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="data"></param>
        public bool SendData(byte[] data)
        {
        {
            if (ComDevice.IsOpen)
            {
                try
@@ -1537,7 +993,7 @@
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
@@ -1546,7 +1002,7 @@
            }
            else
            {
                MessageBox.Show("串口未打开", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                MessageBox.Show("串口未打开", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return false;
        }
@@ -1607,7 +1063,7 @@
        //            {
        //                newStr = strArr[4];
        //            }
        //        }
        //        if (string.IsNullOrEmpty(newStr))
        //        {
@@ -1678,7 +1134,7 @@
                if (strArr[4] != "00")
                {
                    char[] bw = strArr[4].ToCharArray();
                    if(bw[0]=='0')
                    if (bw[0] == '0')
                    {
                        newStr = bw[1].ToString();
                    }
@@ -1686,7 +1142,7 @@
                    {
                        newStr = strArr[4];
                    }
                }
                if (string.IsNullOrEmpty(newStr))
                {
@@ -1704,12 +1160,12 @@
                {
                    newStr += strArr[5];
                }
                if (strArr[6] != "00"&&newStr=="00")
                if (strArr[6] != "00" && newStr == "00")
                {
                    //newStr = $"0.{strArr[6]}";
                    newStr = "0." + strArr[6];
                }
                if(strArr[6]!="00"&&newStr!="00")
                if (strArr[6] != "00" && newStr != "00")
                {
                    //newStr += $".{strArr[6]}";
                    newStr = newStr + "." + strArr[6];
@@ -1722,7 +1178,7 @@
            //将当前数   åŽ˜ç±³ è½¬åŒ–为 ç±³
            double NewQty = DBUtility.ClsPub.isDoule(newStr) ;
            double NewQty = DBUtility.ClsPub.isDoule(newStr);
            if (NewQty <= 0)
            {
                newStr = "0";
@@ -1740,12 +1196,12 @@
                lblHRelQty.Text = txtHSJQty.Text;
            }
            else
            {
            {
                txtHSJQty.Text = DBUtility.ClsPub.isDoule(DBUtility.ClsPub.isDoule(txtHDQQty.Text), 1); //实际米数= å½“前米数-开始米数
                lblHRelQty.Text = txtHSJQty.Text;
                lblHRelQty.Text = txtHSJQty.Text;
            }
        }
        //删除选中的行数
        private void btnFQSH_Click(object sender, EventArgs e)
        {
@@ -1774,10 +1230,10 @@
                    if (lngBillKey == 0)
                        return;
                    try
                    {
                    {
                        oWeb.getRunProc("Delete from Gy_BarCodeBill where HItemID=" + lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                        oWeb.getRunProc("insert into System_log values(GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.CurUserName + "','删除条码:" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("条形码")].Value) + "' ,'WMS系统','','删除')", ref DBUtility.ClsPub.sExeReturnInfo);
                    }
                    catch (Exception e)
                    {
@@ -1798,7 +1254,7 @@
        }
        private void cmdHSaveInfo_Click(object sender, EventArgs e)
        {
        {
            ClsIni.WriteIni("COMINFO", "txtPortName", DBUtility.ClsPub.isStrNull(txtPortName.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "txtBaudRate", DBUtility.ClsPub.isStrNull(txtBaudRate.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "cmbParity", DBUtility.ClsPub.isStrNull(cmbParity.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
@@ -1807,7 +1263,7 @@
            ClsIni.WriteIni("COMINFO", "txtHSend0", DBUtility.ClsPub.isStrNull(txtHSend0.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "txtHSend", DBUtility.ClsPub.isStrNull(txtHSend.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "txtHSourceID", DBUtility.ClsPub.isStrNull(txtHSourceID.Text), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "txtHSourceIDTag", DBUtility.ClsPub.isStrNull(txtHSourceID.Tag), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
            ClsIni.WriteIni("COMINFO", "txtHSourceIDTag", DBUtility.ClsPub.isStrNull(txtHSourceID.Tag), DBUtility.ClsPub.AppPath + @"/HXERP.ini");
        }
        private void btnBLHB_Click(object sender, EventArgs e)
@@ -1920,7 +1376,7 @@
                txtHReasonList.Text = "";
                return false;
            }
            catch(Exception e1)
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
                return false;
@@ -1965,12 +1421,12 @@
                    MessageBox.Show("保存不良原因失败!" + DBUtility.ClsPub.sExeReturnInfo);
                }
            }
        }
        private void cmdHGroupID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Group_View oGroup= new SCM.ClsIF_Group_View();
            SCM.ClsIF_Group_View oGroup = new SCM.ClsIF_Group_View();
            string sWhere = "";
            if (oGroup.RefreshView(sWhere))
            {