yusijie
2024-05-09 a2907d537c8406d14db6dd18ad2336190c6d5d40
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
15个文件已修改
11个文件已添加
3297 ■■■■■ 已修改文件
DAL/DAL.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/模具管理/ClsSc_MouldProdOutBill.cs 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/设备管理/ClsSb_EquipBeginBillMain.cs 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/设备管理/ClsSb_EquipStopBillMain.cs 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DBUtility/业务单据/ClsXt_BaseBillSub.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
EAM/模具管理/模具仓库管理/Sc_MouldProdOutBill.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/基础资料/ClsGy_PreventErrMould_Model.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/模具管理/ClsSc_MouldProdOutBillMain.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/模具管理/ClsSc_MouldProdOutBillSub.cs 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/模具管理/ClsSc_MouldStockBillSub.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipBeginBillMain.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipBeginBillSub.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipStopBillMain.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipStopBillSub.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipBeginBillController.cs 744 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipStopBillController.cs 744 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 272 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/条码管理/MouldController.cs 337 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_MouldProdOutBill.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Service/LuBaoSevice.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -639,6 +639,8 @@
    <Compile Include="生产管理\设备管理\ClsGy_EquipTypeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardChangeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipBeginBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStopBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipSparepartsBill.cs" />
DAL/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/ClsSc_MouldProdOutBill.cs
@@ -17,9 +17,9 @@
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="Sc_MouldStockBillMain";
            base.MvarReportTitle = "模具领用单";
            base.BillType="3796";
            base.HBillSubType = "3796";
            base.MvarReportTitle = "模具领用出库单";
            base.BillType= "3802";
            base.HBillSubType = "3802";
        }
@@ -29,8 +29,63 @@
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //保存前控制
        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 HSecManagerID, Int64 HKeeperID, Int64 HSupID, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MouldProdOutBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + HSecManagerID.ToString() + "," + HKeeperID.ToString() + "," + HSupID.ToString() + "," + OperationType.ToString(), "h_p_Sc_MouldProdOutBill_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_Sc_MouldProdOutBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldProdOutBill_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 +93,12 @@
            {
                //
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(lngBillKey, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //更新主表
                oCn.RunProc("UpDate Sc_MouldStockBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
@@ -49,16 +110,18 @@
                ",HUpDateDate=getdate()" +
                //========================================
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HWHID=" + omodel.HWHID.ToString() +
                ",HSCWHID=" + omodel.HSCWHID.ToString() +
                ",HSupTypeID=" + omodel.HSupTypeID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HManagerID=" + omodel.HManagerID.ToString() +
                ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
                ",HKeeperID=" + omodel.HKeeperID.ToString() +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HWHID=" + omodel.HWHID.ToString() +
                ",HSCWHID=" + omodel.HSCWHID.ToString() +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +                
                ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
@@ -69,36 +132,32 @@
                foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_MouldStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HDesignLife,HLeaveLife,HUseLife" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" +
                      ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" +
                      ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" +
                      ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" +
                      "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() +
                      "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() +
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" +
                      ") ");
                }
                //
                //foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                sReturn = "修改单据成功!";
                //保存后控制
                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "单据号:" + omodel.HBillNo + " ä¿®æ”¹æˆåŠŸï¼";
                oCn.Commit();
                return true;
            }
@@ -115,58 +174,62 @@
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                if(omodel.HInterID==0)
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, omodel.HSecManagerID, omodel.HKeeperID, omodel.HSupID, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //主表
                oCn.RunProc("Insert Into Sc_MouldStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ",HProcID"+
                ",HSupID,HSupTypeID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HWHID,HSCWHID,HRedBlueFlag" +
                ",HExplanation,HInnerBillNo,HStockOrgID" +
                ") " +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                 "," + '0' +
                ", " + omodel.HSupID.ToString() + "," + omodel.HSupTypeID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString()+
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() +
                ") ");
                //插入子表
                foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_MouldStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HDesignLife,HLeaveLife,HUseLife" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HBatchNo" +
                      ",HQtyMust,HQtyRel,HQty,HPrice,HMoney,HDesignLife" +
                      ",HLeaveLife,HUseLife,HUseLifeQty,HNewLifeQty,HWHID,HSCWHID" +
                      ",HSPID,HSCSPID,HSPGroupID,HBarCode,HCorrespondentTypeID,HCorrespondentID" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ",HStockOrgID,HOWNERID,HOtherOrgID,HOWNERTYPEID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HBatchNo + "'" +
                      "," + oSub.HQtyMust.ToString() + "," + oSub.HQtyRel.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HDesignLife.ToString() +
                      "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + "," + oSub.HUseLifeQty.ToString() + "," + oSub.HNewLifeQty.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() +
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBarCode + "'," + oSub.HCorrespondentTypeID.ToString() + "," + oSub.HCorrespondentID.ToString() +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      "," + oSub.HStockOrgID.ToString() + "," + oSub.HOWNERID.ToString() + "," + oSub.HOtherOrgID.ToString() + ",'" + oSub.HOWNERTYPEID + "'" +
                      ") ");
                }
                //
                //foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //
                sReturn = "新增单据成功!";
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "单据号:" + omodel.HBillNo + " æ–°å¢žæˆåŠŸï¼";
                oCn.Commit();
                return true;
            }
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipBeginBillMain.cs
New file
@@ -0,0 +1,208 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsSb_EquipBeginBillMain : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSb_EquipBeginBillMain omodel = new Model.ClsSb_EquipBeginBillMain();
        public List<Model.ClsSb_EquipBeginBillSub> DetailColl = new List<Model.ClsSb_EquipBeginBillSub>();
        public ClsSb_EquipBeginBillMain()
        {
            base.MvarItemKeySub = "Sb_EquipBeginBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "Sb_EquipBeginBillMain";
            base.MvarReportTitle="设备开机单";
            base.BillType = "3917";
            base.HBillSubType = "3917";
        }
        #region å›ºå®šä»£ç 
        ~ClsSb_EquipBeginBillMain()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sb_EquipBeginBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + omodel.HMaker + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HEquipID=" + omodel.HEquipID.ToString() +
                ",HEquipRelationID='" + omodel.HEquipRelationID.ToString() + "'" +
                ",HBeginEmpID='" + omodel.HBeginEmpID .ToString()+ "'" +
                ",HBeginTime='" + omodel.HBeginTime + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                //DeleteBillSub(lngBillKey);
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                DataSet ds;
                oCn.BeginTran();
                //检查主表内码是否重复,若重复则重新生成并继续检查,直到不再重复
                while (true)
                {
                    ds = oCn.RunProcReturn("select * from Sb_EquipBeginBillMain where HInterID = " + omodel.HInterID, "Sb_EquipBeginBillMain");
                    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 Sb_EquipBeginBillMain" +
                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
                    ",HEquipID,HEquipRelationID ,HBeginEmpID,HBeginTime) " +
                    "values(" +
                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
                    "," + omodel.HPeriod.ToString() +
                    ",'" + this.BillType +
                    "','" + this.HBillSubType +
                    "'," + omodel.HInterID +
                    ",'" + omodel.HDate +
                    "','" + omodel.HBillNo +
                    "','" + omodel.HRemark +
                    "','" + omodel.HMaker +
                    "','" + omodel.HMakeDate +
                    "','" + omodel.HEquipID +
                    "','" + omodel.HEquipRelationID +
                    "','" + omodel.HBeginEmpID +
                    "','" + omodel.HBeginTime +
                    "')";
                oCn.RunProc(mainSql);
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Sb_EquipBeginBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipBeginBillMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                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.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                //
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Sb_EquipBeginBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipBeginBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSb_EquipBeginBillSub oSub = new Model.ClsSb_EquipBeginBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    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();
                    //===================================================
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipStopBillMain.cs
New file
@@ -0,0 +1,210 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsSb_EquipStopBillMain : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSb_EquipStopBillMain omodel = new Model.ClsSb_EquipStopBillMain();
        public List<Model.ClsSb_EquipStopBillSub> DetailColl = new List<Model.ClsSb_EquipStopBillSub>();
        public ClsSb_EquipStopBillMain()
        {
            base.MvarItemKeySub = "Sb_EquipStopBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "Sb_EquipStopBillMain";
            base.MvarReportTitle="设备停机单";
            base.BillType = "3918";
            base.HBillSubType = "3918";
        }
        #region å›ºå®šä»£ç 
        ~ClsSb_EquipStopBillMain()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sb_EquipStopBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + omodel.HMaker + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HEquipID=" + omodel.HEquipID.ToString() +
                ",HEquipRelationID='" + omodel.HEquipRelationID.ToString() + "'" +
                ",HStopEmpID='" + omodel.HStopEmpID .ToString()+ "'" +
                ",HStopTime='" + omodel.HStopTime + "'" +
                ",HStopReason='" + omodel.HStopReason + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                //DeleteBillSub(lngBillKey);
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                DataSet ds;
                oCn.BeginTran();
                //检查主表内码是否重复,若重复则重新生成并继续检查,直到不再重复
                while (true)
                {
                    ds = oCn.RunProcReturn("select * from Sb_EquipStopBillMain where HInterID = " + omodel.HInterID, "Sb_EquipStopBillMain");
                    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 Sb_EquipStopBillMain" +
                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
                    ",HEquipID,HEquipRelationID ,HStopEmpID,HStopTime,HStopReason) " +
                    "values(" +
                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
                    "," + omodel.HPeriod.ToString() +
                    ",'" + this.BillType +
                    "','" + this.HBillSubType +
                    "'," + omodel.HInterID +
                    ",'" + omodel.HDate +
                    "','" + omodel.HBillNo +
                    "','" + omodel.HRemark +
                    "','" + omodel.HMaker +
                    "','" + omodel.HMakeDate +
                    "','" + omodel.HEquipID +
                    "','" + omodel.HEquipRelationID +
                    "','" + omodel.HStopEmpID +
                    "','" + omodel.HStopTime +
                    "','" + omodel.HStopReason +
                    "')";
                oCn.RunProc(mainSql);
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Sb_EquipStopBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipStopBillMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                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.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                //
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Sb_EquipStopBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipStopBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSb_EquipStopBillSub oSub = new Model.ClsSb_EquipStopBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    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();
                    //===================================================
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
DBUtility/ÒµÎñµ¥¾Ý/ClsXt_BaseBillSub.cs
@@ -24,5 +24,9 @@
        public double HRelationMoney;
        public string HRemark;
        public DateTime HEntryCloseDate;
        public Int64 HStockOrgID;   // int          //库存组织
        public Int64 HOWNERID;      // int          //货主
        public Int64 HOtherOrgID;   // int          //其他关联组织
        public string HOWNERTYPEID; // varchar(100) //货主类型
    }
}
EAM/Ä£¾ß¹ÜÀí/Ä£¾ß²Ö¿â¹ÜÀí/Sc_MouldProdOutBill.cs
@@ -77,7 +77,7 @@
        public const Int16 HUnitIDCol = 57;
        //
        public const string ModName = "3796";                   //单据类型
        public const string ModName = "3802";                   //单据类型
        public const string ModCaption = "模具领用单";          //单据名称
        public const string ModRightName = "Sc_MouldProdOutBill";
        public const string ModRightNameEdit = ModRightName + "_Edit";
Model/Model.csproj
@@ -364,6 +364,7 @@
    <Compile Include="基础资料\基础资料\ClsGy_DotCheckItemMethod_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_DotCheckItemClass_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_ErrMsgBackType_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_PreventErrMould_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_TaskClass_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_ProjectClass_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_StockCheckItem_Model.cs" />
@@ -643,6 +644,10 @@
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillSub_Emp.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipBeginBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStopBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipBeginBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStopBillSub.cs" />
    <Compile Include="系统公用\ClsXt_SystemParameter_Model.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillSub.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillMain.cs" />
Model/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/ClsGy_PreventErrMould_Model.cs
New file
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_PreventErrMould_Model : DBUtility.ClsGy_Base_Model
    {
        public DateTime HMakeTime;
        public int HUSEORGID;
        public string HMakeEmp;
        public DateTime HModifyTime;
    }
}
Model/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/ClsSc_MouldProdOutBillMain.cs
@@ -6,19 +6,17 @@
{
    public class ClsSc_MouldProdOutBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HSupID;//   int                --供应商
        public Int64 HSupTypeID;//   int                --往来单位
        public Int64 HWHID;//    int                 --仓库
        public Int64 HSCWHID;//  int                   --调出仓库
        public Int64 HEmpID;//    int                --业务员
        public Int64 HManagerID;//   int            --负责人
        public Int64 HSecManagerID;//  int           --验收
        public Int64 HKeeperID;//   int             --保管员
        public Int64 HDeptID;//     int             --部门
        public string HExplanation;//   varchar(200)        --ÕªÒª
        public string HInnerBillNo;//  varchar(50)         --内部单据号
        public string HRemark; //加工要求
        public bool HRedBlueFlag;//  bit            --红蓝单
        public string HSourceBillType;  //            --源单类型
        public Int64 HSupID;        //  int                --往来单位
        public Int64 HSupTypeID;    //  int                --往来类型(1 ä¾›åº”商、2 å®¢æˆ·ã€ 3 è½¦é—´éƒ¨é—¨ï¼‰
        public Int64 HEmpID;        //  int                --业务员
        public Int64 HManagerID;    //  int                --负责人
        public Int64 HSecManagerID; //  int               --验收
        public Int64 HKeeperID;     //  int             --保管员
        public Int64 HDeptID;       //  int             --部门
        public Int64 HWHID;         //  int             --仓库
        public Int64 HSCWHID;       //  int               --调出仓库
        public string HExplanation; //  varchar(200)    --ÕªÒª
        public string HInnerBillNo; //  varchar(50)     --内部单据号
        public bool HRedBlueFlag;   //  bit                --红蓝单
    }
}
Model/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/ClsSc_MouldProdOutBillSub.cs
@@ -6,35 +6,38 @@
{
    public class ClsSc_MouldProdOutBillSub : DBUtility.ClsXt_BaseBillSub
    { 
        public DateTime HEntryCloseDate;//   datetime      --行关闭 (默认为'')        new
        public string HRemark;//         varchar(200)        --备注
        public Int64 HMaterID;//     int               --物料ID
        public Int64 HPropertyID;//  int                --辅助属性
        public Int64 HSecUnitID;//   int                --辅助计量单位
        public Single HSecUnitRate;//       money            --换算率
        public Int64 HUnitID;//    int                  --计量单位
        public double HDesignLife;//     dec(18,8)              --设计寿命
        public double HLeaveLife;//     dec(18,8)              --剩余寿命
        public double HUseLife;//     dec(18,8)              --使用寿命
        public double HQtyMust;//   dec(18,8)               --应收数量
        public double HQty;//        dec(18,8)              --实收数量
        public double HPrice;//     dec(18,8)               --单价
        public double HMoney;//     dec(18,8)              --金额
        public Int64 HWHID;//      int                  --收料仓库
        public Int64 HSCWHID;//    int                     --调出仓库ID
        public Int64 HSPID;//        int            --仓位ID
        public Int64 HSCSPID;//        int             --调出仓位ID
        public Int64 HSPGroupID;//    int            --仓位组ID(仓库选择完自动带出)
        public string HBatchNo;//    varchar(50)        --批次
        public string HEngineNum;//    varchar(50)        --发动机号
        public string HUnderPanNum;//    varchar(50)        --地盘号
        public string HLeaveFactCard;//    varchar(50)        --出厂证
        public Int64 HPOOrderInterID;//  int              --采购订单主内码
        public Int64 HPOOrderEntryID;//    int            --采购订单子内码
        public string HPOOrderBillNo;//    varchar(50)         --采购订单号
        public Int64 HSeOrderInterID;//   int             --销售订单主内码
        public Int64 HSeOrderEntryID;//      int            --销售订单子内码
        public string HSeOrderBillNo;//    varchar(50)        --销售订单号
        public Int64 HMaterID;          //  int               --模具ID
        public Int64 HPropertyID;       //  int                --辅助属性
        public Int64 HSecUnitID;        //  int                --辅助计量单位
        public Single HSecUnitRate;     //  money            --换算率
        public Int64 HUnitID;           //  int              --计量单位
        public string HBatchNo;         //  varchar(50)        --批次
        public double HQtyMust;         //  dec(18,8)       --应收数量
        public double HQtyRel;          //  dec(18,8)
        public double HQty;             //  dec(18,8)          --实收数量
        public double HPrice;           //  dec(18,8)       --单价
        public double HMoney;           //  dec(18,8)          --金额
        public double HDesignLife;      //  dec(18,8)          --设计寿命
        public double HLeaveLife;       //  dec(18,8)          --剩余寿命
        public double HUseLife;         //  dec(18,8)          --使用寿命
        public double HUseLifeQty;      //  dec(18,8)
        public double HNewLifeQty;      //  dec(18,8)
        public Int64 HWHID;             //  int              --收料仓库
        public Int64 HSCWHID;           //  int             --调出仓库ID
        public Int64 HSPID;             //  int                --仓位ID
        public Int64 HSCSPID;           //  int             --调出仓位ID
        public Int64 HSPGroupID;        //    int                --仓位组ID(仓库选择完自动带出)
        public string HEngineNum;       //    varchar(50)        --发动机号
        public string HUnderPanNum;     //    varchar(50)        --地盘号
        public string HLeaveFactCard;   //  varchar(50)        --出厂证
        public Int64 HPOOrderInterID;   //  int              --采购订单主内码
        public Int64 HPOOrderEntryID;   //  int                --采购订单子内码
        public string HPOOrderBillNo;   //  varchar(50)     --采购订单号
        public Int64 HSeOrderInterID;   //  int             --销售订单主内码
        public Int64 HSeOrderEntryID;   //  int                --销售订单子内码
        public string HSeOrderBillNo;   //  varchar(50)        --销售订单号
        public string HBarCode;
        public Int64 HCorrespondentTypeID;  // int          --往来单位类型(1 ä¾›åº”商、2 å®¢æˆ·ã€ 3 è½¦é—´éƒ¨é—¨ï¼‰
        public Int64 HCorrespondentID;      // int          --往来单位内码
    }
}
Model/Éú²ú¹ÜÀí/Ä£¾ß¹ÜÀí/ClsSc_MouldStockBillSub.cs
@@ -51,5 +51,7 @@
        public Int64 HSeOrderInterID;//   int             --销售订单主内码
        public Int64 HSeOrderEntryID;//      int            --销售订单子内码
        public string HSeOrderBillNo;//    varchar(50)        --销售订单号
        public Int64 HCorrespondentTypeID;  // int          --往来单位类型(1 ä¾›åº”商、2 å®¢æˆ·ã€ 3 è½¦é—´éƒ¨é—¨ï¼‰
        public Int64 HCorrespondentID;      // int          --往来单位内码
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipBeginBillMain.cs
New file
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipBeginBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HEquipID;          //int --设备(Gy_EquipFileBillMain)
        public Int64 HEquipRelationID;  // int --关联主设备(Gy_EquipFileBillMain)(根据设备带出关联主设备)
        public Int64 HBeginEmpID;        // int --开机操作人(Gy_Employee)
        public DateTime HBeginTime;      //  datetime --开机时间(默认为当前时间,年月日时分秒)(不可编辑)
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipBeginBillSub.cs
New file
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipBeginBillSub : DBUtility.ClsXt_BaseBillSub
    {
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipStopBillMain.cs
New file
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipStopBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HEquipID;          //int --设备(Gy_EquipFileBillMain)
        public Int64 HEquipRelationID;  // int --关联主设备(Gy_EquipFileBillMain)(根据设备带出关联主设备)
        public Int64 HStopEmpID;        // int --停机操作人(Gy_Employee)
        public DateTime HStopTime;      //  datetime --停机时间(默认为当前时间,年月日时分秒)(不可编辑)
        public string HStopReason;      //varchar(500) --停机原因
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipStopBillSub.cs
New file
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipStopBillSub : DBUtility.ClsXt_BaseBillSub
    {
    }
}
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -6083,5 +6083,246 @@
        }
        #endregion
        #region  é˜²é”™è£…ç½®  æŸ¥è¯¢,审核,反审核,禁用,反禁用
        /// <summary>
        /// ä¾›åº”商分类  æŸ¥è¯¢
        /// </summary>
        /// <param name="sWhere"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        [Route("Gy_BadReason/Gy_PreventErrMouldList")]
        [HttpGet]
        public object Gy_PreventErrMouldList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = "select * from  h_v_Gy_PreventErrMould where 1 = 1";
                string sql = sql1 + sWhere + " order by é˜²é”™è£…置代码 ";
                ds = oCN.RunProcReturn(sql, "h_v_Gy_PreventErrMould");
                //添加列名
                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列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// é˜²é”™è£…ç½® å®¡æ ¸ã€åå®¡æ ¸
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/AuditGy_PreventErrMould")]
        [HttpGet]
        public object AuditGy_PreventErrMould(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_PreventErrMould");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCheckEmp"].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 Gy_PreventErrMould set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    oCN.RunProc("update Gy_PreventErrMould set HCheckEmp='',HCheckTime=null where HItemID=" + 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;
            }
        }
        /// <summary>
        /// é˜²é”™è£…ç½® ç¦ç”¨ã€åç¦ç”¨
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsStop">禁用(0),反禁用(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Gy_BadReason/StopGy_PreventErrMould")]
        [HttpGet]
        public object StopGy_PreventErrMould(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PreventErrMould_Close", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + HInterID, "Gy_SupType");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].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 (IsStop == 0)  //禁用判断
                {
                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    oCN.RunProc("update Gy_PreventErrMould set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + 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
    }
}
WebAPI/Controllers/SBGL/Sb_EquipBeginBillController.cs
New file
@@ -0,0 +1,744 @@
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
namespace WebAPI.Controllers.SBGL
{
    public class Sb_EquipBeginBillController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        public DAL.ClsSb_EquipBeginBillMain OBill = new DAL.ClsSb_EquipBeginBillMain();
        public DAL.ClsSb_EquipBeginBillMain BillOld = new DAL.ClsSb_EquipBeginBillMain();
        #region è®¾å¤‡å¼€æœºå•列表 æŸ¥è¯¢
        [Route("Sb_EquipBeginBill/getSb_EquipBeginBillMainList")]
        [HttpGet]
        public object getSb_EquipBeginBillMainList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipBeginBillMain_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipBeginBillMainList order by å•据号 desc", "h_v_Sb_EquipBeginBillMainList");
                }
                else
                {
                    string sql1 = "select * from  h_v_Sb_EquipBeginBillMainList  where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipBeginBillMainList");
                }
                //添加列名
                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列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡å¼€æœºå•列表 èŽ·å–ç¼–è¾‘åˆ—è¡¨æ•°æ®
        [Route("Sb_EquipBeginBill/Sb_EquipBeginBillMainEditList")]
        [HttpGet]
        public object Sb_EquipBeginBillMainEditList(string HInterID, string User)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipBeginBillMain_Edit", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_Sb_EquipBeginBillMainList where HInterID = " + HInterID, " h_v_Sb_EquipBeginBillMainList");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡å¼€æœºå• ä¿å­˜/编辑
        [Route("Sb_EquipBeginBill/SaveSb_EquipBeginBillMain")]
        [HttpPost]
        public object SaveSb_EquipBeginBillMain([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].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("Sb_EquipBeginBillMain_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsSb_EquipBeginBillMain oBill = new DAL.ClsSb_EquipBeginBillMain();
                List<Model.ClsSb_EquipBeginBillMain> lsmain = new List<Model.ClsSb_EquipBeginBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Sb_EquipBeginBillMain(msg2);
                foreach (Model.ClsSb_EquipBeginBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (OBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (OBill.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (OBill.omodel.HChecker != "" && OBill.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (OBill.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3917";
                    oItem.HBillSubType = "3917";
                    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 = "保存成功!";
                    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("Sb_EquipBeginBill/DeleteSb_EquipBeginBill")]
        [HttpGet]
        public object DeleteSb_EquipBeginBill(string HInterID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipBeginBillMain_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if(HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                oCN.RunProc("delete from Sb_EquipBeginBillMain where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡å¼€æœºå• å®¡æ ¸/反审核
        [Route("Sb_EquipBeginBill/AuditSb_EquipBeginBill")]
        [HttpGet]
        public object AuditSb_EquipBeginBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipBeginBillMain_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 = "Sb_EquipBeginBillMain";
                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]["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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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;
                        }
                    }
                }
                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 (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 (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;
                        }
                    }
                }
                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("Sb_EquipBeginBill/CloseSb_EquipBeginBill")]
        [HttpGet]
        public object CloseSb_EquipBeginBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipBeginBillMain_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 = "Sb_EquipBeginBillMain";
                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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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 (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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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 (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 è®¾å¤‡å¼€æœºå• ä½œåºŸ/反作废功能
        [Route("Sb_EquipBeginBill/DropSb_EquipBeginBill")]
        [HttpGet]
        public object DropSb_EquipBeginBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipBeginBillMain_Drop", 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 = "Sb_EquipBeginBillMain";
                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/SBGL/Sb_EquipStopBillController.cs
New file
@@ -0,0 +1,744 @@
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
namespace WebAPI.Controllers.SBGL
{
    public class Sb_EquipStopBillController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        public DAL.ClsSb_EquipStopBillMain OBill = new DAL.ClsSb_EquipStopBillMain();
        public DAL.ClsSb_EquipStopBillMain BillOld = new DAL.ClsSb_EquipStopBillMain();
        #region è®¾å¤‡åœæœºå•列表 æŸ¥è¯¢
        [Route("Sb_EquipStopBill/getSb_EquipStopBillMainList")]
        [HttpGet]
        public object getSb_EquipStopBillMainList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipStopBillMain_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipStopBillMainList order by å•据号 desc", "h_v_Sb_EquipStopBillMainList");
                }
                else
                {
                    string sql1 = "select * from  h_v_Sb_EquipStopBillMainList  where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipStopBillMainList");
                }
                //添加列名
                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列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡åœæœºå•列表 èŽ·å–ç¼–è¾‘åˆ—è¡¨æ•°æ®
        [Route("Sb_EquipStopBill/Sb_EquipStopBillMainEditList")]
        [HttpGet]
        public object Sb_EquipStopBillMainEditList(string HInterID, string User)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipStopBillMain_Edit", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_Sb_EquipStopBillMainList where HInterID = " + HInterID, " h_v_Sb_EquipStopBillMainList");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡åœæœºå• ä¿å­˜/编辑
        [Route("Sb_EquipStopBill/SaveSb_EquipStopBillMain")]
        [HttpPost]
        public object SaveSb_EquipStopBillMain([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].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("Sb_EquipStopBillMain_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsSb_EquipStopBillMain oBill = new DAL.ClsSb_EquipStopBillMain();
                List<Model.ClsSb_EquipStopBillMain> lsmain = new List<Model.ClsSb_EquipStopBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Sb_EquipStopBillMain(msg2);
                foreach (Model.ClsSb_EquipStopBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (OBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (OBill.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (OBill.omodel.HChecker != "" && OBill.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (OBill.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3918";
                    oItem.HBillSubType = "3918";
                    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 = "保存成功!";
                    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("Sb_EquipStopBill/DeleteSb_EquipStopBill")]
        [HttpGet]
        public object DeleteSb_EquipStopBill(string HInterID, string user)
        {
            try
            {
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipStopBillMain_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if(HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                oCN.RunProc("delete from Sb_EquipStopBillMain where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è®¾å¤‡åœæœºå• å®¡æ ¸/反审核
        [Route("Sb_EquipStopBill/AuditSb_EquipStopBill")]
        [HttpGet]
        public object AuditSb_EquipStopBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipStopBillMain_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 = "Sb_EquipStopBillMain";
                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]["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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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;
                        }
                    }
                }
                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 (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 (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;
                        }
                    }
                }
                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("Sb_EquipStopBill/CloseSb_EquipStopBill")]
        [HttpGet]
        public object CloseSb_EquipStopBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipStopBillMain_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 = "Sb_EquipStopBillMain";
                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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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 (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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].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 (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 è®¾å¤‡åœæœºå• ä½œåºŸ/反作废功能
        [Route("Sb_EquipStopBill/DropSb_EquipStopBill")]
        [HttpGet]
        public object DropSb_EquipStopBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Sb_EquipStopBillMain_Drop", 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 = "Sb_EquipStopBillMain";
                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/WebAPIController.cs
@@ -9565,6 +9565,278 @@
        }
        #endregion
        #region  é˜²é”™è£…ç½®  è®¾ç½®åˆ—表/保存/编辑/删除方法
        /// <summary>
        ///  é˜²é”™è£…ç½® ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveGy_PreventErrMouldList")]
        [HttpPost]
        public object SaveGy_PreventErrMouldList([FromBody] JObject msg)
        {
            DataSet ds;
            var _value = msg["msg"].ToString();
            string msg3 = _value.ToString();
            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg2 = sArray[1].ToString();
            //查看权限
            if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Edit", 1, false, msg2))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无保存权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_PreventErrMould ", "Gy_PreventErrMould");
            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
            {
                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsGy_PreventErrMould_Ctl oBill = new WebAPI.DLL.ClsGy_PreventErrMould_Ctl();
                List<Model.ClsGy_PreventErrMould_Model> lsmain = new List<Model.ClsGy_PreventErrMould_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_Gy_PreventErrMould(msg1);
                foreach (Model.ClsGy_PreventErrMould_Model oItem in lsmain)
                {
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HName.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!名称不能为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //查询数据中是否存在重复代码
                    ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould");
                    if (oItem.HNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //新增时判断
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count == 0)
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "保存失败!代码重复!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
                        if (sParent.Trim() == "")
                        {
                            oBill.oModel.HParentID = 0;
                        }
                        else
                        {
                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
                            {
                                oBill.oModel.HParentID = oBill.oModel.HItemID;
                            }
                            else
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "保存失败!上级代码不存在或被禁用!";
                                objJsonResult.data = 1;
                                return objJsonResult;
                            }
                        }
                    }
                    else//编辑时判断
                    {
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
                        if (sParent.Trim() == "")
                        {
                            oBill.oModel.HParentID = 0;
                        }
                        else
                        {
                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
                            {
                                oBill.oModel.HParentID = oBill.oModel.HItemID;
                            }
                            else
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "保存失败!上级代码不存在或被禁用!";
                                objJsonResult.data = 1;
                                return objJsonResult;
                            }
                        }
                    }
                    //得到短代码
                    string sShortNumber;
                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
                    if (sShortNumber.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!短代码为空!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oItem.HShortNumber = sShortNumber;//短代码
                    oItem.HEndFlag = true;//末级标志
                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //等级
                    oItem.HMakeEmp = msg2; //创建人
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.oModel.HItemID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddNew();
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                }
                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;
            }
        }
        /// <summary>
        /// é˜²é”™è£…ç½® èŽ·å–ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("GetGy_PreventErrMouldDetail")]
        [HttpGet]
        public ApiResult<DataSet> GetGy_PreventErrMouldDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_PreventErrMouldDetail(HID);
            return model;
        }
        /// <summary>
        /// é˜²é”™è£…ç½® åˆ é™¤åŠŸèƒ½
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_PreventErrMould")]
        [HttpGet]
        public object DeltetGy_PreventErrMould(string HItemID, string user)
        {
            DataSet ds;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_PreventErrMould_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                oCN.RunProc("delete Gy_PreventErrMould where HItemID=" + HItemID);
                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
        /// <summary>
        /// ç”¨å…³è”工序获取信息
        /// </summary>
WebAPI/Controllers/ÌõÂë¹ÜÀí/MouldController.cs
New file
@@ -0,0 +1,337 @@
using DAL;
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI;
using WebAPI.Models;
using WebAPI.Service;
namespace WebAPI.Controllers
{
    public class MouldController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public DataSet ds = new DataSet();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        #region å™¨å…·æ‰«ç æ¨¡å—调用方法
        #region å™¨å…·æ‰«ç æ¨¡å—  æ‰«æå™¨å…·æ¡ç è°ƒç”¨æ–¹æ³•
        /// <summary>
        /// æ‰«æå™¨å…·æ¡ç 
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/Get_CheckTypeByMouldBarCode_Json")]
        [HttpGet]
        public object Get_CheckTypeByMouldBarCode_Json(string sBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, bool HRedBlueFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWhID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "将器具信息写入器具出入库临时表失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描器具条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å™¨å…·æ‰«ç æ¨¡å—  èŽ·å–å™¨å…·åˆ—è¡¨ä¿¡æ¯å¤„ç†æ–¹æ³•
        /// <summary>
        /// èŽ·å–å™¨å…·åˆ—è¡¨ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/GetMouldBillEntryTmpList_Json")]
        [HttpGet]
        public object GetMouldBillEntryTmpList_Json(Int64 HInterID, string HBillNo, string HBillType)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_MouldBillEntryTmpList " + HInterID.ToString() + ",'" + HBillType + "'", "h_p_WMS_MouldBillEntryTmpList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何记录!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    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列对象的列名
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å™¨å…·æ‰«ç æ¨¡å—    åˆ é™¤åŠŸèƒ½æŒ‰é’®è°ƒç”¨  åˆ é™¤å™¨å…·åˆ—表选中行临时表记录
        /// <summary>
        /// åˆ é™¤å™¨å…·åˆ—表选中行临时表记录
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/set_DelMouldStockBillMain_Temp_Json")]
        [HttpGet]
        public object set_DelPonderationBillMain_Temp_BarCode_Json(Int64 HInterID, string HBillType, string HBarCode)
        {
            try
            {
                oCn.RunProc("Delete from Sc_MouldStockBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + HBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                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
        #endregion
        #region æ¨¡å…·é¢†ç”¨å‡ºåº“单
        /// <summary>
        /// æ¨¡å…·é¢†ç”¨å‡ºåº“单新增上传
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/set_SaveMouldProdOutBill_Json")]
        [HttpPost]
        public object set_SaveMouldProdOutBill_Json([FromBody] JObject oMain)
        {
            BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            DAL.ClsSc_MouldProdOutBill BillNew = new DAL.ClsSc_MouldProdOutBill();
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                string sMainStr = "[" + msg1.ToString() + "]";
                List<Model.ClsSc_MouldProdOutBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(sMainStr);
                //单据号是否重复
                if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号重复!不允许保存!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //固定赋值=================================
                BillNew.omodel.HYear = sYear;
                BillNew.omodel.HPeriod = sPeriod;
                BillNew.omodel.HBillType = "3802";
                BillNew.omodel.HInterID = mainList[0].HInterID;
                BillNew.omodel.HBillNo = mainList[0].HBillNo;
                BillNew.omodel.HDate = mainList[0].HDate;
                BillNew.omodel.HRemark = mainList[0].HRemark;
                BillNew.omodel.HMaker = mainList[0].HMaker;
                BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID;
                DBUtility.ClsPub.CurUserName = mainList[0].HMaker;
                //====================================================
                BillNew.omodel.HSupID = mainList[0].HSupID;
                BillNew.omodel.HSupTypeID = mainList[0].HSupTypeID;
                BillNew.omodel.HEmpID = mainList[0].HEmpID;
                BillNew.omodel.HManagerID = mainList[0].HManagerID;
                BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID;
                BillNew.omodel.HKeeperID = mainList[0].HKeeperID;
                BillNew.omodel.HDeptID = mainList[0].HDeptID;
                BillNew.omodel.HWHID = mainList[0].HWHID;
                BillNew.omodel.HSCWHID = mainList[0].HSCWHID;
                BillNew.omodel.HExplanation = mainList[0].HExplanation;
                BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo;
                BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag;
                //子表赋值
                ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有扫码信息,请先扫描条码,确认无误后再提交!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                    {
                        Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub();
                        //固定赋值========================================
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]);
                        oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]);
                        oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]);
                        oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]);
                        oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]);
                        //=============================
                        oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]);
                        oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]);
                        oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]);
                        oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]);
                        oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]);
                        oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]);
                        oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]);
                        oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]);
                        oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]);
                        oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]);
                        oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]);
                        oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]);
                        oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]);
                        oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]);
                        oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]);
                        oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]);
                        oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]);
                        oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]);
                        oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]);
                        oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]);
                        oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]);
                        oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                        oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]);
                        oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]);
                        oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]);
                        oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]);
                        oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]);
                        oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]);
                        oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]);
                        oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]);
                        oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]);
                        oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]);
                        oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]);
                        oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]);
                        BillNew.DetailColl.Add(oSub);
                    }
                }
                //保存
                bool bResult;
                bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "模具领用出库单上传失败!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/DLL/ClsGy_PreventErrMould_Ctl.cs
New file
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace WebAPI.DLL
{
    public class ClsGy_PreventErrMould_Ctl : DBUtility.ClsGy_Base_Ctl
    {
           SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public Model.ClsGy_PreventErrMould_Model oModel = new Model.ClsGy_PreventErrMould_Model();
        //新增
        public override bool AddNew()
        {
            //
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','" +DateTime.Now+ "','" + oModel.HUSEORGID + "','" + oModel.HUseFlag + "','" + oModel.HMakeEmp+ "','" + oModel.HUSEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
                    " HNumber='" + oModel.HNumber + "'" +
                    ",HName='" + oModel.HName + "'" +
                    ",HShortNumber='" + oModel.HShortNumber + "'" +
                    ",HHelpCode='" + oModel.HHelpCode + "'" +
                    ",HModifyTime='" + DateTime.Now + "'" +
                    ",HUSEORGID='" + oModel.HUSEORGID + "'" +
                    ",HModifyEmp ='" + oModel.HMakeEmp + "'" +
                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                    ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 ä¸ºéžæœ«çº§
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //根据代码判断信息
        public override bool HavParentCode(string sCode, Int64 sItemID)
        {
            DataSet DS;
            try
            {
                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo);
                if (DS.Tables[0].Rows.Count == 0)
                    return false;
                else
                {
                    oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]);
                    return true;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //构造函数
        public ClsGy_PreventErrMould_Ctl()
        {
            MvarItemKey = "Gy_PreventErrMould";
            MvarReportTitle = "防错装置设置";
            oModel = new Model.ClsGy_PreventErrMould_Model();
        }
    }
}
WebAPI/DLL/ClsSc_MouldProdOutBill.cs
@@ -146,7 +146,7 @@
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HStockOrgID" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + omodel.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() +
WebAPI/ListModels.cs
@@ -1122,7 +1122,19 @@
            List<Model.ClsGy_ProjectMoney_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_ProjectMoney_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增防错装置表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_PreventErrMould_Model> getObjectByJson_Gy_PreventErrMould(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_PreventErrMould_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_PreventErrMould_Model>>(jsonString);
            return list;
        }
        /// <summary>  
        /// å¤„理新增项目类别表的json
        /// </summary>
@@ -1405,6 +1417,29 @@
            return list;
        }
        /// <summary>
        /// å¤„理新增设备停机单主表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsSb_EquipStopBillMain> getObjectByJson_Sb_EquipStopBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSb_EquipStopBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipStopBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增设备开机单主表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsSb_EquipBeginBillMain> getObjectByJson_Sb_EquipBeginBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSb_EquipBeginBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipBeginBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增项目启动表的json
WebAPI/Service/LuBaoSevice.cs
@@ -643,6 +643,25 @@
        }
        /// <summary>
        /// é˜²é”™è£…置根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_PreventErrMouldDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_PreventErrMouldDb(HID);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在防错装置数据" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
        public static DataSet GetGy_PreventErrMouldDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_PreventErrMould  where HItemID= " + HID + " ", "h_v_Gy_PreventErrMould");
            return dataSet;
        }
        /// <summary>
        /// é¡¹ç›®ç±»åˆ«æ ¹æ®id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_ProjectClassDetail(string HID)
WebAPI/Web.config
@@ -35,7 +35,7 @@
        <!--<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.110.57:81/WEBS/WebService1.asmx"/>-->    <!--陈雯静本地配置-->
        <add key="surl" value="http://localhost/webs-web/webservice1.asmx"/>    <!--翁涛涛本地配置-->
        <!--<add key="surl" value="http://localhost/webs-web/webservice1.asmx"/>-->    <!--翁涛涛本地配置-->
        <!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>九菱-->
        <add key="webpages:Version" value="3.0.0.0" />
WebAPI/WebAPI.csproj
@@ -421,6 +421,8 @@
    <Compile Include="Controllers\PlateBindingController.cs" />
    <Compile Include="Controllers\SBGL\Gy_FixCardChangeBillController.cs" />
    <Compile Include="Controllers\SBGL\Gy_FixCardBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipBeginBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipStopBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipConkBookBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" />
@@ -631,6 +633,7 @@
    <Compile Include="Controllers\基础资料\基础资料\Gy_RepairCheckBillController.cs" />
    <Compile Include="Controllers\基础资料\工资基础资料\Gy_ProcPriceController.cs" />
    <Compile Include="Controllers\应收管理\YS_ReceiveReportController.cs" />
    <Compile Include="Controllers\条码管理\MouldController.cs" />
    <Compile Include="Controllers\条码管理\WEBSController.cs" />
    <Compile Include="Controllers\生产管理\报工台工序\Sc_MaterToSourceStepBillController.cs" />
    <Compile Include="Controllers\生产管理\报工台工序\Sc_MESBeginStepWorkBillController.cs" />
@@ -658,6 +661,7 @@
    <Compile Include="DLL\ClsGy_AreaSet_Ctl.cs" />
    <Compile Include="DLL\ClsGy_CusType_Ctl.cs" />
    <Compile Include="DLL\ClsGy_ErrMsgBackType_Ctl.cs" />
    <Compile Include="DLL\ClsGy_PreventErrMould_Ctl.cs" />
    <Compile Include="DLL\ClsGy_TaskClass_Ctl.cs" />
    <Compile Include="DLL\ClsGy_ProjectClass_Ctl.cs" />
    <Compile Include="DLL\ClsGy_StockCheckItem_Ctl.cs" />