yangle
2023-05-10 05e8d342bbff483c73ac4fc481ea16f203a78ba1
WorkM/Á÷ת¿¨¹ÜÀí/MES_StationOutBillList_Bad.cs
@@ -47,6 +47,7 @@
            string sSql = "";
            string sWhere = "";
            bzd.Enabled = true;
            if (frmCondition.SqlStr.Trim().Length == 0)
            {
                sSql = "Select top 5000 * from " + ViewName + " Where 1=1 " + sWhere + sDlgWhere + " order by hmainid desc ";
@@ -496,7 +497,7 @@
            //LOT号
            if (txtHBillNo.Text.Trim() != "")
            {
                sFastSQL = sFastSQL + " and æµè½¬å¡å· like '%" + txtHBillNo.Text + "%'";
                sFastSQL = sFastSQL + " and å·¥åºæµè½¬å¡å· like '%" + txtHBillNo.Text + "%'";
            }
            //工作中心
            if (txtHCenterID.Text.Trim() != "")
@@ -614,6 +615,8 @@
        private void bzd_Click(object sender, EventArgs e)
        {
            //点击后入库按钮变灰
            bzd.Enabled = false;
            //根据选中的数据生成包装单
            int MainIDCol =  Fun_GetCol("hmainid");
            int SubIDCol = Fun_GetCol("hsubid");
@@ -622,12 +625,14 @@
            int HKeepCol = Fun_GetCol("K3保管");
            int HSecManagerCol = Fun_GetCol("K3验收");
            int HDeptCol = Fun_GetCol("K3部门");
            DAL.ClsKf_ProductInBill oClsKf_ProductInBill ;
            DAL.ClsKf_ProductInBill oClsKf_ProductInBill;
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo) == false)
            {
                MessageBox.Show("获取系统参数失败! " + DBUtility.ClsPub.sExeReturnInfo);
                bzd.Enabled = true;
                return;
            }
            //判断会计期是否合理
@@ -637,8 +642,40 @@
            if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Today, ref sYear, ref sPeriod, ref s) == false)
            {
                MessageBox.Show("会计期间有错误! " + DBUtility.ClsPub.sExeReturnInfo);
                bzd.Enabled = true;
                return;
            }
            string sHInterID = "";
            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
            {
                sHInterID = sHInterID + "," + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value);
            }
            if (sHInterID=="")
            {
                MessageBox.Show("没有选中的单据明细行,请先选择要入库的单据!", "提示");
                bzd.Enabled = true;
                return;
            }
            else
            {
                DataSet DS = oCn.RunProcReturn("exec h_p_MES_StationOutBillList_Bad_PreProductIn '" + sHInterID + "'", "h_p_MES_StationOutBillList_Bad_PreProductIn", ref DBUtility.ClsPub.sExeReturnInfo);
                if (DS == null || DS.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("入库前判断失败!", "提示");
                    bzd.Enabled = true;
                    return;
                }
                else
                {
                    if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
                    {
                        MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
                        bzd.Enabled = true;
                        return;
                    }
                }
            }
            Int64 n = 0;
            //循环 é€‰ä¸­è¡Œ
            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
@@ -678,6 +715,7 @@
                System.Threading.Thread.Sleep(2000);
                //
            }
            bzd.Enabled = true;
            //
            if (n > 0)
            {