chenhaozhe
2026-03-05 f66d4e7970b06a9842a9364845ea8a83c0169712
DAL/¼Æ»®¹ÜÀí/ClsGy_RoutingBill.cs
@@ -92,7 +92,7 @@
                      ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" +
                      ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" +
                      ",HTechnologyParameter,HPicNum,HProcCheckNote" +
                      ",HOverRate" +
                      ",HOverRate,HWorkTimes_S,HSNCtrl" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HProcNo.ToString() + "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" +
                      "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() +
@@ -104,11 +104,11 @@
                     "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + "," + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() +
                     ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() + 
                     ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() +
                     "', " + oSub.HOverRate.ToString() +
                     "', " + oSub.HOverRate.ToString() + "," + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSNCtrl ? 1 : 0) +
                      ") ");
                }
                //
                oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString());  //设置默认工艺路线
                oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'");  //设置默认工艺路线
                //oCn.RunProc("exec h_p_Sc_ProcessExchangeBillSetUpdate " + omodel.HInterID.ToString());  //设置首道末道 æµè½¬æ ‡è®° ç­‰ å­—段。
                //
                //判断是否重复工序号
@@ -226,7 +226,7 @@
                      ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" +
                      ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" +
                      ",HTechnologyParameter,HPicNum,HProcCheckNote" +
                      ",HOverRate,HProcWorkNum" +
                      ",HOverRate,HProcWorkNum,HWorkTimes_S,HSNCtrl" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HProcNo.ToString() + "," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" +
                      "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() +
@@ -238,11 +238,11 @@
                     "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + ", " + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() +
                     ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() +
                     ",'"+ oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() +
                     "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'" +
                     "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'," + oSub.HWorkTimes_S.ToString() + "," + Convert.ToString(oSub.HSNCtrl ? 1 : 0) +
                      ") ");
                }
                //
                oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString());  //设置默认工艺路线
                oCn.RunProc("exec h_p_Gy_RoutingBillCheck " + omodel.HInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'");  //设置默认工艺路线
                //oCn.RunProc("exec h_p_Sc_ProcessExchangeBillSetUpdate " + omodel.HInterID.ToString());  //设置首道末道 æµè½¬æ ‡è®° ç­‰ å­—段。
                //
                //判断是否重复工序号
@@ -280,7 +280,7 @@
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Gy_RoutingBillMain Where HInterID=" + lngBillKey.ToString()+" and HPRDORGID='"+DBUtility.ClsPub.HOrgID.ToString()+"'", "Gy_RoutingBillMain");
                Ds = oCn.RunProcReturn("Select * from Gy_RoutingBillMain Where HInterID=" + lngBillKey.ToString(), "Gy_RoutingBillMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
@@ -288,6 +288,8 @@
                }
                //赋值
                omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"].ToString());
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HName = Ds.Tables[0].Rows[0]["HName"].ToString().Trim();
                omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"].ToString().Trim());
@@ -405,6 +407,8 @@
                    oSub.HPicNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPicNum"]);
                    oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcCheckNote"]);
                    oSub.HOverRate = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HOverRate"]);
                    oSub.HWorkTimes_S = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWorkTimes_S"]);
                    oSub.HSNCtrl = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HSNCtrl"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
@@ -417,6 +421,88 @@
            }
        }
        //驳回
        public override bool RejectCheckFlowProgress(Int64 lngBillKey, string HBillNo, string sUser, ref string sReturn)
        {
            if (isUse(lngBillKey, ref sReturn))
            {
                return false;
            }
            try
            {
                //开启事务
                oCn.BeginTran();
                //判断是否存在审核过的项目
                //string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + this.BillType + "' and ISNULL(HChecker,'') <> ''";
                //DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus");
                //if (ds0 != null && ds0.Tables[0].Rows.Count == 0)
                //{
                //    sReturn = "单据不存在已经审核的项目!";
                //    return false;
                //}
                //获取需要驳回的审核项目
                string sql0 = "select c.* from Xt_CheckFlowMain as a " +
                              "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " +
                              "inner join Xt_BillCheckFlowStatus as c on a.HBillTypeID = c.HBillTypeID and b.HCheckItemID = c.HCheckItemID " +
                              "where c.HBillTypeID = '" + this.BillType + "' and c.HBillInterID = " + lngBillKey + " " +
                              "order by b.HFlowNo asc";
                DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus");
                if (ds0 == null || ds0.Tables[0].Rows.Count == 0)
                {
                    sReturn = "驳回失败!原因:未发起审批!!";
                    return false;
                }
                //获取当前审核项目
                string HCheckFlowID = ds0.Tables[0].Rows[0]["HCheckFlowID"].ToString();             //审批流内码
                sql0 = "select * from " + MvarItemKey + " where HInterID = " + lngBillKey;
                ds0 = oCn.RunProcReturn(sql0, MvarItemKey);
                string HCheckItemNowID = ds0.Tables[0].Rows[0]["HCheckItemNowID"].ToString();       //当前审批项目内码
                //查找是否有权限
                string sql01 = "select * from Xt_CheckUserRight where HUserID = '" + sUser + "' and HCheckFlowInterID = " + HCheckFlowID + " and HCheckItemID = " + HCheckItemNowID + "";
                DataSet ds01 = oCn.RunProcReturn(sql01, "Xt_CheckUserRight");
                //获取用户名称
                DataSet DsUser = new DataSet();
                DsUser = oCn.RunProcReturn("select * from gy_czygl where czybm='" + sUser.Trim() + "'", "gy_czygl");
                if(DsUser.Tables[0].Rows.Count == 0)
                {
                    sReturn = "无法找到该用户!";
                    return false;
                }
                string userName = DsUser.Tables[0].Rows[0]["czymc"].ToString();
                if (ds01.Tables[0].Rows.Count == 0 && !DBUtility.ClsPub.Security_Log_second("Gy_RoutingBill_Check", 1, false, userName))//单据原审核权限为多级审核驳回权限
                {
                    sReturn = "无权限!";
                    return false;
                }
                //更新 é©³å›žåˆ é™¤å®¡æ ¸æµçŠ¶æ€è¡¨
                string sql02 = "Delete Xt_BillCheckFlowStatus where HBillTypeID = '" + this.BillType + "' and HBillInterID=" + lngBillKey + " and HCheckFlowID=" + HCheckFlowID;
                oCn.RunProc(sql02);
                oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null,HBillStatus=5,HCheckItemNowID = 0,HCheckItemNextID = 0 Where HInterID=" + lngBillKey.ToString());
                //写入日志
                string WorkList = "驳回单据,单据号:" + HBillNo;
                string SystemName = "LMES-" + MvarReportTitle + "模块";
                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                    "(getdate(),'" + sUser + "','" + "111" + "','" + WorkList + "','" + SystemName + "','" + "1111" + "','驳回')"
                    );
                sReturn = "反审核单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                sReturn = e.Message;
                throw (e);
            }
        }
        //启用工艺路线
        public bool Sub_RoutingCheckAndUsed(Int64 HInterID)
        {