1
duhe
2024-01-29 2c94ac81135dea89de381ba6985fc48fa3e800b6
1
21个文件已修改
3个文件已添加
2543 ■■■■■ 已修改文件
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/CGGL/Cg_PORequestBillController.cs 303 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcExchRecordBackBillController.cs 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcExchWWSendWorkBillController.cs 443 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/品质管理/工序检验单/MES_ProcessCheckBill_PDAController.cs 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/工资管理/Pay_ErrWorkTimesRequestBillController.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/工资管理/Pay_GroupBalBillController.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/工资管理/Pay_ProcPriceRequestBillController.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/工资管理/Pay_SingleBalBillController.cs 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/项目管理/工作周计划/PM_WorkTaskWeekBillController.cs 390 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/工资管理/ClsPay_OtherBalBill.cs 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/工资管理/ClsPay_WorkTimesBill.cs 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -775,6 +775,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
@@ -970,6 +970,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/CGGL/Cg_PORequestBillController.cs
@@ -174,6 +174,26 @@
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //保存前控制=========================================
                    ds = oCN.RunProcReturn("exec h_p_Cg_PORequestBill_BeforeSaveCtrl " + HInterID, "h_p_Cg_PORequestBill_BeforeSaveCtrl");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    DataSet Ds;
                    Int64 NewHInterID = 1;
                    Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_PORequestBillMain", "Cg_PORequestBillMain");
@@ -303,13 +323,33 @@
                
                oCN.RunProc(sql);
            }
            //保存后控制=========================================
            ds = oCN.RunProcReturn("exec h_p_Cg_PORequestBill_AfterSaveCtrl " + HInterID, "h_p_Cg_PORequestBill_AfterSaveCtrl");
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存后判断失败!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                objJsonResult.data = null;
                return objJsonResult;
            }
            //=========================================================
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        [Route("Cg_PORequestBill/Cg_PORequestBillSaveApi")]
        [HttpPost]
        public object Cg_PORequestBillSaveApi([FromBody] JObject sMainSub)
@@ -481,6 +521,7 @@
        [HttpGet]
        public object AuditCg_PORequestBill(string HInterID, int Type, string user)
        {
            string sql = "";
            try
            {
                //判断是否有审核权限
@@ -503,90 +544,94 @@
                }
                ClsPub.CurUserName = user;
                ds = oCN.RunProcReturn("select * from Cg_PORequestBillMain where HInterID = " + int.Parse(HInterID), "Cg_PORequestBillMain");
                string HBillNo = "";
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                }
                BillOld.MvarItemKey = "Cg_PORequestBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    //审核前控制
                    sql = "exec h_p_Cg_PORequestBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_PORequestBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Cg_PORequestBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    //反审核前控制
                    sql = "exec h_p_Cg_PORequestBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_PORequestBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能进行反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Cg_PORequestBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -737,7 +782,135 @@
        }
        #endregion
        #region é‡‡è´­ç”³è¯·å• ä½œåºŸ/反作废功能
        [Route("Cg_PORequestBill/DropCg_PORequestBill")]
        [HttpGet]
        public object DropCg_PORequestBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Cg_PORequestBill_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限作废!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Cg_PORequestBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 ä½œåºŸ  2  åä½œåºŸ
                if (Type == 1)
                {
                    //判断单据是否已经作废
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能进行作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不需要再作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //作废单据
                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    //判断单据是否已经反作废
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能进行作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未作废!不需要再反作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反作废单据
                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -785,6 +785,7 @@
                string msg2 = "[" + sArray[0].ToString() + "]";
                string user = sArray[1].ToString();//用户名
                string OperationType = sArray[2].ToString();//类型
                string msg_entry = sArray[3].ToString(); //明细行信息
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Edit", 1, false, user))
@@ -795,6 +796,8 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
                List<Model.ClsQC_FirstPieceCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillMain>>(msg2);
                string BillType = "7505";
@@ -807,6 +810,7 @@
                double HPeriod = DateTime.Now.Month;
                long HSourceID = list[0].HSourceID;//生产资源
                long HICMOInterID = list[0].HICMOInterID;//任务单ID
                long HICMOEntryID = list[0].HICMOEntryID;//任务单子ID
                string HICMOBillNo = list[0].HICMOBillNo;//任务单
                string HProcExchBillNo = list[0].HProcExchBillNo;//指引卡
                long HMaterID = list[0].HMaterID;//产品ID
@@ -814,6 +818,60 @@
                long HProcID = list[0].HProcID;//工序ID
                long HPRDORGID = list[0].HPRDORGID;//组织ID
                bool HLastResult = list[0].HLastResult;//试样结论
                //表体数据
                List<Model.ClsQC_FirstPieceCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub>>(msg_entry);
                for (int i = 0; i < subList.ToArray().Length; i++)
                {
                    if (subList.ToArray().Length >= 0)
                    {
                        Model.ClsQC_FirstPieceCheckBillSub oSub = new Model.ClsQC_FirstPieceCheckBillSub();
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark);
                        oSub.HSourceInterID = ClsPub.isLong(subList[i].HSourceInterID);
                        oSub.HSourceEntryID = ClsPub.isLong(subList[i].HSourceEntryID);
                        oSub.HSourceBillType = ClsPub.isStrNull(subList[i].HSourceBillType);
                        oSub.HSourceBillNo = ClsPub.isStrNull(subList[i].HSourceBillNo);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[i].HRelationQty);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[i].HRelationMoney);
                        oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[i].HCloseMan);
                        oSub.HCloseType = DBUtility.ClsPub.isBool(subList[i].HCloseType);
                        oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(subList[i].HQCCheckItemID);
                        oSub.HQCStd = DBUtility.ClsPub.isStrNull(subList[i].HQCStd);
                        oSub.HResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
                        //oSub.HProcCheckTime = HDate;
                        //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
                        //oSub.HProcCheckEmp = ClsPub.isLong(mainList[0].HFirstCheckEmp);
                        oSub.HSampleSchemeID = DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID);
                        oSub.HSampleQty = DBUtility.ClsPub.isLong(subList[i].HSampleQty);
                        oSub.HSampleDamageQty = DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty);
                        oSub.HAcceptQty = DBUtility.ClsPub.isLong(subList[i].HAcceptQty);
                        oSub.HRejectQty = DBUtility.ClsPub.isLong(subList[i].HRejectQty);
                        oSub.HSampleUnRightQty = DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty);
                        oSub.HStatus = DBUtility.ClsPub.isStrNull(subList[i].HStatus);
                        oSub.HUnitID = DBUtility.ClsPub.isLong(subList[i].HUnitID);
                        oSub.HInspectVal = DBUtility.ClsPub.isStrNull(subList[i].HInspectVal);
                        oSub.HTargetVal = DBUtility.ClsPub.isStrNull(subList[i].HTargetVal);
                        oSub.HUpLimit = DBUtility.ClsPub.isStrNull(subList[i].HUpLimit);
                        oSub.HDownLimit = DBUtility.ClsPub.isStrNull(subList[i].HDownLimit);
                        oSub.HUpOffSet = DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet);
                        oSub.HDownOffSet = DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet);
                        oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod);
                        oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                        oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
                        oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult == "true" ? 1 : 0);
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无明细行信息!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //单据完整性判断
                if (HProcExchBillNo == "")
@@ -844,11 +902,29 @@
                    }
                    oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " +
                    "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                    ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOBillNo,HProcExchBillNo" +
                    ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchBillNo" +
                    ",HPRDORGID,HLastResult)" +
                    " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
                    "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + "," + HICMOEntryID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" +
                    "," + HPRDORGID + ",'" + HLastResult + "') ");
                    //插入子表
                    foreach (Model.ClsQC_FirstPieceCheckBillSub oSub in BillNew.DetailColl)
                    {
                        oCN.RunProc("Insert into QC_FirstPieceCheckBillSub " +
                          " (HInterID,HBillNo_bak,HEntryID" +
                          ",HRemark,HSourceInterID" +
                          ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                          ",HQCCheckItemID,HQCStd,HResult" +
                          ",HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" +
                          ") values("
                          + HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + HICMOInterID.ToString() +
                          "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                          "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" +
                          ",'" + oSub.HStatus +
                          "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" +
                          ") ");
                    }
                }
                else
                {
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -815,8 +815,31 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //审核前控制
                string HBillNo = oBill.omodel.HBillNo;
                string sql = "exec h_p_Sc_StationInBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeCheckCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //审核
                if (Cj_StationInBillCheckBill(HInterID,CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                if (Cj_StationInBillCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -845,7 +868,7 @@
        }
        //审核
        public bool Cj_StationInBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
        public bool Cj_StationInBillCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, ref string sReturn)
        {
            try
            {
@@ -873,6 +896,23 @@
                else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是")
                {
                }
                //审核后控制
                string sql = "exec h_p_Sc_StationInBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterCheckCtrl");
                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;
                }
                sReturn = sReturn + " å®¡æ ¸åŠŸèƒ½ï¼";
                oCN.Commit();
                return true;
@@ -949,8 +989,31 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //反审核前控制
                string HBillNo = oBill.omodel.HBillNo;
                string sql = "exec h_p_Sc_StationInBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeUnCheckCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //反审核
                if (Cj_StationInBillAbandonCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                if (Cj_StationInBillAbandonCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
@@ -978,7 +1041,7 @@
        }
        //反审核
        public bool Cj_StationInBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
        public bool Cj_StationInBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, ref string sReturn)
        {
            if (Cj_StationInBillisUse(lngBillKey, ref sReturn))
            {
@@ -1011,6 +1074,23 @@
                else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是")
                {
                }
                //反审核后控制
                string sql = "exec h_p_Sc_StationInBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterUnCheckCtrl");
                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;
                }
                sReturn = sReturn + "反审核功能!";
                oCN.Commit();
                return true;
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -2496,12 +2496,13 @@
                }
              
            
                var HBillNo = HInterID.Split(',');
                var HInterIDs = HInterID.Split(',');
                string[] HBillNo = new string[HInterIDs.Length];
                DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
                for (int i = 0; i < HBillNo.Length; i++)
                for (int i = 0; i < HInterIDs.Length; i++)
                {
                    if (HBillNo[i] == "0")
                    if (HInterIDs[i] == "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
@@ -2510,7 +2511,7 @@
                        return objJsonResult;
                    }
                    //查看是否已审核,关闭,作废
                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                    if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
@@ -2520,6 +2521,7 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        HBillNo[i] = oBill.omodel.HBillNo;
                    }
                    else
                    {
@@ -2532,10 +2534,32 @@
                }
                int j = 0;
                for (int i = 0; i < HBillNo.Length; i++)
                for (int i = 0; i < HInterIDs.Length; i++)
                {
                    //审核前控制
                    string sql = "exec h_p_Sc_StationOutBill_BeforeCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核
                    if (Cj_StationOutBillCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                    if (Cj_StationOutBillCheckBill(long.Parse(HInterIDs[i]), HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        j += 1;
                    }
@@ -2566,7 +2590,7 @@
        }
        //审核
        public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string CurUserName,bool HLastSubProc, ref string sReturn)
        public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string HBillNo, string CurUserName,bool HLastSubProc, ref string sReturn)
        {
            try
            {
@@ -2594,6 +2618,23 @@
                else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是")
                {
                }
                //审核后控制
                string sql = "exec h_p_Sc_StationOutBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterCheckCtrl");
                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;
                }
                sReturn = sReturn + " å®¡æ ¸åŠŸèƒ½ï¼";
                oCN.Commit();
                return true;
@@ -2640,16 +2681,17 @@
                }
              
                var HBillNo = HInterID.Split(',');
                var HInterIDs = HInterID.Split(',');
                string[] HBillNo = new string[HInterIDs.Length];
                DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
                //获取系统参数
                string Ret = "";
                oSystemParameter.ShowBill(ref Ret);
                    for (int i = 0; i < HBillNo.Length; i++)
                    for (int i = 0; i < HInterIDs.Length; i++)
                {
                    if (long.Parse(HBillNo[i]) == 0)
                    if (long.Parse(HInterIDs[i]) == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
@@ -2659,7 +2701,7 @@
                    }
                    //查看是否已审核,关闭,作废
                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                    if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
@@ -2682,6 +2724,8 @@
                                return objJsonResult;
                            }
                        }
                        HBillNo[i] = oBill.omodel.HBillNo;
                    }
                    else
                    {
@@ -2694,10 +2738,31 @@
                }
                int j = 0;
                for (int i = 0; i < HBillNo.Length; i++)
                for (int i = 0; i < HInterIDs.Length; i++)
                {
                    //反审核前控制
                    string sql = "exec h_p_Sc_StationOutBill_BeforeUnCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核
                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HInterIDs[i]),HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        j += 1;
                    }
@@ -2728,7 +2793,7 @@
        }
        //反审核
        public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, bool HLastSubProc, ref string sReturn)
        public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, bool HLastSubProc, ref string sReturn)
        {
            if (Cj_StationInBillisUse(lngBillKey, ref sReturn))
            {
@@ -2761,6 +2826,23 @@
                else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是")
                {
                }
                //反审核后控制
                string sql = "exec h_p_Sc_StationOutBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterUnCheckCtrl");
                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;
                }
                sReturn = sReturn + "反审核功能!";
                oCN.Commit();
                return true;
WebAPI/Controllers/CJGL/Sc_ProcExchRecordBackBillController.cs
@@ -334,6 +334,7 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string HBillNo = "";
                DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchRecordBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchRecordBackBillMain");
                if (Ds.Tables[0].Rows.Count > 0)
@@ -346,6 +347,28 @@
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核前控制
                        HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString();
                        string sql = "exec h_p_Sc_ProcExchRecordBackBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                        Ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchRecordBackBill_BeforeCheckCtrl");
                        if (Ds == null || Ds.Tables.Count == 0 || Ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (Ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + Ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -363,9 +386,30 @@
                            return objJsonResult;
                        }
                        //反审核前控制
                        HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString();
                        string sql = "exec h_p_Sc_ProcExchRecordBackBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                        Ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchRecordBackBill_BeforeUnCheckCtrl");
                        if (Ds == null || Ds.Tables.Count == 0 || Ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (Ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + Ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //审核
                    if (Cj_StationInBillCheckBill(HInterID, num, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                    if (Cj_StationInBillCheckBill(HInterID, HBillNo, num, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -403,7 +447,7 @@
        }
        //审核
        public bool Cj_StationInBillCheckBill(Int64 HInterID, int num, string CurUserName, ref string sReturn)
        public bool Cj_StationInBillCheckBill(Int64 HInterID,string HBillNo, int num, string CurUserName, ref string sReturn)
        {
            try
            {
@@ -411,11 +455,43 @@
                if (num == 1)
                {
                    oCN.RunProc(" Update Sc_ProcExchRecordBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString());
                    //审核后控制
                   string sql = "exec h_p_Sc_ProcExchRecordBackBill_AfterCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchRecordBackBill_AfterCheckCtrl");
                    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;
                    }
                }
                if (num == 2)
                {
                    oCN.RunProc(" Update Sc_ProcExchRecordBackBillMain set HChecker='',HBillStatus=1,HCheckDate=null Where HInterID=" + HInterID.ToString());
                    //反审核后控制
                    string sql = "exec h_p_Sc_ProcExchRecordBackBill_AfterUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchRecordBackBill_AfterUnCheckCtrl");
                    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();
WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
@@ -315,8 +315,31 @@
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcExchSendWorkBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchSendWorkBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -342,8 +365,31 @@
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcExchSendWorkBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchSendWorkBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchSendWorkBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
@@ -492,5 +538,7 @@
        }
        #endregion
    }
}
WebAPI/Controllers/CJGL/Sc_ProcExchWWSendWorkBillController.cs
@@ -240,5 +240,448 @@
        }
        //#endregion
        #region å·¥åºå§”外派工单审核/反审核功能
        [Route("WW_EntrustWorkOrderBill/CheckSWW_EntrustWorkOrderBill")]
        [HttpGet]
        public object CheckSWW_EntrustWorkOrderBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限  å§”外工序派工单_审核
                if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcSendWorkBill_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "WW_EntrustWorkOrderBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_WW_EntrustWorkOrderBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_WW_EntrustWorkOrderBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_WW_EntrustWorkOrderBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_WW_EntrustWorkOrderBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_WW_EntrustWorkOrderBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_WW_EntrustWorkOrderBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºå§”外派工单 å…³é—­/反关闭功能
        [Route("WW_EntrustWorkOrderBill/CloseWW_EntrustWorkOrderBill")]
        [HttpGet]
        public object CloseWW_EntrustWorkOrderBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限  å§”外工序派工单_关闭
                if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcSendWorkBill_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "WW_EntrustWorkOrderBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不需要再关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºå§”外派工单 ä½œåºŸ/反作废
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">作废(0),反作废(1)</param>
        /// <param name="CurUserName">作废人</param>
        /// <returns></returns>
        [Route("WW_EntrustWorkOrderBill/DropWW_EntrustWorkOrderBill")]
        [HttpGet]
        public object DropWW_EntrustWorkOrderBill(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "WW_EntrustProcSendWorkBill_Drop";   //委外工序派工单_作废
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "作废失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select  * from WW_EntrustWorkOrderBillMain", "WW_EntrustWorkOrderBillMain");
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (ds.Tables[0].Rows.Count>0)                    //根据HInterID获取该单据的数据
                {
                    if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行作废!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //作废判断
                    {
                        if (ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能再作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反作废判断
                    {
                        if (ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未作废!不需要反作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的作废/反作废操作
                if (IsAudit == 0) //作废提交
                {
                    //作废提交
                    if (Cancelltion(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "作废成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭提交
                    if (AbandonCancelltion(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反作废成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //作废
        public bool Cancelltion(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                string HDeleteMan = ClsPub.CurUserName;
                string HDeleteDate = ClsPub.GetServerDate(-1);
                oCN.RunProc(" Update WW_EntrustWorkOrderBillMain set HDeleteMan='" + HDeleteMan + "',HDeleteDate='" + HDeleteDate + "',HBillStatus=4 Where HInterID=" + lngBillKey.ToString());
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        //反作废
        public bool AbandonCancelltion(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                DataSet ds = oCN.RunProcReturn("select * from WW_EntrustWorkOrderBillMain where HInterID=" + lngBillKey.ToString(), "WW_EntrustWorkOrderBillMain");
                if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                {
                    oCN.RunProc(" Update WW_EntrustWorkOrderBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus=3 Where HInterID=" + lngBillKey.ToString());
                }
                else if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                {
                    oCN.RunProc(" Update WW_EntrustWorkOrderBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus=2 Where HInterID=" + lngBillKey.ToString());
                }
                else
                {
                    oCN.RunProc(" Update WW_EntrustWorkOrderBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus=1 Where HInterID=" + lngBillKey.ToString());
                }
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        #endregion
    }
}
WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
@@ -429,7 +429,7 @@
        //}
        //#endregion
        #region å·¥è‰ºè·¯çº¿å®¡æ ¸/反审核功能
        #region å·¥åºè¿”工申请单 å®¡æ ¸/反审核功能
        [Route("Sc_ProcExchWorkBackBill/CheckSc_ProcExchWorkBackBill")]
        [HttpGet]
        public object CheckSc_ProcExchWorkBackBill(string HInterID, int Type, string user)
@@ -477,8 +477,32 @@
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcExchWorkBackBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchWorkBackBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchWorkBackBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -504,8 +528,31 @@
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcExchWorkBackBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchWorkBackBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchWorkBackBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1386,8 +1386,32 @@
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcessExchangeBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcessExchangeBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcessExchangeBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -1413,8 +1437,31 @@
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Sc_ProcessExchangeBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcessExchangeBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcessExchangeBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
WebAPI/Controllers/Æ·ÖʹÜÀí/¹¤Ðò¼ìÑéµ¥/MES_ProcessCheckBill_PDAController.cs
@@ -34,6 +34,7 @@
                string msg2 = "[" + sArray[0].ToString() + "]";
                string user = sArray[1].ToString();//用户名
                string OperationType = sArray[2].ToString();//类型
                string msg_entry = sArray[3].ToString(); //明细行信息
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("QC_ProcessCheckBill_Edit", 1, false, user))
@@ -44,6 +45,7 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsQC_ProcessCheckBill BillNew = new DAL.ClsQC_ProcessCheckBill();
                List<Model.ClsQC_ProcessCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_ProcessCheckBillMain>>(msg2);
                string BillType = "7507";
@@ -56,6 +58,7 @@
                double HPeriod = DateTime.Now.Month;
                long HSourceID = list[0].HSourceID;//生产资源
                long HICMOInterID = list[0].HICMOInterID;//任务单ID
                long HICMOEntryID = list[0].HICMOEntryID;//任务单子ID
                string HICMOBillNo = list[0].HICMOBillNo;//任务单
                string HProcExchBillNo = list[0].HProcExchBillNo;//指引卡
                long HMaterID = list[0].HMaterID;//产品ID
@@ -63,6 +66,61 @@
                long HProcID = list[0].HProcID;//工序ID
                long HPRDORGID = list[0].HPRDORGID;//组织ID
                bool HLastResult = list[0].HLastResult;//试样结论
                //表体数据
                List<Model.ClsQC_ProcessCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_ProcessCheckBillSub>>(msg_entry);
                for (int i = 0; i < subList.ToArray().Length; i++)
                {
                    if (subList.ToArray().Length >= 0)
                    {
                        Model.ClsQC_ProcessCheckBillSub oSub = new Model.ClsQC_ProcessCheckBillSub();
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark);
                        oSub.HSourceInterID = ClsPub.isLong(subList[i].HSourceInterID);
                        oSub.HSourceEntryID = ClsPub.isLong(subList[i].HSourceEntryID);
                        oSub.HSourceBillType = ClsPub.isStrNull(subList[i].HSourceBillType);
                        oSub.HSourceBillNo = ClsPub.isStrNull(subList[i].HSourceBillNo);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[i].HRelationQty);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[i].HRelationMoney);
                        oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[i].HCloseMan);
                        oSub.HCloseType = DBUtility.ClsPub.isBool(subList[i].HCloseType);
                        oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(subList[i].HQCCheckItemID);
                        oSub.HQCStd = DBUtility.ClsPub.isStrNull(subList[i].HQCStd);
                        oSub.HResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
                        oSub.HQCRelValue = DBUtility.ClsPub.isStrNull(subList[i].HQCRelValue);
                        //oSub.HProcCheckTime = HDate;
                        //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
                        //oSub.HProcCheckEmp = ClsPub.isLong(mainList[0].HFirstCheckEmp);
                        oSub.HSampleSchemeID = DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID);
                        oSub.HSampleQty = DBUtility.ClsPub.isLong(subList[i].HSampleQty);
                        oSub.HSampleDamageQty = DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty);
                        oSub.HAcceptQty = DBUtility.ClsPub.isLong(subList[i].HAcceptQty);
                        oSub.HRejectQty = DBUtility.ClsPub.isLong(subList[i].HRejectQty);
                        oSub.HSampleUnRightQty = DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty);
                        oSub.HStatus = DBUtility.ClsPub.isStrNull(subList[i].HStatus);
                        oSub.HUnitID = DBUtility.ClsPub.isLong(subList[i].HUnitID);
                        oSub.HInspectVal = DBUtility.ClsPub.isStrNull(subList[i].HInspectVal);
                        oSub.HTargetVal = DBUtility.ClsPub.isStrNull(subList[i].HTargetVal);
                        oSub.HUpLimit = DBUtility.ClsPub.isStrNull(subList[i].HUpLimit);
                        oSub.HDownLimit = DBUtility.ClsPub.isStrNull(subList[i].HDownLimit);
                        oSub.HUpOffSet = DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet);
                        oSub.HDownOffSet = DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet);
                        oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod);
                        oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                        oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
                        oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult == "true" ? 1 : 0);
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无明细行信息!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //单据完整性判断
                if (HProcExchBillNo == "")
@@ -93,11 +151,29 @@
                    }
                    oCN.RunProc("Insert Into QC_ProcessCheckBillMain " +
                    "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
                    ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOBillNo,HProcExchBillNo" +
                    ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchBillNo" +
                    ",HPRDORGID,HLastResult)" +
                    " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" +
                    "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + "," + HICMOEntryID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" +
                    "," + HPRDORGID + ",'" + HLastResult + "') ");
                    //插入子表
                    foreach (Model.ClsQC_ProcessCheckBillSub oSub in BillNew.DetailColl)
                    {
                        oCN.RunProc("Insert into QC_ProcessCheckBillSub " +
                          " (HInterID,HBillNo_bak,HEntryID" +
                          ",HRemark,HSourceInterID" +
                          ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                          ",HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue,HResult" +
                          ",HProcCheckEmp,HProcCheckTime,HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" +
                          ") values("
                          + HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() +  ",'" + oSub.HRemark + "'," + HICMOInterID.ToString() +
                          "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                          "," + oSub.HQCCheckClassID.ToString() + "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HQCRelValue + "','" + oSub.HResult + "'" +
                          "," + oSub.HProcCheckEmp.ToString() + ",GETDATE()"  + ",'"  + oSub.HStatus +
                          "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'"  +
                          ") ");
                    }
                }
                else
                {
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_ErrWorkTimesRequestBillController.cs
@@ -205,19 +205,27 @@
                string HBackerDate = mainList[0].HBackerDate;
                string HBackRemark = mainList[0].HBackRemark;
                //if (OperationType == 2)
                //{
                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 0;
                //        objJsonResult.Message = "单据号重复,请重新输入!";
                //        objJsonResult.data = null;
                //        return objJsonResult;
                //    }
                //}
                //保存前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Pay_ErrWorkTimesRequestBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_ErrWorkTimesRequestBill_BeforeSaveCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                ds = oCN.RunProcReturn("select * from Pay_ErrWorkTimesRequestBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_ErrWorkTimesRequestBillMain");
@@ -300,11 +308,35 @@
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
                //保存后控制
                DataSet AfterDs = oCN.RunProcReturn("Exec h_p_Pay_ErrWorkTimesRequestBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_ErrWorkTimesRequestBill_AfterSaveCtrl");
                if (AfterDs == null || AfterDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(AfterDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(AfterDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = null;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
            }
            catch (Exception e)
            {
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_GroupBalBillController.cs
@@ -553,19 +553,27 @@
                string HBackerDate = mainList[0].HBackerDate;
                string HBackRemark = mainList[0].HBackRemark;
                //if (OperationType == 2)
                //{
                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 0;
                //        objJsonResult.Message = "单据号重复,请重新输入!";
                //        objJsonResult.data = null;
                //        return objJsonResult;
                //    }
                //}
                //保存前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Pay_GroupBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_BeforeSaveCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                ds = oCN.RunProcReturn("select * from Pay_GroupBalBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_GroupBalBillMain");
@@ -650,11 +658,35 @@
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
                //保存后控制
                DataSet AfterDs = oCN.RunProcReturn("Exec h_p_Pay_GroupBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_GroupBalBill_AfterSaveCtrl");
                if (AfterDs == null || AfterDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(AfterDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(AfterDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = null;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
            }
            catch (Exception e)
            {
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_ProcPriceRequestBillController.cs
@@ -186,19 +186,27 @@
                string HBackerDate = mainList[0].HBackerDate;
                string HBackRemark = mainList[0].HBackRemark;
                //if (OperationType == 2)
                //{
                //    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectBillMain");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 0;
                //        objJsonResult.Message = "单据号重复,请重新输入!";
                //        objJsonResult.data = null;
                //        return objJsonResult;
                //    }
                //}
                //保存前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Pay_ProcPriceRequestBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_ProcPriceRequestBill_BeforeSaveCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                ds = oCN.RunProcReturn("select * from Pay_ProcPriceRequestBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_ProcPriceRequestBillMain");
@@ -264,11 +272,35 @@
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
                //保存后控制
                DataSet AfterDs = oCN.RunProcReturn("Exec h_p_Pay_ProcPriceRequestBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_ProcPriceRequestBill_AfterSaveCtrl");
                if (AfterDs == null || AfterDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(AfterDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(AfterDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = null;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
            }
            catch (Exception e)
            {
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_SingleBalBillController.cs
@@ -607,20 +607,28 @@
                DateTime HMakerDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString());
                string HUpdater = mainList[0].HUpdater;
                DateTime HUpdaterDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString());
                //if (OperationType == 2)
                //{
                //    ds = oCN.RunProcReturn("select * from PM_ProjectStageBillMain where HBillNo ='" + HBillNo + "'", "PM_ProjectStageBill");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        objJsonResult.code = "0";
                //        objJsonResult.count = 0;
                //        objJsonResult.Message = "单据号重复,请重新输入!";
                //        objJsonResult.data = null;
                //        return objJsonResult;
                //    }
                //}
                //保存前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Pay_SingleBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_SingleBalBill_BeforeSaveCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                ds = oCN.RunProcReturn("select * from Pay_SingleBalBillMain where HInterID = " + HInterID + " and HBillNo = '" + HBillNo + "'", "Pay_SingleBalBillMain");
@@ -811,11 +819,35 @@
                oCN.RunProc(sql);
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
            //保存后控制
            DataSet AfterDs = oCN.RunProcReturn("Exec h_p_Pay_SingleBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_SingleBalBill_AfterSaveCtrl");
            if (AfterDs == null || AfterDs.Tables[0].Rows.Count == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存后判断失败!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            else
            {
                if (DBUtility.ClsPub.isLong(AfterDs.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(AfterDs.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = null;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
        }
        #endregion
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/DLL/¹¤×ʹÜÀí/ClsPay_OtherBalBill.cs
@@ -31,6 +31,87 @@
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //保存前控制
        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_OtherBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_OtherBalBill_BeforeSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //保存后控制
        public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_OtherBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_OtherBalBill_AfterSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存后判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        public bool CheckStockQty(long HMaterID, long HWhID, string sBatchNo)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select å³æ—¶åº“å­˜ from h_v_KF_ICInventoryList Where HMaterID=" + HMaterID.ToString() + " and HWHID=" + HWhID.ToString() + " and æ‰¹æ¬¡='" + sBatchNo + "'", "h_v_KF_ICInventoryList");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                //判断是否负库存或0库存
                if (DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0][0]) <= 0)
                {
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
@@ -38,6 +119,12 @@
            {
                //
                oCn.BeginTran();
                //保存前控制
                if(!BeforeSave(lngBillKey, omodel.HBillNo,2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //更新主表
                oCn.RunProc("UpDate Pay_OtherBalBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
@@ -94,6 +181,12 @@
                //        return false;
                //    }
                //}
                //保存后控制
                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -114,6 +207,12 @@
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //主表
                oCn.RunProc("Insert Into Pay_OtherBalBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
@@ -159,6 +258,12 @@
                //    }
                //}
                //
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
WebAPI/DLL/¹¤×ʹÜÀí/ClsPay_WorkTimesBill.cs
@@ -29,8 +29,64 @@
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //保存前控制
        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_WorkTimesBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_WorkTimesBill_BeforeSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //保存后控制
        public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_WorkTimesBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_WorkTimesBill_AfterSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存后判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
@@ -38,6 +94,12 @@
            {
                //
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //更新主表
                oCn.RunProc("UpDate Pay_WorkTimesBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
@@ -89,6 +151,12 @@
                //        return false;
                //    }
                //}
                //保存后控制
                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -109,6 +177,12 @@
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //主表
                oCn.RunProc("Insert Into Pay_WorkTimesBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
@@ -151,6 +225,12 @@
                //    }
                //}
                //
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
WebAPI/ListModels.cs
@@ -999,6 +999,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
WebAPI/Web.config
@@ -22,7 +22,7 @@
        <!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>-->
        <!--<add key="FileIP" value="http://localhost:8080/" />-->
        <!--<add key="sUrl" value="http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"/>    -->
        <!--<add key="sUrl" value="http://192.168.63.20/WEBS-WMS/WebService1.asmx"/>--><!--颜台式机-->
        <add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/><!--颜台式机-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> å¤å®-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> -->
        <!--<add key="sUrl" value="http://10.10.130.181/WEBS-WMS/WebService1.asmx"/>    åšæ—¥ç§‘技-->
@@ -34,7 +34,9 @@
        <!--<add key="sUrl" value="http://192.168.80.90:9090/WEBS-WMS/WebService1.asmx"/>     å®‰ç‘žæœåС噍-->
        <!--<add key="sUrl" value="http://47.96.97.237/WEBS-WMS/WebService1.asmx"/> -->    <!--测试服务器-->
        <!--<add key="sUrl" value="http://localhost:8082/WEBS/WebService1.asmx"/>    æœ¬åœ°-->
        <add key="sUrl" value="http://192.168.56.1:81/web/WebService1.asmx"/>    <!--陈雯静本地配置-->
        <!--<add key="sUrl" value="http://192.168.56.1:81/web/WebService1.asmx"/>-->    <!--陈雯静本地配置-->
        <!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>--> <!--九菱-->
        <!--<add key="sUrl" value="http://192.168.60.12/WEBS-WMS/WebService1.asmx"/>--> <!--中控-->
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />