zrg
2024-01-26 432050f1cece4e60a90951bb619ff759b8fbad80
周总结页面查询数据
4个文件已修改
3个文件已添加
738 ■■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/项目管理/ClsPM_WorkReportWeekBillMain.cs 298 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/项目管理/ClsPM_WorkReportWeekBillMain.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/项目管理/ClsPM_WorkReportWeekBillSub.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/项目管理/工作周计划/PM_WorkTaskWeekBillController.cs 390 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -774,6 +774,7 @@
    <Compile Include="销售管理\单证管理\ClsXs_CustomsSplitPackBill.cs" />
    <Compile Include="销售管理\单证管理\ClsXs_LadingBill.cs" />
    <Compile Include="销售管理\单证管理\ClsXs_ShippingAdviceBill.cs" />
    <Compile Include="项目管理\ClsPM_WorkReportWeekBillMain.cs" />
    <Compile Include="项目管理\ClsPM_WorkTaskWeekBill.cs" />
    <Compile Include="项目管理\ClsPro_DesignBlueRequestBill.cs" />
    <Compile Include="项目管理\ClsPro_ProjectCheckBill.cs" />
DAL/ÏîÄ¿¹ÜÀí/ClsPM_WorkReportWeekBillMain.cs
New file
@@ -0,0 +1,298 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsPM_WorkReportWeekBillMain : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsPM_WorkReportWeekBillMain omodel = new Model.ClsPM_WorkReportWeekBillMain();
        public List<Model.ClsPM_WorkReportWeekBillSub> DetailColl = new List<Model.ClsPM_WorkReportWeekBillSub>();
        public ClsPM_WorkReportWeekBillMain()
        {
            base.MvarItemKeySub = "PM_WorkReportWeekBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "PM_WorkReportWeekBillMain";
            base.MvarReportTitle="工作周总结";
            base.BillType="4757";
            base.HBillSubType = "4757";
        }
        #region å›ºå®šä»£ç 
        #region æ— å‚构造函数
        ~ClsPM_WorkReportWeekBillMain()
        {
            DetailColl = null;
        }
        #endregion
        #endregion
        #region ä¿®æ”¹å•据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //更新主表
                string mainSql = "update PM_WorkReportWeekBillMain set " +
                    " HBillNo = '" + omodel.HBillNo +
                    "', HDate = '" + omodel.HDate +
                    "', HYear = " + omodel.HYear +
                    ", HPeriod = " + omodel.HPeriod +
                    ", HRemark = '" + omodel.HRemark +
                    "', HUpDater = '" + omodel.HUpDater +
                    "', HUpDateDate = getdate()" +
                    //===============================================================
                    ", HOrgID = " + omodel.HOrgID +
                    ", HYear = " + omodel.HYear +
                    ", HWeek = " + omodel.HWeek +
                    ", HBeginDate = '" + omodel.HBeginDate +
                    "', HEndDate = '" + omodel.HEndDate +
                    "', HPlanEmpID = " + omodel.HReportEmpID +
                    " where HInterID = " + omodel.HInterID;
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                ////插入子表
                //omodel.HInterID = lngBillKey;
                //foreach (Model.ClsPM_WorkTaskWeekBillSub oSub in DetailColl)
                //{
                //    string subSql = "insert into PM_WorkTaskWeekBillSub" +
                //       "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                //       ",HWeekDay,HSno,HProjectID,HProjectStageID,HTaskNote,HPlanTimes) " +
                //       " values(" +
                //       "" + omodel.HInterID.ToString() +
                //       "," + oSub.HEntryID.ToString() +
                //       ",'" + oSub.HCloseMan +
                //       "','" + oSub.HEntryCloseDate +
                //       "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) +
                //       ",'" + oSub.HRemark +
                //       "'," + oSub.HSourceInterID +
                //       "," + oSub.HSourceEntryID +
                //       ",'" + oSub.HSourceBillNo +
                //       "','" + oSub.HSourceBillType +
                //       "'," + oSub.HRelationQty +
                //       "," + oSub.HRelationMoney +
                //       "," + oSub.HWeekDay +
                //       "," + oSub.HSno +
                //       "," + oSub.HProjectID +
                //       "," + oSub.HProjectStageID +
                //       ",'" + oSub.HTaskNote +
                //       "'," + oSub.HPlanTimes +
                //       ")";
                //    oCn.RunProc(subSql);
                //}
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        #endregion
        #region  æ–°å¢žå•据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                DataSet ds;
                oCn.BeginTran();
                //检查主表内码是否重复,若重复则重新生成并继续检查,直到不再重复
                while (true)
                {
                    ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain where HInterID = " + omodel.HInterID, "PM_WorkReportWeekBillMain");
                    if(ds!=null && ds.Tables[0].Rows.Count > 0)
                    {
                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                    }
                    else
                    {
                        break;
                    }
                }
                //插入主表
                string mainSql = "insert into PM_WorkReportWeekBillMain" +
                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
                    ",HOrgID,HWeek,HBeginDate,HEndDate,HReportEmpID,HPlanTimes,HUseTimes,HRelUseTimes,HDelayTasks,HFineTasks,HFinishRate,HWorkReport,HNextPlan,HWorkGain ) " +
                    "values(" +
                    "" + omodel.HYear.ToString() +
                    "," + omodel.HPeriod.ToString() +
                    ",'" + this.BillType +
                    "','" + this.HBillSubType +
                    "'," + omodel.HInterID +
                    ",'" + omodel.HDate +
                    "','" + omodel.HBillNo +
                    "','" + omodel.HRemark +
                    "','" + omodel.HMaker +
                    "','" + omodel.HMakeDate +
                    "'," + omodel.HOrgID +
                    "," + omodel.HWeek +
                    ",'" + omodel.HBeginDate +
                    "','" + omodel.HEndDate +
                    "'," + omodel.HReportEmpID +
                    "," + omodel.HPlanTimes +
                    "," + omodel.HUseTimes +
                    "," + omodel.HRelUseTimes +
                    "," + omodel.HDelayTasks +
                    "," + omodel.HFineTasks +
                    ",'" + omodel.HFinishRate+
                    "','" + omodel.HWorkReport+
                    "','" + omodel.HNextPlan+
                    "','" + omodel.HWorkGain+
                    "')";
                oCn.RunProc(mainSql);
                ////插入子表
                //foreach (Model.ClsPM_WorkTaskWeekBillSub oSub in DetailColl)
                //{
                //    string subSql = "insert into PM_WorkTaskWeekBillSub" +
                //        "(HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                //        ",HWeekDay,HSno,HProjectID,HProjectStageID,HTaskNote,HPlanTimes) " +
                //        " values(" +
                //        "" + omodel.HInterID.ToString() +
                //        "," + oSub.HEntryID.ToString() +
                //        ",'" + oSub.HCloseMan +
                //        "','" + oSub.HEntryCloseDate +
                //        "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) +
                //        ",'" + oSub.HRemark +
                //        "'," + oSub.HSourceInterID +
                //        "," + oSub.HSourceEntryID +
                //        ",'" + oSub.HSourceBillNo +
                //        "','" + oSub.HSourceBillType +
                //        "'," + oSub.HRelationQty +
                //        "," + oSub.HRelationMoney +
                //        "," + oSub.HWeekDay +
                //        "," + oSub.HSno +
                //        "," + oSub.HProjectID +
                //        "," + oSub.HProjectStageID +
                //        ",'" + oSub.HTaskNote +
                //        "'," + oSub.HPlanTimes +
                //        ")";
                //    oCn.RunProc(subSql);
                //}
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        #endregion
        #region æ˜¾ç¤ºå•据
        //public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        //{
        //    try
        //    {
        //        //查询主表
        //        DataSet Ds ;
        //        Ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain Where HInterID = " + lngBillKey.ToString(), "PM_WorkReportWeekBillMain");
        //        if(Ds.Tables[0].Rows.Count==0)
        //        {
        //            sReturn = "单据未找到!";
        //            return false;
        //        }
        //        //固定赋值===========================================
        //        omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
        //        omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
        //        omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
        //        omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
        //        omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
        //        omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
        //        omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
        //        omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
        //        omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
        //        omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
        //        omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
        //        omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
        //        omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
        //        omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
        //        omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
        //        omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
        //        omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
        //        omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
        //        omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
        //        omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
        //        omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
        //        omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
        //        omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
        //        omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
        //        omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
        //        //========================================================
        //        omodel.HOrgID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOrgID"]);
        //        omodel.HWeek = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWeek"]);
        //        omodel.HBeginDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBeginDate"]);
        //        omodel.HEndDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEndDate"]);
        //        omodel.HPlanEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanEmpID"]);
        //        //
        //        //循环
        //        DataSet DsSub ;
        //        DsSub = oCn.RunProcReturn("select * from PM_WorkTaskWeekBillSub where HInterID = " + lngBillKey.ToString() + "order by HEntryID", "PM_WorkTaskWeekBillSub");
        //        DetailColl.Clear();//清空
        //        for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
        //        {
        //            Model.ClsPM_WorkTaskWeekBillSub oSub = new Model.ClsPM_WorkTaskWeekBillSub();
        //            // å›ºå®šèµ‹å€¼===============================================
        //            oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
        //            oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
        //            oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
        //            oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
        //            oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
        //            oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
        //            oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
        //            oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
        //            oSub.HCloseMan =  DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
        //            oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
        //            oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
        //            oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
        //            //===================================================
        //            oSub.HWeekDay = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWeekDay"]);
        //            oSub.HSno = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSno"]);
        //            oSub.HProjectID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectID"]);
        //            oSub.HProjectStageID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProjectStageID"]);
        //            oSub.HTaskNote = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTaskNote"]);
        //            oSub.HPlanTimes = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPlanTimes"]);
        //            DetailColl.Add(oSub);
        //        }
        //        sReturn = "显示单据成功!";
        //        return true;
        //    }
        //    catch (Exception e)
        //    {
        //        sReturn = e.Message;
        //        throw (e);
        //    }
        //}
        #endregion
    }
}
Model/Model.csproj
@@ -968,6 +968,8 @@
    <Compile Include="销售管理\单证管理\ClsXs_LadingBillSub.cs" />
    <Compile Include="销售管理\单证管理\ClsXs_ShippingAdviceBillMain.cs" />
    <Compile Include="销售管理\单证管理\ClsXs_ShippingAdviceBillSub.cs" />
    <Compile Include="项目管理\ClsPM_WorkReportWeekBillSub.cs" />
    <Compile Include="项目管理\ClsPM_WorkReportWeekBillMain.cs" />
    <Compile Include="项目管理\ClsPM_WorkTaskWeekBillSub.cs" />
    <Compile Include="项目管理\ClsPM_WorkTaskWeekBillMain.cs" />
    <Compile Include="项目管理\ClsPro_DesignBlueRequestBillMain.cs" />
Model/ÏîÄ¿¹ÜÀí/ClsPM_WorkReportWeekBillMain.cs
New file
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsPM_WorkReportWeekBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HOrgID;        //int       ç»„织
        public Int64 HYear;         //int       å¹´ä»½
        public Int64 HWeek;         //int       å‘¨
        public string HBeginDate;   //datetime  å¼€å§‹æ—¥æœŸ
        public string HEndDate;     //datetime  ç»“束日期
        public Int64 HReportEmpID;    //int       æ€»ç»“人
        public decimal HPlanTimes; // money --计划工时
        public decimal HUseTimes;  // money --消耗工时
        public decimal HRelUseTimes; // money --有效工时
        public decimal HDelayTasks;  // money --延期任务
        public decimal HFineTasks;  // money --超前任务
        public decimal HFinishRate;  // money --达成率
        public string HWorkReport;  //varchar(1000) --工作总结
        public string HNextPlan; //varchar(1000) --主导项目的下一步计划
        public string HWorkGain;  //varchar(1000) --工作心得
    }
}
Model/ÏîÄ¿¹ÜÀí/ClsPM_WorkReportWeekBillSub.cs
New file
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsPM_WorkReportWeekBillSub : DBUtility.ClsXt_BaseBillMain
    {
    }
}
WebAPI/Controllers/ÏîÄ¿¹ÜÀí/¹¤×÷Öܼƻ®/PM_WorkTaskWeekBillController.cs
@@ -20,6 +20,8 @@
        public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public DAL.ClsPM_WorkTaskWeekBill BillNew0 = new DAL.ClsPM_WorkTaskWeekBill();   //工作周计划对应单据类
        public DAL.ClsPM_WorkTaskWeekBill BillOld0 = new DAL.ClsPM_WorkTaskWeekBill();   //工作周计划对应单据类
        public DAL.ClsPM_WorkReportWeekBillMain BillNew = new DAL.ClsPM_WorkReportWeekBillMain();   //工作周总结对应单据类
        public DAL.ClsPM_WorkReportWeekBillMain BillOld = new DAL.ClsPM_WorkReportWeekBillMain();   //工作周总结对应单据类
        #region å·¥ä½œå‘¨è®¡åˆ’ å­è¡¨2-待排计划 æ•°æ®èŽ·å–
@@ -880,5 +882,393 @@
            }
        }
        #endregion
        #region å·¥ä½œå‘¨æ€»ç»“ é€‰æ‹©æ€»ç»“人带出工时
        [Route("PM_WorkTaskWeekBill/PM_WorkReportWeekBillMainList")]
        [HttpGet]
        public object PM_WorkReportWeekBillMainList(string HOrgID,string user,string HYear,string HWeek,string HBeginDate,string HEndDate)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("PM_WorkReportWeekBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = "exec h_p_PM_WorkReportWeekBillMain  "+ HOrgID+","+ user+","+ HYear+","+ HWeek+",'"+ HBeginDate + "','"+ HEndDate + "'";
                ds = oCn.RunProcReturn(sql, "h_p_PM_WorkReportWeekBillMain");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未获取到相关数据!";
                    objJsonResult.data = null;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds.Tables[0];
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region å·¥ä½œå‘¨æ€»ç»“保存/编辑
        /// <summary>
        /// ä¿å­˜ç”Ÿäº§é¢†æ–™å•
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("PM_WorkTaskWeekBill/SavePM_WorkReportWeekBillMain")]
        [HttpPost]
        public object SavePM_WorkReportWeekBillMain([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string refSav = sArray[1].ToString(); //操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string user = sArray[2].ToString();//用户名
            string UserName = "";
            string s = "";
            ListModels oListModels = new ListModels();
            try
            {
                //保存权限
                if (!DBUtility.ClsPub.Security_Log_second("PM_WorkReportWeekBillMain_Add", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsPM_WorkReportWeekBillMain oBill = new DAL.ClsPM_WorkReportWeekBillMain();
                List<Model.ClsPM_WorkReportWeekBillMain> lsmain = new List<Model.ClsPM_WorkReportWeekBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_PM_WorkReportWeekBillMain(msg2);
                foreach (Model.ClsPM_WorkReportWeekBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (BillOld.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (BillOld.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = s + ",不允许修改";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "4757";
                    oItem.HBillSubType = "4757";
                    //oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (refSav == "Add")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (refSav == "Update")
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = false;
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ä½œå‘¨æ€»ç»“ å®¡æ ¸/反审核功能
        [Route("PM_WorkTaskWeekBill/CheckPM_WorkReportWeekBillMain")]
        [HttpGet]
        public object CheckSc_ICMOReportBill(string HInterID, int IsAudit, string user)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("PM_WorkReportWeekBillMain_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain where HInterID=" + HInterID, "PM_WorkReportWeekBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCn.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥ä½œå‘¨æ€»ç»“ å…³é—­/反关闭功能
        [Route("PM_WorkTaskWeekBill/ClosePM_WorkReportWeekBillMain")]
        [HttpGet]
        public object ClosePM_WorkReportWeekBillMain(string HInterID, int IsAudit, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("PM_WorkReportWeekBillMain_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCn.RunProcReturn("select * from PM_WorkReportWeekBillMain where HInterID=" + HInterID, "PM_WorkReportWeekBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能再次关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未关闭!不需要反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCn.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    oCn.RunProc("update PM_WorkReportWeekBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCn.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/ListModels.cs
@@ -969,6 +969,17 @@
            List<Models.ClsGy_StockCheckItemBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_StockCheckItemBill>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增周总结表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsPM_WorkReportWeekBillMain> getObjectByJson_PM_WorkReportWeekBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsPM_WorkReportWeekBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPM_WorkReportWeekBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增模具保养记录表主表的json