11
pzy
2024-08-26 dbbcd506929afda0a85ae23bcb5f88c1dccef387
DAL/³µ¼ä¹ÜÀí/ClsSc_StationInBill.cs
@@ -323,10 +323,13 @@
        public override bool AddBill(ref string sReturn)
        {
            try
            {
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                if (DBUtility.ClsPub.isLong(omodel.HInterID) == 0)
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sc_StationInBillMain " +
@@ -389,7 +392,11 @@
                //////
                oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + omodel.HInterID.ToString() + ",1");
                //==================进站单启用配件清单绑定, è¿›è¡Œ ä¿å­˜å¼ºåˆ¶æŽ§åˆ¶
                //==============================
                //判断是否是 é¦–道工序
                DataSet ds1;
                ds1 = oCn.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a  " + 
@@ -964,6 +971,57 @@
        }
        public bool DeleteBill(long HInterID, long HProcExchInterID, long HProcExchEntryID,string HBillNo,string procName,string user, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //HBillSubType=2  åˆå§‹åŒ–进站  æŠŠæµè½¬å¡åˆå§‹åŒ–标记改为0
                //DataSet Ds;
                //Ds = oCn.RunProcReturn("select HBillSubType from Sc_StationInBillMain where HInterID=" + HInterID, "h_p_Sc_StationDelete");
                //if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "2")
                //{
                //    oCn.RunProc("update Sc_ProcessExchangeBillsub set HCSHJZFlag=0 where HInterID=" + HProcExchInterID);
                //}
                //////
                oCn.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID.ToString() + ",-1");
                //
                //删除
                oCn.RunProc("delete Sc_StationInBillMain   where HInterID=" + HInterID);
                //回填流转卡进站时间
                //oCn.RunProc("update Sc_ProcessExchangeBillsub set HRelBeginDate=null where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID);
                //删除后控制==================================================================================
                string sql2 = "exec " + procName + " " + HInterID + ",'" + HBillNo + "','" + user + "'";
                DataSet ds = oCn.RunProcReturn(sql2, procName);
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "删除失败!原因:删除后判断失败,请与网络管理人员联系";
                    oCn.RollBack();
                    return false;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    sReturn = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString();
                    oCn.RollBack();
                    return false;
                }
                //==============================================================================================
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        public bool CheckCenterIDByUser(long HCenterID)
        {
            DataSet Ds;