1
王 垚
2022-11-28 ae68ef5d4843c8ea0558e607a7f7b97f78b29b79
WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -159,7 +159,7 @@
                ") " +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker+ "',getdate()" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HEmpID.ToString() + "','" + omodel.HEmpNumber +
                "','" + omodel.HGroupID.ToString() + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDeptNumber + "'"+
                "','" + omodel.HGroupID.ToString() + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDeptNumber +
                "','" + omodel.HMainSourceBillNo.ToString() + "'," + omodel.HMainSourceInterID.ToString() + ",'" + omodel.HMainSourceEntryID + "','" + omodel.HMainSourceBillType + "'" +
                ") ");
                //插入子表
@@ -307,6 +307,90 @@
            }
        }
        //审核
        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                string HChecker = DBUtility.ClsPub.CurUserName;
                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
                oCn.BeginTran();
                oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
                sReturn = "审核单据成功!";
                oCn.Commit();
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        //反审核
        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                string HChecker = DBUtility.ClsPub.CurUserName;
                string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
                oCn.BeginTran();
                //还原单据状态为未审核状态
                oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString());
                sReturn = "反审核单据成功!";
                oCn.Commit();
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        //删除单据
        public virtual bool DeleteBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //查询生产汇报单表数量
                DataSet ds = oCn.RunProcReturn("select a.HBillNo,b.HSourceInterID,b.HSourceEntryID  from Sc_ICMOReportBillMain a inner join Sc_ICMOReportBillSub b on a.HInterID = b.HInterID where a.HInterID = '" + lngBillKey + "'", "Sc_ICMOReportBillMain");
                string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString();
                string HSourceEntryID = ds.Tables[0].Rows[0]["HSourceEntryID"].ToString();
                //
                //更新产量汇报临时表是否报检申请状态
                string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set HRelationInterID='0' where HICMOReportBillNo='"+ HBillNo + "' and HICMOInterID='"+ HSourceInterID + "' and HICMOEntryID='"+ HSourceEntryID + "'");
                oCn.RunProc(sql1);
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除明细表
                DeleteBillSub(lngBillKey);
                //删除主表
                DeleteBillMain(lngBillKey);
                sReturn = "删除单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //扫码生成产量汇报单(无条码出入库记录)
        public bool AddBill_PDA2(ref string sReturn)
        {