zrg
2024-03-04 c07bb60b39a9fbf5c41a724c7060f45c821f93ff
DBUtility/ÒµÎñµ¥¾Ý/ClsXt_BaseBill.cs
@@ -178,6 +178,43 @@
                throw (e);
            }
        }
        //行反关闭单据(包含写入日志)    2024-01-31
        public bool CancelRow(Int64 lngBillKey,Int64 HEntryID, string HBillNo, string sUser, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                string sql = "select * from " + MvarItemKeySub + " where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
                DataSet ds = oCn.RunProcReturn(sql, MvarItemKeySub);
                if(ds==null || ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "行记录不存在!";
                    return false;
                }
                else
                {
                    sql = " Update " + MvarItemKeySub + " set HCloseMan='',HEntryCloseDate='',HCloseType=0 Where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
                    oCn.RunProc(sql);
                }
                //写入日志
                string WorkList = "行反关闭,单据号:" + HBillNo + ";子表内码:" + HEntryID;
                string SystemName = "LMES-" + MvarReportTitle + "模块";
                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                    "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','行反关闭')"
                    );
                sReturn = "行反关闭成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //反审核
        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
        {
@@ -367,7 +404,7 @@
            {
                string HCloseMan = ClsPub.CurUserName;
                string HCloseDate = ClsPub.GetServerDate(-1); 
                oCn.RunProc(" Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate='" + HCloseDate + "',HBillStatus=3 Where HInterID=" + lngBillKey.ToString());
                oCn.RunProc(" Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate='" + HCloseDate + "',HBillStatus=3,HCloseType = 1 Where HInterID=" + lngBillKey.ToString());
                sReturn = "";
                return true;
            }
@@ -405,6 +442,46 @@
                throw (e);
            }
        }
        //行关闭单据(包含写入日志)    2024-01-31
        public bool CloseRow(Int64 lngBillKey,Int64 HEntryID, string HBillNo, string sUser, ref string sReturn)
        {
            DataSet ds;
            try
            {
                oCn.BeginTran();
                string HCloseMan = sUser;
                string HEntryCloseDate = ClsPub.GetServerDate(-1);
                //变更行关闭状态
                string sql = " Update " + MvarItemKeySub + " set HCloseMan='" + HCloseMan + "',HEntryCloseDate='" + HEntryCloseDate + "',HCloseType=1 Where HInterID=" + lngBillKey.ToString() + " and HEntryID = " + HEntryID;
                oCn.RunProc(sql);
                //检查单据子表所有行是否都关闭,若都关闭则自动关闭单据
                //sql = "select * from " + MvarItemKeySub + " where HInterID=" + lngBillKey + " and HCloseMan=''";
                //ds = oCn.RunProcReturn(sql, MvarItemKeySub);
                //if(ds!=null && ds.Tables[0].Rows.Count == 0)
                //{
                //    sql = " Update " + MvarItemKey + " set HCloseMan='" + HCloseMan + "',HCloseDate=getdate(),HBillStatus=3,HCloseType = 0 Where HInterID=" + lngBillKey.ToString();
                //    oCn.RunProc(sql);
                //}
                //写入日志
                string WorkList = "行关闭,单据号:" + HBillNo + ";子表内码:" + HEntryID;
                string SystemName = "LMES-" + MvarReportTitle + "模块";
                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                    "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','行关闭')"
                    );
                sReturn = "行关闭成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //作废
        public bool Cancelltion(Int64 lngBillKey, ref string sReturn)
        {