zzr99
2022-06-13 f19044df4868173b951e81b377869666d16806dd
WorkM/Á÷ת¿¨¹ÜÀí/MES_StationInBill.cs
@@ -30,8 +30,9 @@
        public DAL.ClsSc_StationInBill BillNew = new DAL.ClsSc_StationInBill();
        public DAL.ClsSc_StationInBill BillOld = new DAL.ClsSc_StationInBill();
        public Int64 lngBillKey;
        public Int64 lngBillSubKey;
        public Int64 HInterID;//主内吗
        public Int64 lngBillKey; //流转卡ID
        public Int64 lngBillSubKey; //流转卡子ID
        public Int64 lngICMOEntryID;
        //-------------------------------------------------------------------------
@@ -191,11 +192,11 @@
            this.txtHStationInTime.Text = DBUtility.ClsPub.GetServerDate(-1);
            this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
            if (lngBillKey != 0 )
            {
                //LotShow();
            }
            this.HInterID = DBUtility.ClsPub.CreateBillID(this.ModName, ref DBUtility.ClsPub.sExeReturnInfo);
            //if (lngBillKey != 0 )
            //{
            //    //LotShow();
            //}
        }
        private void LotShow() //自动载入 æµè½¬å¡è¿›ç«™ç•Œé¢åŠŸèƒ½
@@ -411,6 +412,12 @@
            //
            txtHProcExchBillNo.Enabled = false;
            txtHProcNo.Enabled = false;
            //加载 é…ä»¶ç»‘定清单
        }
        //单据完整性判断          æœªå®Œæˆ
@@ -555,7 +562,13 @@
                return false;
            //赋值ID
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
            {
                BillNew.omodel.HInterID = BillOld.omodel.HInterID;
            }
            else
            {
                BillNew.omodel.HInterID = HInterID;
            }
            //主类赋值
            //判断会计期是否合理
            string s = "";
@@ -1027,6 +1040,16 @@
                {
                    Sub_WriteInForm_SM2(Ds.Tables[0], i);
                }
                //如果系统参数启用了 è¿›ç«™å•绑定配件清单则 ä»Žç”Ÿäº§ç”¨æ–™æ¸…单中获取工序BOM写入 ä¸´æ—¶è¡¨ï¼Œå¹¶åŠ è½½è¡¨æ ¼
                Pub_Class.ClsXt_SystemParameter oParam = new ClsXt_SystemParameter();
                string sIsBingLine = oParam.GetSingleSystemParameter("MES_StationInBill_LineBindCtl",ref DBUtility.ClsPub.sExeReturnInfo );
                if (sIsBingLine.Trim() == "Y")
                {
                    oCn.RunProc("exec h_p_MES_StationInBillSubBindSource_Insert " + lngBillKey.ToString() + " , " + lngBillSubKey.ToString() + "," + HInterID.ToString() + " ");
                    //刷新表体网格数据
                    DisplaySub();
                }
                //
                txtHGroupID.Focus();
            }
        }
@@ -1437,5 +1460,81 @@
        {
            this.Sub_AddBill();
        }
        //配件条形码 å›žè½¦äº‹ä»¶
        private void txtHBarCode_Mater_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Return)
                {
                    if (txtHBarCode_Mater.Text.Trim() == "")
                    {
                        MessageBox.Show("请输入条形码!");
                        return;
                    }
                    string sBarCode = txtHBarCode_Mater.Text.Trim();
                    txtHBarCode_Mater.Text = "";
                    //判断条形码是否在条码档案中,判断条形码是否合理
                    //先判断 ä¸´æ—¶è¡¨ä¸­æ˜¯å¦æœ‰æ•°æ®ï¼Œæ¡å½¢ç çš„物料是否在清单中,写入 æ‰«ç è®°å½•表
                    //得到信息
                    SQLHelper.ClsCN oCn = new ClsCN();
                    DataSet Ds;
                    Ds = oCn.RunProcReturn("exec h_p_MES_StationInBillSub_BindBarCode   " + HInterID.ToString() + " ,'" + sBarCode + "'", "h_p_MES_StationInBillSub_BindBarCode");
                    //写入信息
                    if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("未查询到条形码信息!");
                        return;
                    }
                    else if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 2)
                    {
                        MessageBox.Show("错误!" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]));
                        return;
                    }
                    //刷新表体网格数据(最好颜色显示)
                    DisplaySub();
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message + "txtHBarCode_Mater_KeyDown");
            }
        }
        private void DisplaySub()
        {
            try
            {
                SQLHelper.ClsCN oCn = new ClsCN();
                DataSet Dsplay;
                Dsplay = oCn.RunProcReturn("exec h_p_MES_StationInBillSub_BindDisplay   " + HInterID.ToString() + "  ", "h_p_MES_StationInBillSub_BindDisplay");
                //写入信息
                if (Dsplay == null || Dsplay.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("刷新失败!");
                    return;
                }
                else
                {
                    grdSub.DataSource = Dsplay.Tables[0].DefaultView;
                    //设置合计列
                    //string sTotalCol = "";
                    //sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
                    //string[] sT;
                    //sT = sTotalCol.Split(Convert.ToChar(","));
                    //oSumGrid.BuildTotalCols(sT);
                    //
                    //冻结
                    int FrCol = 0;
                    string s = "是";
                    DBUtility.Xt_BaseBillFun.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "DisplaySub");
            }
        }
    }
}