1
duhe
2024-03-15 a133c03712830be08ab21ee6660e13deb129f608
1
1个文件已删除
33个文件已修改
9个文件已添加
7204 ■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/仓库管理/ClsKf_MoveStockBill.cs 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/仓库管理/ClsKf_OtherOutBill.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/设备管理/ClsGy_FixCardBill.cs 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/采购管理/ClsCg_POInStockBackBill.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/采购管理/ClsCg_PayableBill.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/仓库管理/ClsKf_MoveStockBillSub.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldLowerBillMain.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldLowerBillSub.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldUpperBillMain.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldUpperBillSub.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsGy_FixCardBillMain.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsGy_FixCardBillSub_Emp.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBackBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBackBillSub.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBillMain.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBillSub.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillMain.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillSub.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
NETERPNoWin/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
PayM/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
PayM/obj/x86/Debug/PayM.csproj.FileListAbsolute.txt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs 551 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs 475 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs 491 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_PayableBillController.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs 513 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs 1231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs 542 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs 1224 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/YF_PayMentOtherBillController.cs 884 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_ICMOReportBill.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsKf_ICStockBillMain.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsKf_ICStockBillSub.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user 122 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj.user 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -626,6 +626,7 @@
    <Compile Include="生产管理\模具管理\ClsSc_MouldStatusChangeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_EquipFileMain.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_EquipTypeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipSparepartsBill.cs" />
DAL/²Ö¿â¹ÜÀí/ClsKf_MoveStockBill.cs
@@ -37,6 +37,22 @@
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_MoveStockBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //
                oCn.BeginTran();
                //更新主表
@@ -72,23 +88,23 @@
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
               // omodel.HInterID = lngBillKey;
                foreach (Model.ClsKf_MoveStockBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID" +
                      ",HSPID,HSCSPID,HBatchNo" +
                      ",HSPID,HSCSPID,HBatchNo,HOutPrice,HOutMoney" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + 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.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "'" +
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HOutPrice + "','" + oSub.HOutMoney + "'" +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      ") ");
@@ -105,6 +121,24 @@
                //        return false;
                //    }
                //}
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_MoveStockBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -133,6 +167,22 @@
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_MoveStockBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //
                oCn.BeginTran();
                //主表
@@ -155,19 +205,19 @@
                foreach (Model.ClsKf_MoveStockBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID" +
                      ",HSPID,HSCSPID,HBatchNo" +
                      ",HSPID,HSCSPID,HBatchNo,HOutPrice,HOutMoney" +
                      ",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + 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.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "'" +
                      "," + oSub.HSPID.ToString() + "," + oSub.HSCSPID.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HOutPrice + "','" + oSub.HOutMoney + "'" +
                      "," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      ") ");
@@ -185,6 +235,24 @@
                //    }
                //}
                //
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_MoveStockBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_MoveStockBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
DAL/²Ö¿â¹ÜÀí/ClsKf_OtherOutBill.cs
@@ -37,6 +37,21 @@
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_OtherOutBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_OtherOutBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //
                oCn.BeginTran();
                //更新主表
@@ -66,18 +81,19 @@
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                //omodel.HInterID = lngBillKey;
                //插入子表
                foreach (Model.ClsKf_OtherOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + 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() +
@@ -97,6 +113,23 @@
                //        return false;
                //    }
                //}
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_OtherOutBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_OtherOutBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
@@ -125,7 +158,23 @@
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_OtherOutBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_Kf_OtherOutBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
@@ -143,14 +192,14 @@
                foreach (Model.ClsKf_OtherOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + 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() +
@@ -170,7 +219,23 @@
                //        return false;
                //    }
                //}
                //
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_Kf_OtherOutBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_Kf_OtherOutBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBill.cs
New file
@@ -0,0 +1,239 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsGy_FixCardBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsGy_FixCardBillMain omodel = new Model.ClsGy_FixCardBillMain();
        public List<Model.ClsGy_FixCardBillSub_Emp> DetailColl = new List<Model.ClsGy_FixCardBillSub_Emp>();
        public ClsGy_FixCardBill()
        {
            base.MvarItemKeySub = "Gy_FixCardBillSub_Emp";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "Gy_FixCardBillMain";
            base.MvarReportTitle="固定资产卡片";
            base.BillType = "3335";
            base.HBillSubType = "3335";
        }
        #region å›ºå®šä»£ç 
        ~ClsGy_FixCardBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Gy_FixCardBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + omodel.HMaker + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HCardNumber='" + omodel.HCardNumber + "'" +
                ",HCardName='" + omodel.HCardName + "'" +
                ",HCardModel ='" + omodel.HCardModel + "'" +
                ",HMaterID='" + omodel.HMaterID + "'" +
                ",HUnitID='" + omodel.HUnitID + "'" +
                ",HCardQty='" + omodel.HCardQty + "'" +
                ",HCardForm='" + omodel.HCardForm + "'" +
                ",HCard='" + omodel.HCard + "'" +
                ",HOutComDate='" + omodel.HOutComDate + "'" +
                ",HOutComNo='" + omodel.HOutComNo + "'" +
                ",HBeginUseDate='" + omodel.HBeginUseDate + "'" +
                ",HCardTypeID='" + omodel.HCardTypeID + "'" +
                ",HCardStatusID='" + omodel.HCardStatusID + "'" +
                ",HCardChangeTypeID='" + omodel.HCardChangeTypeID + "'" +
                ",HBarCode='" + omodel.HBarCode + "'" +
                ",HWorkArea='" + omodel.HWorkArea + "'" +
                ",HLogo='" + omodel.HLogo + "'" +
                ",HSellSupID='" + omodel.HSellSupID + "'" +
                ",HMakeSupID='" + omodel.HMakeSupID + "'" +
                ",HOrgID='" + omodel.HOrgID + "'" +
                ",HOwnerID='" + omodel.HOwnerID + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " +
                      " (HInterID,HBillNo_bak ,HEntryID,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," +
                      "HBeginDate,HEndDate" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() +
                      ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID +
                      ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" +
                      oSub.HBeginDate + "','" + oSub.HEndDate + "'" +
                      ") ");
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Gy_FixCardBillMain" +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HYear,HPeriod,HRemark,HBillStatus," +
                "HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo," +
                "HCardNumber,HCardName,HCardModel,HMaterID,HUnitID,HCardQty,HCardForm,HCard,HOutComDate,HOutComNo,HBeginUseDate," +
                "HCardTypeID,HCardStatusID,HCardChangeTypeID,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,HOrgID,HOwnerID" +
                ") "+
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate +
                "','" + omodel.HMaker + "',getdate()" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark +
                "'," + omodel.HBillStatus + ",'" + omodel.HMainSourceBillType + "','" +omodel.HMainSourceInterID + "'," + omodel.HMainSourceEntryID +
                ",'" + omodel.HMainSourceBillNo + "','" + omodel.HCardNumber + "','" + omodel.HCardName + "','" + omodel.HCardModel + "'," + omodel.HMaterID +
                "," + omodel.HUnitID + "," + omodel.HCardQty + ",'" + omodel.HCardForm + "','" +  omodel.HCard + "','" + omodel.HOutComDate +
                "','" + omodel.HOutComNo + "','" + omodel.HBeginUseDate + "'," + omodel.HCardTypeID + "," +  omodel.HCardStatusID + "," + omodel.HCardChangeTypeID +
                ",'" + omodel.HBarCode + "','" + omodel.HWorkArea + "','" + omodel.HLogo + "'," + omodel.HSellSupID + "," + omodel.HMakeSupID + "," + omodel.HOrgID +
                "," + omodel.HOwnerID +
                ") ");
                //插入子表
                foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " +
                      " (HInterID,HBillNo_bak ,HEntryID,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," +
                      "HBeginDate,HEndDate" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() +
                      ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID +
                      ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" +
                      oSub.HBeginDate + "','" + oSub.HEndDate + "'" +
                      ") ");
                }
                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 Gy_FixCardBillMain Where HInterID=" + lngBillKey.ToString(), "Gy_FixCardBillMain");
                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 Gy_FixCardBillSub_Emp Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Gy_FixCardBillSub_Emp");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsGy_FixCardBillSub_Emp oSub = new Model.ClsGy_FixCardBillSub_Emp();
                    // å›ºå®šèµ‹å€¼===============================================
                    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/²É¹º¹ÜÀí/ClsCg_POInStockBackBill.cs
@@ -12,11 +12,11 @@
        public ClsCg_POInStockBackBill()
        {
            base.MvarItemKeySub = "Cg_POInStockBillSub";
            base.MvarItemKeySub = "Cg_POInStockBackBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="Cg_POInStockBillMain";
            base.MvarItemKey= "Cg_POInStockBackBillMain";
            base.MvarReportTitle="退料通知单";
            base.BillType="1105";
            base.HBillSubType = "1105";
@@ -91,7 +91,7 @@
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Cg_POInStockBillMain set  " +
                oCn.RunProc("UpDate Cg_POInStockBackBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
@@ -119,7 +119,7 @@
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsCg_POInStockBackBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Cg_POInStockBillSub " +
                    oCn.RunProc("Insert into Cg_POInStockBackBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxPrice,HTaxMoney,HWHID" +
@@ -166,7 +166,7 @@
                //
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Cg_POInStockBillMain   " +
                oCn.RunProc("Insert Into Cg_POInStockBackBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HAddress,HSupID,HCurID,HWHID,HExRate" +
@@ -180,7 +180,7 @@
                //插入子表
                foreach (Model.ClsCg_POInStockBackBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Cg_POInStockBillSub " +
                    oCn.RunProc("Insert into Cg_POInStockBackBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxPrice,HTaxMoney,HWHID" +
@@ -215,7 +215,7 @@
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Cg_POInStockBillMain Where HInterID=" + lngBillKey.ToString(), "Cg_POInStockBillMain");
                Ds = oCn.RunProcReturn("Select * from Cg_POInStockBackBillMain Where HInterID=" + lngBillKey.ToString(), "Cg_POInStockBackBillMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
@@ -263,7 +263,7 @@
                
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Cg_POInStockBillSub Where HInterID=" + lngBillKey.ToString(), "Cg_POInStockBillSub");
                DsSub = oCn.RunProcReturn("Select * from Cg_POInStockBackBillSub Where HInterID=" + lngBillKey.ToString(), "Cg_POInStockBackBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
DAL/²É¹º¹ÜÀí/ClsCg_PayableBill.cs
@@ -32,11 +32,50 @@
        #endregion
        #endregion
        //新增关联
        public override void AddNewRelation(ref string sReturn, Int64 lngBillKey)
        {
            //收料通知单 é€€æ–™é€šçŸ¥å• å…³è”数量
            try
            {
                if (DetailColl[0].HSourceBillType == "1201")                      //采购入库单
                {
                    oCn.RunProc("exec h_p_Cg_UpDateRelation_POStockInToPayable_Add " + lngBillKey.ToString());
                }
                else if (DetailColl[0].HSourceBillType == "1102")                    //采购订单
                {
                    oCn.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPayable_Add " + lngBillKey.ToString());
                }
                else
                {
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        #region ä¿®æ”¹å•据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Cg_PayableBill_BeforeSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.BeginTran();
                //更新主表
                string mainSql = "update Cg_PayableBillMain  set " +
@@ -113,6 +152,23 @@
                        ")";
                    oCn.RunProc(subSql);
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("h_p_Cg_PayableBill_AfterSaveCtrl " + omodel.HInterID  ,"h_p_Cg_PayableBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "修改单据成功!";
                oCn.Commit();
@@ -132,9 +188,22 @@
        {
            try
            {
                DataSet ds;
                //DataSet ds;
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_Cg_PayableBill_BeforeSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                oCn.BeginTran();
                //检查主表内码是否重复,若重复则重新生成并继续检查,直到不再重复
@@ -150,6 +219,7 @@
                        break;
                    }
                }
                //插入主表
                string mainSql = "insert into Cg_PayableBillMain" +
@@ -229,6 +299,23 @@
                        ")";
                    oCn.RunProc(subSql);
                }
                //更新订单关联数量
                AddNewRelation(ref sReturn, omodel.HInterID);
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("h_p_Cg_PayableBill_AfterSaveCtrl " + omodel.HInterID, "h_p_Cg_PayableBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
Model/Model.csproj
@@ -300,6 +300,10 @@
    <Compile Include="信息平台\ClsOA_MeetNotifyBillSub.cs" />
    <Compile Include="信息平台\ClsOA_NewMain.cs" />
    <Compile Include="信息平台\ClsOA_NewSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldLowerBillMain.cs" />
    <Compile Include="器具管理\ClsSc_MouldLowerBillSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldUpperBillSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldUpperBillMain.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Customer_Model.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Department_Model.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Employee_Model.cs" />
@@ -614,6 +618,8 @@
    <Compile Include="生产管理\设备管理\ClsGy_EquipTypeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillSub_Emp.cs" />
    <Compile Include="系统公用\ClsXt_SystemParameter_Model.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillSub.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillMain.cs" />
Model/²Ö¿â¹ÜÀí/ClsKf_MoveStockBillSub.cs
@@ -18,6 +18,8 @@
        public double HQty;//        dec(18,8)              --实收数量
        public double HPrice;//     dec(18,8)               --单价
        public double HMoney;//     dec(18,8)              --金额
        public double HOutPrice;//     dec(18,8)               --调出单价
        public double HOutMoney;//     dec(18,8)              --调出金额
        public Int64 HWHID;//      int                  --收料仓库
        public Int64 HSCWHID;//    int                     --调出仓库ID 
        public Int64 HSPID;//      int                  --调入仓位
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillMain.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldLowerBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HDeptID;//        int        --部门ID
        public Int64 HEmpID;//        int        --操作员
        public Int64 HMangerID;//        int        --负责人
        public int HOrgID;//        int        --组织
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillSub.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldLowerBillSub : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HMouldID;
        public Int64 HUnitID;
        public Int64 HQty;
        public Int64 HSourceID;
        public Int64 HEquipID;
        public Int64 HICMOInterID;
        public Int64 HICMOEntryID;
        public string HICMOBillNo;
        public Int64 HProcExchInterID;
        public Int64 HProcExchEntryID;
        public string HProcExchBillNo;
        public string HScanDate;
        public string HBarCode;
        public string HMouldNumber;
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillMain.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldUpperBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HDeptID;//        int        --部门ID
        public Int64 HEmpID;//        int        --操作员
        public Int64 HMangerID;//        int        --负责人
        public int HOrgID;//        int        --组织
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillSub.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldUpperBillSub : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HMouldID;
        public Int64 HUnitID;
        public Int64 HQty;
        public Int64 HSourceID;
        public Int64 HEquipID;
        public Int64 HICMOInterID;
        public Int64 HICMOEntryID;
        public string HICMOBillNo;
        public Int64 HProcExchInterID;
        public Int64 HProcExchEntryID;
        public string HProcExchBillNo;
        public string HScanDate;
        public string HBarCode;
        public string HMouldNumber;
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillMain.cs
New file
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_FixCardBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public string HCardNumber; //卡片编码
        public string HCardName; //资产名称
        public string HCardModel;  //资产规格
        public Int64 HMaterID; //对应物料
        public Int64 HUnitID; //计量单位
        public Int64 HCardQty;//资产数量
        public string HCardForm;//卡片来源    (手工建卡)
        public string HCard;//资产性质  ï¼ˆè‡ªæœ‰èµ„产)
        public DateTime HOutComDate;    //出厂日期
        public string HOutComNo;   //出厂编号
        public DateTime HBeginUseDate; //开始使用日期
        public Int64 HCardTypeID; //资产类别(Gy_CardType)
        public Int64 HCardStatusID; //资产状态(Gy_CardStatus)
        public Int64 HCardChangeTypeID; //变动方式(Gy_CardChangeType)
        public string HBarCode; //条形码
        public string HWorkArea; //产地
        public string HLogo;//品牌
        public Int64 HSellSupID; //供应商(Gy_Supplier)
        public Int64 HMakeSupID; //制造商 (Gy_Supplier)
        public Int64 HOrgID; //资产组织
        public Int64 HOwnerID; //货主
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillSub_Emp.cs
New file
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_FixCardBillSub_Emp : DBUtility.ClsXt_BaseBillSub
    {
        public Int64 HDeptID;     //使用部门(gy_Departme nt)
        public Int64 HUseEmpID; //使用人(gy_Employee)
        public Int64 HRepairEmpID; //维护负责人(gy_Employee)
        public Int64 HCardAddr; //资产位置(Gy_CardAddress)
        public string HAddress;   //放置地点
        public DateTime HSetupDate; //安装日期
        public decimal HAvgRate;// åˆ†é…æ¯”例
        public Int64 HProjectMoneyID; //费用项目(Gy_ProjectMoney)
        public DateTime HBeginDate; //开始日期
        public DateTime HEndDate; //结束日期
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POInStockBackBillMain.cs
@@ -10,10 +10,12 @@
        public Int64 HSupID;//      int                 --供应商 ï¼ˆGy_Supplier)
        public Int64 HCurID;//    int                  --币别 (Gy_Currency)
        public Int64 HWHID;//      int     --仓库
        public Int64 HSPID;//      int     --仓位
        public Single HExRate;//    money                  --汇率  (选择完币别带出)
        public Int64 HEmpID;//     int                   --业务员  (Gy_Employee)
        public Int64 HManagerID;//  int                 --主管    (Gy_Employee)
        public Int64 HDeptID;//     int                 --部门    (Gy_Employee)
        public Int64 HOrgID;
        public string HExplanation;//  varchar(200)             --ÕªÒª 
        public string HInnerBillNo;//  varchar(50)             --内部单据号
Model/²É¹º¹ÜÀí/ClsCg_POInStockBackBillSub.cs
@@ -15,12 +15,12 @@
        public double HMoney;//   dec(18,8)         --原币金额
        public double HTaxPrice;//   dec(18,8)         --含税单价
        public double HTaxMoney;//   dec(18,8)         --含税金额
        public Int64 HWHID;//              --收料仓库
        public Int64 HWHID;//              --退料仓位
        public Int64 HSPID;//              --收料仓库
        public Int64 HPOOrderInterID;//
        public Int64 HPOOrderEntryID;//
        public string HPOOrderBillNo;//
        public object HSPID { get; set; }
        public object HConfirmMan { get; set; }
        public object HConfirmDate { get; set; }
        public object HStatus { get; set; }
Model/²É¹º¹ÜÀí/ClsCg_POInStockBillMain.cs
@@ -51,6 +51,7 @@
        public string HSUPPLYADDRESS;
        public Int64 HCORRESPONDORGID;
        public Int64 HPROVIDERCONTACTID;
        public Int64 HOrgID;
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POInStockBillSub.cs
@@ -17,7 +17,7 @@
        public double HPrice;//   dec(18,8)         --原币单价
        public double HMoney;//   dec(18,8)         --原币金额
        public double HTaxPrice;//   dec(18,8)         --含税单价
        public double HTaxMoney;//   dec(18,8)         --含税金额
        public double HTaxMoney;//   dec(18,8)         --税额
        public double HTaxRate;//   dec(18,8)         --含税金额
        public double HTaxMoney_TAX;//   dec(18,8)         --含税金额
        public double HTaxRate_TAX;//   dec(18,8)         --含税金额
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillMain.cs
@@ -37,6 +37,7 @@
        public Int64 HERPInterID;
        public string HERPBillType;
        public Int64 HPURCHASEORGID;
        public Int64 HOrgID;
        public Int64 HPURCHASERGROUPID;    //采购组
        public Int64 HPROVIDERID;    //供货方
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillSub.cs
@@ -46,7 +46,7 @@
        public string HMTONo;
        public Int64 HERPInterID;
        public Int64 HERPEntryID;
        public Int64 HSTOCKORGID;//收料组织
        public Int64 HSEQ;//行号
        public Int64 HRECEIVEDEPTID;//收料部门
        public string HSUPPLIERLOT;//供应商批号
NETERPNoWin/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
PayM/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
PayM/obj/x86/Debug/PayM.csproj.FileListAbsolute.txt
@@ -1649,3 +1649,6 @@
D:\GIT仓库\MES-WEB-API\PayM\obj\x86\Debug\PayM.csproj.CopyComplete
D:\GIT仓库\MES-WEB-API\PayM\obj\x86\Debug\PayM.dll
D:\GIT仓库\MES-WEB-API\PayM\obj\x86\Debug\PayM.pdb
D:\MES-WEB\MES-WEB-API\PayM\obj\x86\Debug\PayM.csproj.AssemblyReference.cache
D:\MES-WEB\MES-WEB-API\PayM\obj\x86\Debug\PayM.dll
D:\MES-WEB\MES-WEB-API\PayM\obj\x86\Debug\PayM.pdb
PayM/obj/x86/Debug/PayM.csproj.ResolveComReference.cache
Binary files differ
WebAPI/Controllers/CGGL/Cg_POInStockBackBillController.cs
@@ -91,8 +91,7 @@
                return objJsonResult;
            }
        }
        #region é€€æ–™é€šçŸ¥å• ä¿å­˜/编辑功能
        #region é‡‡è´­é€€æ–™å• ä¿å­˜/编辑功能
        [Route("Cg_POInStockBackBill/POInStockBackBillEdit")]
        [HttpPost]
        public object POInStockBackBillEdit([FromBody] JObject sMainSub)
@@ -145,7 +144,7 @@
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsCg_POInStockBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBackBillMain>>(msg2);
                long HPURCHASEORGID = mainList[0].HOrgID;
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                long HPRDORGID = mainList[0].HPRDORGID;//生产组织
@@ -159,7 +158,6 @@
                Single HExRate = mainList[0].HExRate;//汇率
                long HManagerID = mainList[0].HManagerID;//主管
                long HAPPORGID = mainList[0].HAPPORGID;//申请组织
                long HPURCHASEORGID = mainList[0].HPURCHASEORGIDD;//采购组织
                long HREQUIREORGID = mainList[0].HREQUIREORGID;//需求组织
                long HSETTLEORGID = mainList[0].HSETTLEORGID;//结算组织
                long HOWNERTYPEID = mainList[0].HOWNERTYPEID;//货主类型
@@ -219,30 +217,33 @@
                        ,HAddress,HSupID,HCurID,HWHID,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark
                        ,HInnerBillNo,HAPPORGID,HPURCHASEORGID,HREQUIREORGID,HSETTLEORGID,HOWNERTYPEID
                        ,HOWNERID,HERPInterID,HERPBillType,HConfirmMan,HConfirmDate,HStatus
                        ,HChecker,HCheckDate,HMaker,HMakeDate)
                        ,HMaker,HMakeDate)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1105 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSupID + "," + HCurID + "," + HWHID + "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark
                    + "','" + HInnerBillNo + "'," + HAPPORGID + "," + HPURCHASEORGID + "," + HREQUIREORGID + ","
                    + HSETTLEORGID + "," + HOWNERTYPEID + "," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "','" + HConfirmMan
                    + "','" + HConfirmDate + "'," + HStatus + ",'" + HChecker + "',getdate()" + ",'" + HMaker + "',getdate()" + ")";
                   HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                   "'," + HSupID + "," + HCurID + "," + HWHID + "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark
                   + "','" + HInnerBillNo + "'," + HAPPORGID + "," + HPURCHASEORGID + "," + HREQUIREORGID + ","
                   + HSETTLEORGID + "," + HOWNERTYPEID + "," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "','" + HConfirmMan
                   + "','" + HConfirmDate + "'," + HStatus + ",'" + HMaker + "',getdate()" + ")";
                    oCN.RunProc(sql);
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    String sql=$@"update Cg_POInStockBackBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID+", HWHID = " + HWHID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID+ ",HOWNERID=" + HOWNERID
                                 + ",HAddress='" + HAddress + "'where HInterID=" + HInterID;
                    String sql = $@"update Cg_POInStockBackBillMain  set " +
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID + ", HWHID = " + HWHID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
                                 + ",HAddress='" + HAddress + "' ,HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
                    //删除子表
                    oCN.RunProc("delete from Cg_POInStockBackBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
                //退料通知单新增回填采购订单关联数量
                oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockBackToPOOrder_Add " + HInterID);
                if (objJsonResult.code == "0")
                {
@@ -269,9 +270,17 @@
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType)
        public json AddBillSub(string msg3, long HInterID, int OperationType, string user)
        {
            List<ClsCg_POInStockBackBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBackBillSub>>(msg3);
            List<ClsCg_POInStockBackBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBackBillSub>>(msg3);
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
            double HRelationQty = DetailColl2[0].HRelationQty == null ? 0 : DetailColl2[0].HRelationQty;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
@@ -336,18 +345,17 @@
                ,HTaxMoney,HBatChNo,HAuxPropID,HERPInterID,HERPEntryID
                ,HMTONo,HPlanMode,HRemark)  
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)},{oSub.HPrice}
                ,{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{(oSub.HConfirmMan==null ? 0 : oSub.HConfirmMan)}','{oSub.HConfirmDate}',{oSub.HRelationQty}
                ,{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{(oSub.HConfirmMan == null ? 0 : oSub.HConfirmMan)}','{oSub.HConfirmDate}',{oSub.HRelationQty}
                ,{(oSub.HStatus == null ? 0 : oSub.HStatus)},{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}'
                ,{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{oSub.HPOOrderBillNo}','{(oSub.HWWOrderInterID == null ? 0 : oSub.HWWOrderInterID)}'
                ,{(oSub.HWWOrderEntryID==null ?0:oSub.HWWOrderEntryID)},{(oSub.HWWOrderDetaiLID == null ? 0 : oSub.HWWOrderDetaiLID)},'{(oSub.HWWOrderBillNo == null ? 0 : oSub.HWWOrderBillNo)}'
                ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)},{(oSub.HTaxRate==null?0:oSub.HTaxRate)}
                ,{oSub.HTaxMoney},'{oSub.HBatChNo}',{(oSub.HAuxPropID==null?0:oSub.HAuxPropID)},{(oSub.HERPInterID==null ? 0 :oSub.HERPInterID)},{(oSub.HERPEntryID == null ? 0 : oSub.HERPEntryID)}
                ,'{(oSub.HMTONo==null?0:oSub.HMTONo)}',{(oSub.HPlanMode==null?0:oSub.HPlanMode)},'{oSub.HRemark}')";
                ,{(oSub.HWWOrderEntryID == null ? 0 : oSub.HWWOrderEntryID)},{(oSub.HWWOrderDetaiLID == null ? 0 : oSub.HWWOrderDetaiLID)},'{(oSub.HWWOrderBillNo == null ? 0 : oSub.HWWOrderBillNo)}'
                ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)},{(oSub.HTaxRate == null ? 0 : oSub.HTaxRate)}
                ,{oSub.HTaxMoney},'{oSub.HBatChNo}',{(oSub.HAuxPropID == null ? 0 : oSub.HAuxPropID)},{(oSub.HERPInterID == null ? 0 : oSub.HERPInterID)},{(oSub.HERPEntryID == null ? 0 : oSub.HERPEntryID)}
                ,'{(oSub.HMTONo == null ? 0 : oSub.HMTONo)}',{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}')";
                oCN.RunProc(sql);
            }
            //保存后控制=========================================              
            ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBackBill_AfterSaveCtrl " + HInterID, "h_p_Cg_POInStockBackBill_AfterSaveCtrl");
@@ -375,8 +383,7 @@
            objJsonResult.data = null;
            return objJsonResult;
        }
        /// <summary>
        ///删除功能
        /// </summary>
@@ -861,10 +868,8 @@
            return new ApiResult<DataTable> { code = 1, msg = "查询成功", data = dataSet.Tables[0] };
        }
        #endregion
        #region é€€æ–™é€šçŸ¥å• å®¡æ ¸/反审核
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -872,56 +877,95 @@
        /// <returns></returns>
        [Route("Cg_POInStockBackBill/AuditCg_POInStockBackBill")]
        [HttpGet]
        public object AuditCg_POInStockBackBill(string HInterID, int Type, string user)
        public object AuditCg_POInStockBackBill(int HInterID, int IsAudit, string CurUserName)
        {
            string sql = "";
            string ModRightNameCheck = "Cg_POInStockBackBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBackBill_Check", 1, false, user))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Cg_POInStockBackBillMain";
                oCN.BeginTran();//开始事务
                string HBillNo = "";
                ds = oCN.RunProcReturn("select * from Cg_POInStockBackBillMain where HInterID = " + int.Parse(HInterID), "Cg_POInStockBackBillMain");
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POInStockBackBill oBill = new DAL.ClsCg_POInStockBackBill();                              //实例化单据操作类,用于进行相关操作
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制
                    sql = "exec h_p_Cg_POInStockBackBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POInStockBackBill_BeforeCheckCtrl");
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Cg_POInStockBackBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Cg_POInStockBackBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -929,8 +973,8 @@
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
@@ -939,162 +983,79 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBackBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBackBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //判断单据是否已经审核
                    //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
                {
                    //反审核前控制
                    sql = "exec h_p_Cg_POInStockBackBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POInStockBackBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBackBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //判断单据是否已经反审核
                    //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;
                    //    }
                    //}
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Cg_POInStockBackBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Cg_POInStockBackBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBackBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é€€æ–™é€šçŸ¥å• å…³é—­/反关闭功能
        [Route("Cg_POInStockBackBill/CloseCg_POInStockBackBill")]
@@ -1151,14 +1112,14 @@
                            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]["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() != "")
                        {
@@ -1195,14 +1156,14 @@
                            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]["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";
@@ -1243,6 +1204,181 @@
        }
        #endregion
        #region é€€æ–™é€šçŸ¥å• è¡Œå…³é—­/行反关闭
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(0),反关闭(1)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("Cg_POInStockBackBill/CloseRowCg_POInStockBackBill")]
        [HttpGet]
        public object CloseRowCg_POInStockBackBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Cg_POInStockBackBill_Close";
            string SubBillName = "Cg_POInStockBackBillSub";                   //子表表名
            DBUtility.ClsPub.CurUserName = CurUserName;
            DataSet ds = null;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "行关闭失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POInStockBackBill oBill = new DAL.ClsCg_POInStockBackBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
                    ds = oCN.RunProcReturn(sql, "Cg_POInStockBackBillSub");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "该行数据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //行关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行已关闭!不能再次行关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //行反关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行未关闭!不需要再行反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //判断行是否为自动关闭
                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行反关闭失败!行为自动关闭,不能进行手动反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的行关闭/行反关闭操作
                if (IsAudit == 0) //行关闭提交
                {
                    //行关闭提交
                    if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "行关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "行关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //行反关闭提交
                {
                    //行反关闭提交
                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é€€æ–™é€šçŸ¥å• ä½œåºŸ/反作废功能
        [Route("Cg_POInStockBackBill/DropCg_POInStockBackBill")]
@@ -1374,6 +1510,7 @@
        }
        #endregion
    }
}
#endregion
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -453,7 +453,7 @@
                List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HCORRESPONDORGID = mainList2[0].HOrgID;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
@@ -479,11 +479,9 @@
                long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
                string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
                string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
                long HCORRESPONDORGID = mainList2[0].HCORRESPONDORGID == null ? 0 : mainList2[0].HCORRESPONDORGID;
                long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_POOrderBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
                {
@@ -511,30 +509,38 @@
                    oCN.RunProc(@"Insert Into Cg_POInStockBillMain   
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
                        ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HRemark
                        ,HMaker,HMakeDate,HChecker,HCheckDate,HOWNERTYPEID,HOWNERID
                        ,HMaker,HMakeDate,HOWNERTYPEID,HOWNERID
                        ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID
                        ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID
                        ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID)
                        ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
                    "," + HManagerID + "," + HEmpID + "," + HDeptID + ",'" + HRemark + "','" + HMaker +
                    "','" + HMakeDate + "','" + HChecker + "','" + HCheckDate + "','" + HOWNERTYPEID + "'," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HSTOCKORGID + "," + HREQUIREORGID + "," +
                    "',getdate()" + ",'" + HOWNERTYPEID + "'," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HSTOCKORGID + "," + HREQUIREORGID + "," +
                    HSTOCKGROUPID + ",'" + HSENDBILLNO + "','" + HLADBILLNO + "'," + HPURDEPTID + "," + HPURGROUPID + "," + HSUPPLYID + "," +
                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ")");
                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ",'" + HInnerBillNo + "')");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Cg_POInStockBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                    string sql= $@"update Cg_POInStockBillMain  set " +
                                "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + "' where HInterID=" + HInterID);
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
                    //收料通知单删除回填采购订单关联数量
                    oCN.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Cg_POInStockBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType,user);
                //收料通知单新增回填采购订单关联数量
                oCN.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Add " + HInterID);
                if (objJsonResult.code == "0")
                {
@@ -568,7 +574,7 @@
            List<ClsCg_POInStockBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillSub>>(msg3);
            long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
            //long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
            long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
            long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
@@ -682,7 +688,7 @@
                oCN.RunProc($@"Insert into Cg_POInStockBillSub 
                (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice
                ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                ,HMoney,HTaxRate,HTaxMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                ,HPOOrderEntryID,HPOORderBillNo,HAuxPropID,HBatchNO,HMTONo,HPlanMode,HERPInterID,HERPEntryID
                ,HRelationQty,HGiveAwayFlag,HReceiveQty,HSEQ,HPRODUCEDATE,HEXPIRYDATE,HSUPPLYLOT,HREQTRACENO,HBOMID,HSTOCKUNITID
                ,HBASEUNITID,HSTOCKSTATUSID,HKEEPERTYPEID,HPROJECTNO,HCHECKINCOMING,HTAXPRICE,HDISCOUNTRATE
@@ -691,7 +697,7 @@
                ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX
                ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID) 
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},{HPOOrderBillNo},{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},{HPOOrderBillNo},{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
                  {HSUPPLYLOT},{HREQTRACENO},{HBOMID},{HSTOCKUNITID},{HBASEUNITID},{HSTOCKSTATUSID},'{HKEEPERTYPEID}',{HPROJECTNO},{HCHECKINCOMING},{oSub.HTaxPrice},{HDISCOUNTRATE},{HPRICECOEFFICIENT},{HPRICEUNITID},{HPRICELISTENTRY},{HSAMPLEDAMAGEQTY},{HSAMPLEDAMAGEBASEQTY},{HPAYORGID},{HSETTLEORGID},{HSETTLECURRID},{HSETTLEMODEID},{HEXCHANGETYPEID},{HPAYCONDITONID},{oSub.HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},{oSub.HSecUnitID})");
                
            }
@@ -804,7 +810,6 @@
        #region æ”¶æ–™é€šçŸ¥å• å®¡æ ¸/反审核
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -812,61 +817,95 @@
        /// <returns></returns>
        [Route("Cg_POInStockBill/AuditCg_POInStockBill")]
        [HttpGet]
        public object AuditCg_POInStockBill(string HInterID, int Type, string user)
        public object AuditCg_POInStockBill(int HInterID, int IsAudit, string CurUserName)
        {
            string sql = "";
            //ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
            string ModRightNameCheck = "Cg_POInStockBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Check", 1, false, user))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill();                              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Cg_POInStockBillMain";
                ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain where HInterID = " + int.Parse(HInterID), "Cg_POInStockBillMain");
                string HBillNo = "";
                oCN.BeginTran();//开始事务
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制
                    sql = "exec h_p_Cg_POInStockBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POInStockBill_BeforeCheckCtrl");
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Cg_POInStockBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Cg_POInStockBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -874,8 +913,8 @@
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
@@ -884,65 +923,73 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //反审核前控制
                    sql = "exec h_p_Cg_POInStockBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POInStockBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Cg_POInStockBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Cg_POInStockBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Cg_POInStockBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "执行成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POInStockBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1004,14 +1051,14 @@
                            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]["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() != "")
                        {
@@ -1048,14 +1095,14 @@
                            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]["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";
@@ -1096,6 +1143,181 @@
        }
        #endregion
        #region æ”¶æ–™é€šçŸ¥å• è¡Œå…³é—­/行反关闭
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(0),反关闭(1)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("Cg_POInStockBill/CloseRowCg_POInStockBill")]
        [HttpGet]
        public object CloseRowCg_POInStockBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Cg_POInStockBill_Close";
            string SubBillName = "Cg_POInStockBillSub";                   //子表表名
            DBUtility.ClsPub.CurUserName = CurUserName;
            DataSet ds = null;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "行关闭失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
                    ds = oCN.RunProcReturn(sql, "Cg_POInStockBillSub");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "该行数据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //行关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行已关闭!不能再次行关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //行反关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行未关闭!不需要再行反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //判断行是否为自动关闭
                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行反关闭失败!行为自动关闭,不能进行手动反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的行关闭/行反关闭操作
                if (IsAudit == 0) //行关闭提交
                {
                    //行关闭提交
                    if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "行关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "行关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //行反关闭提交
                {
                    //行反关闭提交
                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ”¶æ–™é€šçŸ¥å• ä½œåºŸ/反作废功能
        [Route("Cg_POInStockBill/DropCg_POInStockBill")]
@@ -1605,5 +1827,42 @@
            }
        }
        #endregion
        #region æ”¶æ–™é€šçŸ¥å• æ ¹æ®ä¸»å†…码与子内码获取收料通知单数据
        [Route("Cg_POInStockBill/loadCg_POInStockBill_Push")]
        [HttpGet]
        public object loadCg_POInStockBill_Push(long HInterID, long HSubID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_POInStockBillList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未查询到源单信息!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    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
    }
}
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -748,18 +748,22 @@
                List<ClsCg_POOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HPURCHASEORGID = mainList2[0].HOrgID;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
                string HUpDater = mainList2[0].HUpDater == null ? "''" : mainList2[0].HUpDater;
                string HCloseMan = mainList2[0].HCloseMan == null ? "''" : mainList2[0].HCloseMan;
                string HDeleteMan = mainList2[0].HDeleteMan == null ? "''" : mainList2[0].HDeleteMan;
                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
                string HUpDateDate = mainList2[0].HUpDateDate == null ? "''" : mainList2[0].HUpDateDate;
                string HDeleteDate = mainList2[0].HDeleteDate == null ? "''" : mainList2[0].HDeleteDate;
                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
                long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
                long HPURCHASERGROUPID = mainList2[0].HPURCHASERGROUPID == null ? 0 : mainList2[0].HPURCHASERGROUPID;    //采购组
                long HPROVIDERID = mainList2[0].HPROVIDERID == null ? 0 : mainList2[0].HPROVIDERID;    //供货方
@@ -808,21 +812,20 @@
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HAddress,HSSID,HSSDate,HPSStyleID,HSupID,HCurID
                        ,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark,HInnerBillNo
                        ,HChecker,HCheckDate,HMaker,HMakeDate
                        ,HMaker,HMakeDate
                        ,HERPInterID,HERPBillType,HPURCHASEORGID
                        ,HPURCHASERGROUPID,HPROVIDERID,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HPROVIDERADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1102 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    1102 + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSSID + ",'" + HSSDate + "'," + HPSStyleID + "," + HSupID + "," + HCurID +
                    "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HChecker + "','" + HCheckDate + "','" + HMaker + "','" +
                    HMakeDate + "'," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HPURCHASERGROUPID + ","
                    "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HMaker + "',getdate()" + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HPURCHASERGROUPID + ","
                    + HPROVIDERID + "," + HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HPROVIDERADDRESS + "',"
                    + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Cg_POOrderBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSSID=" + HSSID + ",HPSStyleID=" + HPSStyleID + ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "' where HInterID=" + HInterID);
@@ -882,6 +885,7 @@
            string HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? "''" : DetailColl2[0].HSourceEntryID;
            long HSEQ = DetailColl2[0].HSEQ == null ? 0 : DetailColl2[0].HSEQ;//行号
            long HSTOCKORGID = DetailColl2[0].HSTOCKORGID == null ? 0 : DetailColl2[0].HSTOCKORGID;//收料组织
            long HRECEIVEDEPTID = DetailColl2[0].HRECEIVEDEPTID == null ? 0 : DetailColl2[0].HRECEIVEDEPTID;//收料部门
            string HSUPPLIERLOT = DetailColl2[0].HSUPPLIERLOT == null ? "''" : DetailColl2[0].HSUPPLIERLOT;//供应商批号
            long HBOMID = DetailColl2[0].HBOMID == null ? 0 : DetailColl2[0].HBOMID;//BOM版本
@@ -970,14 +974,14 @@
                ,HMoney,HTaxRate,HTaxMoney,HLineTotal,HlineTotalBB,HDate,HInStockQty,HInvoiceQty,HSeOrderBillNo,HSeOrderInterID
                ,HSeOrderEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
                ,HSourceBillType,HRelationQty,HBackRelationQty,HPropertyID,HBatChNo,HAuxPropID,HMTONo
                ,HERPInterID,HERPEntryID
                ,HERPInterID,HERPEntryID,HSTOCKORGID
                ,HSEQ,HRECEIVEDEPTID,HSUPPLIERLOT,HBOMID,HSTOCKUNITID,HBASEUNITID,HBFLOWID,HGIVEAWAY,HROWTYPE,HBASEUNITQTY,HSTOCKBASEQTY
                ,HREQTRACENO,HTAXNETPRICE,HPRICECOEFFICIENT,HTAXCOMBINATION,HPRICEUNITID,HPRICELISTENTRY,HPAYORGID,HSETTLEMODEID,HSETTLECURRID
                ,HEXCHANGETYPEID,HPAYCONDITIONID,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT
                ,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HMATERIALDESC) 
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},'{oSub.HDate}',{oSub.HInStockQty},{oSub.HInvoiceQty},{HSeOrderBillNo},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},{HBackRelationQty},{HPropertyID},{HBatChNo},
                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}')");
                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSTOCKORGID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}')");
            }
            //保存后控制=========================================              
@@ -1052,7 +1056,7 @@
                    ,HMoney,HTaxRate,HTaxMoney,HLineTotal,HlineTotalBB,HDate,HInStockQty,HInvoiceQty,HSeOrderBillNo,HSeOrderInterID
                    ,HSeOrderEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
                    ,HSourceBillType,HRelationQty,HBackRelationQty,HPropertyID,HBatChNo,HAuxPropID,HMTONo
                    ,HERPInterID,HERPEntryID
                    ,HERPInterID,HERPEntryID,HSTOCKORGID
                    ,HSEQ,HRECEIVEDEPTID,HSUPPLIERLOT,HBOMID,HSTOCKUNITID,HBASEUNITID,HBFLOWID,HGIVEAWAY,HROWTYPE,HBASEUNITQTY,HSTOCKBASEQTY
                    ,HREQTRACENO,HTAXNETPRICE,HPRICECOEFFICIENT,HTAXCOMBINATION,HPRICEUNITID,HPRICELISTENTRY,HPAYORGID,HSETTLEMODEID,HSETTLECURRID
                    ,HEXCHANGETYPEID,HPAYCONDITIONID,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT
@@ -1061,7 +1065,7 @@
                    '{oSub.HMoney}','{oSub.HTaxRate}','{oSub.HTaxMoney}','{oSub.HlineTotal}','{oSub.HlineTotalBB}','{oSub.HDate}','{oSub.HInStockQty}','{oSub.HInvoiceQty}','{oSub.HSeOrderBillNo}','{oSub.HSeOrderInterID}',
                    '{oSub.HSeOrderEntryID}','{oSub.HRemark}','{oSub.HSourceInterID}','{oSub.HSourceEntryID}','{oSub.HSourceBillNo}',
                    '{oSub.HSourceBillType}','{oSub.HRelationQty}','{oSub.HBackRelationQty}','{oSub.HPropertyID}','{oSub.HBatChNo}','{oSub.HAuxPropID}','{oSub.HMTONo}',
                    '{oSub.HERPInterID}','{oSub.HERPEntryID}',
                    '{oSub.HERPInterID}','{oSub.HERPEntryID}','{oSub.HSTOCKORGID}',
                    '{oSub.HSEQ}','{oSub.HRECEIVEDEPTID}','{oSub.HSUPPLIERLOT}','{oSub.HBOMID}','{oSub.HSTOCKUNITID}','{oSub.HBASEUNITID}','{oSub.HBFLOWID}','{oSub.HGIVEAWAY}','{oSub.HROWTYPE}','{oSub.HBASEUNITQTY}','{oSub.HSTOCKBASEQTY}',
                    '{oSub.HREQTRACENO}','{oSub.HTAXNETPRICE}','{oSub.HPRICECOEFFICIENT}','{oSub.HTAXCOMBINATION}','{oSub.HPRICEUNITID}','{oSub.HPRICELISTENTRY}','{oSub.HPAYORGID}','{oSub.HSETTLEMODEID}','{oSub.HSETTLECURRID}',
                    '{oSub.HEXCHANGETYPEID}','{oSub.HPAYCONDITIONID}','{oSub.HEXCHANGERATE}','{oSub.HLOCALCURRID}','{oSub.HISINCLUDEDTAX}','{oSub.HISPRICEEXCLUDETAX}','{oSub.HTAXRATEID}','{oSub.HCOSTPERCENT}','{oSub.HCOSTAMOUNT}',
@@ -1236,7 +1240,6 @@
        #region é‡‡è´­è®¢å• å®¡æ ¸/反审核
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -1244,54 +1247,95 @@
        /// <returns></returns>
        [Route("Cg_POOrderBill/AuditCg_POOrderBill")]
        [HttpGet]
        public object AuditCg_POOrderBill(string HInterID, int Type, string user)
        public object AuditCg_POOrderBill(int HInterID, int IsAudit, string CurUserName)
        {
            string sql = "";
            string ModRightNameCheck = "Cg_POOrderBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Cg_POOrderBill_Check", 1, false, user))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Cg_POOrderBillMain";
                ds = oCN.RunProcReturn("select * from Cg_POOrderBillMain where HInterID = " + int.Parse(HInterID), "Cg_POOrderBillMain");
                string HBillNo = "";
                oCN.BeginTran();//开始事务
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POOrderBill oBill = new DAL.ClsCg_POOrderBill();                              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //审核前控制
                    sql = "exec h_p_Cg_POOrderBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POOrderBill_BeforeCheckCtrl");
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Cg_POOrderBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Cg_POOrderBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -1299,8 +1343,8 @@
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
@@ -1309,165 +1353,79 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Cg_POOrderBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POOrderBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //反审核前控制
                    sql = "exec h_p_Cg_POOrderBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Cg_POOrderBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Cg_POOrderBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                ////判断单据是否已经审核
                //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;
                //        }
                //    }
                //}
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Cg_POOrderBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Cg_POOrderBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                //oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Cg_POOrderBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é‡‡è´­è®¢å• å…³é—­/反关闭功能
        [Route("Cg_POOrderBill/CloseCg_POOrderBill")]
@@ -1616,6 +1574,181 @@
        }
        #endregion
        #region é‡‡è´­è®¢å• è¡Œå…³é—­/行反关闭
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(0),反关闭(1)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("Cg_POOrderBill/CloseRowCg_POOrderBill")]
        [HttpGet]
        public object CloseRowCg_POOrderBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Cg_POOrderBill_Close";
            string SubBillName = "Cg_POOrderBillSub";                   //子表表名
            DBUtility.ClsPub.CurUserName = CurUserName;
            DataSet ds = null;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "行关闭失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsCg_POOrderBill oBill = new DAL.ClsCg_POOrderBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
                    ds = oCN.RunProcReturn(sql, "Cg_POOrderBillSub");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "该行数据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //行关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行已关闭!不能再次行关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //行反关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行未关闭!不需要再行反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //判断行是否为自动关闭
                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行反关闭失败!行为自动关闭,不能进行手动反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的行关闭/行反关闭操作
                if (IsAudit == 0) //行关闭提交
                {
                    //行关闭提交
                    if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "行关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "行关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //行反关闭提交
                {
                    //行反关闭提交
                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é‡‡è´­è®¢å• ä½œåºŸ/反作废功能
        [Route("Cg_POOrderBill/DropCg_POOrderBill")]
WebAPI/Controllers/CGGL/Cg_PayableBillController.cs
@@ -151,6 +151,7 @@
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "1114";
                    oItem.HBillSubType = "1114";
@@ -194,6 +195,7 @@
                bool bResult;
                if (refSav == "Add")
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
WebAPI/Controllers/CGGL/Kf_POStockInBackBillController.cs
@@ -202,19 +202,19 @@
                    String sql = $@"Insert Into Kf_ICStockBillMain 
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID ,HChecker,HCheckDate,HMaker,HMakeDate)
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID ,HMaker,HMakeDate)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1239 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," +
                    HSecManagerID + "," + HKeeperID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HChecker + "',getdate()" + ",'" + HMaker + "',getdate()" + ")";
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate()" + ")";
                    oCN.RunProc(sql);
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    String sql = $@"update Kf_ICStockBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID
                                 + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
                                 + ",HAddress='" + HAddress + "'where HInterID=" + HInterID;
@@ -225,6 +225,9 @@
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
                //采购退料单新增回填退料通知单关联数量
                oCN.RunProc("exec h_p_Kf_UpDateRelation_POStockInBackToPOInStockBack_Add " + HInterID);
                if (objJsonResult.code == "0")
                {
@@ -384,58 +387,13 @@
        /// <returns></returns>
        [Route("Kf_POStockInBackBill/DeltetKf_POStockInBackBill")]
        [HttpGet]
        public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId,string user)
        public object DeltetKf_POStockInBackBill(string HInterID, string user)
        {
            DataSet ds;
            DataSet dss;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBackBill_Delete", 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(Hmainid))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Hmainid为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain a inner join Kf_ICStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '" + Hmainid + "'", "Kf_ICStockBillMain");
                dss = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain '" + user + " '", "h_p_Cg_POInStockBillMain");
                var sReturn = "";
                string HBillNo = "";
                if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有数据,无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                //删除前控制=========================================      
                string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
                string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBackBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
@@ -456,21 +414,14 @@
                }
                //==================================================================================      
                if (ds.Tables[0].Rows.Count == 1)
                {
                    oCN.RunProc("delete Kf_ICStockBillSub where HInterID=" + Hmainid);
                    oCN.RunProc("delete Kf_ICStockBillMain where HInterID=" + Hmainid);
                }
                else
                {
                    oCN.RunProc($"delete Kf_ICStockBillSub where HInterID={ Hmainid}and HEntryID={HsupId}");
                }
                oCN.Commit();//提交事务
                string sReturn = "";
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCN.Commit();
                //删除后控制==================================================================================      
                string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
                string sql2 = "exec h_p_Kf_POStockInBackBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_Kf_POStockInBackBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
@@ -494,24 +445,22 @@
                }
                //==============================================================================================
                objJsonResult.code = "0";
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "数据删除成功!";
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•
@@ -575,151 +524,83 @@
        }
        #endregion
        #region é‡‡è´­é€€æ–™å• å®¡æ ¸ åå®¡æ ¸
        #region é‡‡è´­é€€æ–™å• å®¡æ ¸/反审核
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Kf_POStockInBackBill/AuditProcessReportList")]
        [HttpGet]
        public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName)
        {
            string sql = "";
            string ModRightNameCheck = "Kf_POStockInBackBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //flag=1 å®¡æ ¸ï¼›  flag=2 åå®¡æ ¸
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Kf_POStockInBackBill_Check", 1, false, CurUserName))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无审核权限!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                string HBillNo = "";
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain where HInterID = " + HInterID, "Kf_ICStockBillMain");
                if (lngBillKey == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据ID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DLL.ClsKf_SellOutBackBill oBill = new DLL.ClsKf_SellOutBackBill();
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //审核前控制
                    sql = "h_p_Kf_POStockInBackBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBackBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsKf_POStockInBackBill oBill = new DAL.ClsKf_POStockInBackBill();                              //实例化单据操作类,用于进行相关操作
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (!BillOld.CheckBill(HInterID, HBillNo, "h_p_Kf_POStockInBackBill_AfterCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HCloseMan != "")
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据已关闭,不能审核";
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan != "")
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据已作废,不能审核";
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 1)
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HBillStatus == 2)
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "当前单据已审核,无需再次审核";
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            string HCheckDate = DateTime.Now.Date.ToString();
                            oCN.RunProc(" Update Kf_ICStockBillMain set HChecker='" + CurUserName + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='1239' and HInterID=" + HInterID);
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核成功!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    else
                    if (IsAudit == 1) //反审核判断
                    {
                        //反审核前控制
                        sql = "exec h_p_Kf_POStockInBackBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
                        ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBackBill_BeforeUnCheckCtrl");
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (BillOld.AbandonCheck(HInterID, HBillNo, "h_p_Kf_POStockInBackBill_AfterUnCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo))
                        {
                            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        }
                        if (oBill.omodel.HBillStatus == 1)
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "当前单据未审核,无需反审核";
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            string HCheckDate = DateTime.Now.Date.ToString();
                            oCN.RunProc(" Update Kf_ICStockBillMain set HChecker=' ',HCheckDate=null,HBillStatus=1 Where HBillType='1239' and HInterID=" + HInterID);
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核成功!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
@@ -728,17 +609,103 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Kf_POStockInBackBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBackBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBackBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Kf_POStockInBackBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_POStockInBackBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBackBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或反审核失败 " + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -892,7 +859,6 @@
        }
        #endregion
        #region é‡‡è´­é€€æ–™å• ä½œåºŸ/反作废功能
        [Route("Kf_POStockInBackBill/DropKf_POStockInBackBill")]
        [HttpGet]
@@ -975,14 +941,14 @@
                    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]["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";
@@ -1022,8 +988,6 @@
            }
        }
        #endregion
    }
}
#endregion
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -22,11 +22,6 @@
        public DataSet ds = new DataSet();
        public object HRemark { get; private set; }
        public object HSourceBillNo { get; private set; }
        public object HSourceBillType { get; private set; }
        public object HPOOrderBillNo { get; private set; }
        public object HAuxPropID { get; private set; }
        public object HBatchNO { get; private set; }
        public object HRelationQty { get; private set; }
        public object sql { get; private set; }
        public object oCn { get; private set; }
@@ -40,13 +35,14 @@
        /// </summary>
        [Route("Kf_POStockInBill/list")]
        [HttpGet]
        public object list(string sWhere)
        public object list(string sWhere, string user)
        {
            try
            {
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Kf_POStockInBillList order by hmainid desc", "h_v_Kf_POStockInBillList");
                    string sql = "select * from h_v_Kf_POStockInBillList order by hmainid desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Kf_POStockInBillList");
                }
                else
                {
@@ -147,7 +143,7 @@
                long HWHID = mainList[0].HWHID;//仓库
                long HCurID = mainList[0].HCurID;//币别
                long HManagerID = mainList[0].HManagerID;//主管
                long HSTOCKORGID = mainList[0].HSTOCKORGID;//库存组织
                long HSTOCKORGID = mainList[0].HOrgID;//库存组织
                long HOWNERID = mainList[0].HOWNERID;//货主
                long HSCWHID = mainList[0].HSCWHID;//调出仓库
                long HSecManagerID = mainList[0].HSecManagerID;//验收
@@ -202,22 +198,22 @@
                    String sql =$@"Insert Into Kf_ICStockBillMain 
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID ,HChecker,HCheckDate,HMaker,HMakeDate)
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1201 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," + 
                    HSecManagerID + ","+ HKeeperID +"," + HDeptID + ",'" + HExplanation + "','" + HRemark
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HChecker + "',getdate()" + ",'" + HMaker + "',getdate()" +")";
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate()" +")";
                    oCN.RunProc(sql);
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    String sql = $@"update Kf_ICStockBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID
                                 + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
                                 + ",HAddress='" + HAddress + "'where HInterID=" + HInterID;
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
                    //删除子表
@@ -225,6 +221,13 @@
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
                //采购入库单新增回填采购订单关联数量
                oCN.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPOStockIn_Add " + HInterID);
                //采购入库单新增回填收料通知单关联数量
                oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Add " + HInterID);
                if (objJsonResult.code == "0")
                {
@@ -334,17 +337,17 @@
                ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)}
                ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}')";
                string sReturn = "";
                ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain");
                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //string sReturn = "";
                //ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain");
                //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                //{
                //    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = sReturn;
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                oCN.RunProc(sql);
@@ -377,57 +380,19 @@
            return objJsonResult;
        }
        /// <summary>
        ///删除功能
        /// </summary>
        /// <returns></returns>
        [Route("Kf_POStockInBill/DeltetKf_POStockInBill")]
        [HttpGet]
        public object DeleteKf_POStockInBackBill(string Hmainid, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user)
        public object DeltetKf_POStockInBill(string HInterID, string user)
        {
            DataSet ds;
            DataSet dss;
            //string ModRightNameCheck = "Sc_ProcessReport_check";
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBackBill_Delete", 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(Hmainid))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "Hmainid为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string HBillNo = "";
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain  where HInterID=" + Hmainid, "Kf_ICStockBillMain ");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有数据,无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                }
                //删除前控制=========================================      
                string sql1 = "exec h_p_Kf_POStockInBill_BeforeDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
                string sql1 = "exec h_p_Kf_POStockInBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
@@ -448,36 +413,14 @@
                }
                //==================================================================================      
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain a inner join Kf_ICStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '"+ Hmainid+"'", "Kf_ICStockBillMain");
                dss = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain_Delete");
                var sReturn = "";
                if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows.Count  == 1)
                {
                    oCN.RunProc("delete Kf_ICStockBillSub where HInterID=" + Hmainid);
                    oCN.RunProc("delete Kf_ICStockBillMain where HInterID=" + Hmainid);
                }
                else
                {
                    oCN.RunProc($"delete Kf_ICStockBillSub where HInterID={ Hmainid}and HEntryID={HsupId}");
                }
                oCN.Commit();//提交事务
                string sReturn = "";
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCN.Commit();
                //删除后控制==================================================================================      
                string sql2 = "exec h_p_Kf_POStockInBill_AfterDelCtrl " + Hmainid + ",'" + HBillNo + "','" + user + "'";
                string sql2 = "exec h_p_Kf_POStockInBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_Kf_POStockInBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
@@ -501,24 +444,25 @@
                }
                //==============================================================================================
                objJsonResult.code = "0";
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "数据删除成功!";
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        /// <summary>
        /// æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•
        ///参数:string sql。
@@ -583,7 +527,6 @@
        #region é‡‡è´­å…¥åº“单 å®¡æ ¸/反审核
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -591,55 +534,95 @@
        /// <returns></returns>
        [Route("Kf_POStockInBill/AuditKf_POStockInBill")]
        [HttpGet]
        public object AuditKf_POStockInBill(string HInterID, int Type, string user)
        public object AuditKf_POStockInBill(int HInterID, int IsAudit, string CurUserName)
        {
            string sql = "";
            string ModRightNameCheck = "Kf_POStockInBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Check", 1, false, user))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                ds = oCN.RunProcReturn("select * from Kf_ICStockBillMain where HInterID = " + int.Parse(HInterID), "Kf_ICStockBillMain");
                string HBillNo = "";
                DAL.ClsKf_POStockInBill oBill = new DAL.ClsKf_POStockInBill();
                oCN.BeginTran();//开始事务
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsKf_POStockInBill oBill = new DAL.ClsKf_POStockInBill();                              //实例化单据操作类,用于进行相关操作
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制
                    sql = "h_p_Kf_POStockInBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBill_BeforeCheckCtrl");
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Kf_POStockInBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_POStockInBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -647,8 +630,8 @@
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
@@ -657,71 +640,73 @@
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    if (!BillOld.CheckBill(int.Parse(HInterID), HBillNo, "h_p_Kf_POStockInBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //反审核前控制
                    sql = "exec h_p_Kf_POStockInBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Kf_POStockInBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (BillOld.AbandonCheck(int.Parse(HInterID), HBillNo, "h_p_Kf_POStockInBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Kf_POStockInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_POStockInBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -876,6 +861,182 @@
        #endregion
        #region é‡‡è´­å…¥åº“单 è¡Œå…³é—­/行反关闭
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(0),反关闭(1)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("Kf_POStockInBill/CloseRowKf_POStockInBill")]
        [HttpGet]
        public object CloseRowKf_POStockInBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Kf_POStockInBill_Close";
            string SubBillName = "Kf_ICStockBillSub";                   //子表表名
            DBUtility.ClsPub.CurUserName = CurUserName;
            DataSet ds = null;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "行关闭失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsKf_POStockInBill oBill = new DAL.ClsKf_POStockInBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
                    ds = oCN.RunProcReturn(sql, "Kf_ICStockBillSub");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "该行数据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //行关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行已关闭!不能再次行关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //行反关闭判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行未关闭!不需要再行反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //判断行是否为自动关闭
                        string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
                        if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "行反关闭失败!行为自动关闭,不能进行手动反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的行关闭/行反关闭操作
                if (IsAudit == 0) //行关闭提交
                {
                    //行关闭提交
                    if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "行关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "行关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //行反关闭提交
                {
                    //行反关闭提交
                    if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é‡‡è´­å…¥åº“单 ä½œåºŸ/反作废功能
        [Route("Kf_POStockInBill/DropKf_POStockInBill")]
        [HttpGet]
@@ -884,7 +1045,7 @@
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Drop", 1, false, user))
                if (!DBUtility.ClsPub.Security_Log("Kf_POStockInBill_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
New file
@@ -0,0 +1,1231 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Models;
using Newtonsoft.Json;
using Model;
using DBUtility;
namespace WebAPI.Controllers.MJGL
{
    public class Sc_MouldUpperBillController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
        #region ä¸Šæ¨¡å• åˆ—表查询
        [Route("Sc_MouldUpperBill/Sc_MouldUpperBillList")]
        [HttpGet]
        public object Sc_MouldUpperBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from  h_v_Qj_Sc_MouldUpperBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldUpperBillList");
                //添加列名
                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 ä¸Šæ¨¡å• æ–°å¢ž
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill")]
        [HttpPost]
        public object AddSc_MouldUpperBill([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddBillMain(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "新增单据成功!";
            objJsonResult.data = ds.Tables[0];
            return objJsonResult;
        }
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            string user = sArray[3].ToString();//用户名
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2);
                string HBillType = "3846";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," +  HOrgID +
                    ","+ HDeptID + ","+ HEmpID + ","+ HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldUpperBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, HBillNo);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub(string msg3, long HInterID,string HBillNo)
        {
            List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3);
            int i = 0;
            foreach (ClsSc_MouldUpperBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo)
                    values("
                     + HInterID + ",'"+ HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() +
                     "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸Šæ¨¡å•删除功能
        [Route("Sc_MouldUpperBill/DeltetSc_MouldUpperBill")]
        [HttpGet]
        public object DeltetSc_MouldUpperBill(string HInterID, int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string[] HInterIDs = HInterID.Split(',');
            string[] HBillNos = new string[HInterIDs.Length];
            for (int i = 0; i < HInterIDs.Length; i++)
            {
                oCN.BeginTran();
                string hmainid = HInterIDs[i].Split('_')[0];
                string hsubid = HInterIDs[i].Split('_')[1];
                ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldUpperBillMain a
                                    inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID
                                    where a.HInterID = " + hmainid , "Sc_MouldUpperBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                        {
                            if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin"))
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "单据号:" + HBillNos[i] + "只能删除本人的单据!";
                                objJsonResult.data = null;
                                oCN.RollBack();
                                return objJsonResult;
                            }
                        }
                    }
                    if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HChecker"].ToString()  != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows.Count == 1) {
                        oCN.RunProc("delete from Sc_MouldUpperBillMain where HInterID=" + hmainid);
                    }
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
                    oCN.Commit();
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "删除成功!";
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸Šæ¨¡å•审核/反审核功能
        [Route("Sc_MouldUpperBill/CheckSc_MouldUpperBill")]
        [HttpGet]
        public object CheckSc_MouldUpperBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_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 = "Sc_MouldUpperBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        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
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        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 (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        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("Sc_MouldUpperBill/Sc_MouldLowerBillList")]
        [HttpGet]
        public object Sc_MouldLowerBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from  h_v_Qj_Sc_MouldLowerBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldLowerBillList");
                //添加列名
                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 ä¸‹æ¨¡å• æ–°å¢ž
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldLowerBill")]
        [HttpPost]
        public object AddSc_MouldLowerBill([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddMouldLowerBill(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "新增单据成功!";
            objJsonResult.data = ds.Tables[0];
            return objJsonResult;
        }
        public json AddMouldLowerBill(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            string user = sArray[3].ToString();//用户名
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2);
                string HBillType = "3847";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldLowerBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddMouldLowerBill(string msg3, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg3);
            int i = 0;
            foreach (ClsSc_MouldLowerBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() +
                     "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å•删除功能
        [Route("Sc_MouldUpperBill/DeltetSc_MouldLowerBill")]
        [HttpGet]
        public object DeltetSc_MouldLowerBill(string HInterID, int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string[] HInterIDs = HInterID.Split(',');
            string[] HBillNos = new string[HInterIDs.Length];
            for (int i = 0; i < HInterIDs.Length; i++)
            {
                oCN.BeginTran();
                string hmainid = HInterIDs[i].Split('_')[0];
                string hsubid = HInterIDs[i].Split('_')[1];
                ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldLowerBillMain a
                                    inner join Sc_MouldLowerBillSub b on a.HInterID = b.HInterID
                                    where a.HInterID = " + hmainid, "Sc_MouldLowerBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                        {
                            if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin"))
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "单据号:" + HBillNos[i] + "只能删除本人的单据!";
                                objJsonResult.data = null;
                                oCN.RollBack();
                                return objJsonResult;
                            }
                        }
                    }
                    if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        oCN.RunProc("delete from Sc_MouldLowerBillMain where HInterID=" + hmainid);
                    }
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
                    oCN.Commit();
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "删除成功!";
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å•审核/反审核功能
        [Route("Sc_MouldUpperBill/CheckSc_MouldLowerBill")]
        [HttpGet]
        public object CheckSc_MouldLowerBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_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 = "Sc_MouldLowerBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        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 {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        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 (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        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("Sc_MouldUpperBill/txtHBarCode_KeyDown")]
        [HttpGet]
        public object txtHBarCode_KeyDown(string HBarCode, string UserID, string HBillType)
        {
            try
            {
                if (HBarCode == null || HBarCode.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "空白码,条形码不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //拆分条形码
                string sBillBarCode = HBarCode.Trim();
                //截取条码类型2 å‰ä¸¤ä½
                string BillNoType2 = sBillBarCode.Substring(0, Math.Min(2, sBillBarCode.Length));
                //截取条码类型 å‰ä¸‰ä½
                string BillNoType3 = sBillBarCode.Substring(0, Math.Min(3, sBillBarCode.Length));
                //截取条码类型3 å‰å››ä½
                string BillNoType4 = sBillBarCode.Substring(0, Math.Min(4, sBillBarCode.Length));
                switch (BillNoType2)
                {
                    //生产资源
                    case "BM":
                    case "SS":
                        ds = oCN.RunProcReturn("select HItemID,HName,HNumber from Gy_Source where HNumber = '" + HBarCode + "'", "Gy_Source");
                        break;
                    case "MO":
                        ds = oCN.RunProcReturn("select å•据号,hmainid,HEntryID from h_v_IF_ICMOBillList where å•据号 = '" + HBarCode + "'", "h_v_IF_ICMOBillList");
                        break;
                    default:
                        break;
                }
                switch (BillNoType3)
                {
                    //器具档案
                    case "MJD":
                    case "PAK":
                        ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where å•据号 = '" + HBarCode + "'", "h_v_Gy_MouldFileList");
                        break;
                    default:
                        break;
                }
                switch (BillNoType4)
                {
                    //流转卡
                    case "GXLX":
                        ds = oCN.RunProcReturn("select ä»»åŠ¡å•å·,hicmointerid,HICMOEntryID,单据号,hmainid,HEntryID from h_v_Sc_ProcessExchangeBillQuerySub where å•据号 = '" + HBarCode + "'", "h_v_Sc_ProcessExchangeBillQuerySub");
                        break;
                    default:
                        break;
                }
                if (ds == null || ds .Tables.Count== 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查无数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                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 ä¸Šæ¨¡å• PDA新增
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill_PDA")]
        [HttpPost]
        public object AddSc_MouldUpperBill_PDA([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddBillMain_PDA(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "新增单据成功!";
            objJsonResult.data = ds.Tables[0];
            return objJsonResult;
        }
        public json AddBillMain_PDA(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();//用户名
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2);
                string HBillType = "3846";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = mainList[0].HDate;//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldUpperBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub_PDA(string msg2, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg2);
            int i = 0;
            foreach (ClsSc_MouldUpperBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo
                    ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID
                    ,HScanDate,HBarCode)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString()
                     + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString()
                     + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å• PDA新增
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldLowerBill_PDA")]
        [HttpPost]
        public object AddSc_MouldLowerBill_PDA([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddSc_MouldLowerBillMain_PDA(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "新增单据成功!";
            objJsonResult.data = ds.Tables[0];
            return objJsonResult;
        }
        public json AddSc_MouldLowerBillMain_PDA(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();//用户名
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2);
                string HBillType = "3847";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = mainList[0].HDate;//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldLowerBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg2);
            int i = 0;
            foreach (ClsSc_MouldLowerBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo
                    ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID
                    ,HScanDate,HBarCode)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString()
                     + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString()
                     + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
    }
}
WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs
New file
@@ -0,0 +1,542 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.SBGL
{
    public class Gy_FixCardBillController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        public DAL.ClsGy_FixCardBill BillOld = new DAL.ClsGy_FixCardBill();
        #region å›ºå®šèµ„产卡片列表查询
        [Route("Gy_FixCardBill/list")]
        [HttpGet]
        public object list(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_FixCardBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = string.Format(@"select * from h_v_Gy_FixCardBillList where 1 = 1");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(sql1 + sWhere , "h_v_Gy_FixCardBillList");
                }
                else
                {
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_FixCardBillList");
                }
                //添加列名
                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("Gy_FixCardBill/SaveFixCardBillList")]
        [HttpPost]
        public object SaveFixCardBillList([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //表头信息
            string msg3 = sArray[1].ToString(); //表体信息
            string msg4 = sArray[2].ToString(); //用户
            string OperationType = sArray[3].ToString(); //操作类型
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill();
                List<Model.ClsGy_FixCardBillMain> lsmain = new List<Model.ClsGy_FixCardBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_FixCardBillMain(msg2);
                foreach (Model.ClsGy_FixCardBillMain oItem in lsmain)
                {
                    //oItem.HMaker = "";
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3335";
                    oItem.HBillSubType = "3335";
                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HBillStatus = 1;
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsGy_FixCardBillSub_Emp> ls = new List<Model.ClsGy_FixCardBillSub_Emp>();
                ls = oListModels.getObjectByJson_Gy_FixCardBillSub_Emp(msg3);
                int i = 0;
                foreach (Model.ClsGy_FixCardBillSub_Emp oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (OperationType == "1")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "1";
                    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("Gy_FixCardBill/DelFixCardBill")]
        [HttpGet]
        public object DelFixCardBill(string HInterID, string user)
        {
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据ID为空!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DAL.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill();
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                ds = oCN.RunProcReturn("select * from Gy_FixCardBillMain where HInterID=" + lngBillKey, "Gy_FixCardBillMain");
                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已经审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //删除前控制=========================================
                string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                string sql1 = "exec h_p_Gy_FixCardBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Gy_FixCardBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                bool IsDete = oBill.DeleteBill(lngBillKey, HBillNo, "h_p_Gy_FixCardBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "1";
                    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;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据未找到";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //#endregion
        #region å›ºå®šèµ„产卡片 å®¡æ ¸/反审核功能
        [Route("Gy_FixCardBill/CheckGy_FixCardBill")]
        [HttpGet]
        public object CheckGy_FixCardBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_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 = "Gy_FixCardBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Gy_FixCardBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Gy_FixCardBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å›ºå®šèµ„产 å…³é—­/反关闭功能
        [Route("Gy_FixCardBill/CloseGy_FixCardBill")]
        [HttpGet]
        public object CloseGy_FixCardBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_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 = "Gy_FixCardBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不需要再关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -884,7 +884,663 @@
        }
        #endregion
        #region ç›´æŽ¥è°ƒæ‹¨å•
        #region ç›´æŽ¥è°ƒæ‹¨å• ä¿å­˜/编辑
        /// <summary>
        /// ç›´æŽ¥è°ƒæ‹¨å•
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("Kf_MoveStockBill/SaveKf_MoveStockBillMain")]
        [HttpPost]
        public object SaveKf_MoveStockBillMain([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString(); //子表
            string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string msg4 = sArray[3].ToString();//用户名
            DBUtility.ClsPub.CurUserName = msg4;
            string UserName = "";
            string s = "";
            ListModels oListModels = new ListModels();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsKf_MoveStockBill oBill = new DAL.ClsKf_MoveStockBill();
                List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Kf_MoveStockBillMain(msg2);
                foreach (Model.ClsKf_MoveStockBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (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;
                        }
                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = s + ",不允许修改";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    oItem.HMaker = msg4;
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "1207";
                    oItem.HBillSubType = "1207";
                    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;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsKf_MoveStockBillSub> ls = new List<Model.ClsKf_MoveStockBillSub>();
                ls = oListModels.getObjectByJson_Kf_MoveStockBillSub(msg3);
                int i = 0;
                oBill.DetailColl.Clear();
                foreach (Model.ClsKf_MoveStockBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HCloseType = false;   //关闭类型
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (refSav == "Add")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (refSav == "Update")
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = false;
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶ä»–入库单 ç¼–辑页面初始化
        [Route("Kf_MoveStockBill/Kf_MoveStockBillEdit")]
        [HttpGet]
        public object Kf_MoveStockBillEdit(long HInterID)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                ds = oCN.RunProcReturn("exec h_p_Kf_MoveStockBill_Edit  " + HInterID, "h_p_Kf_MoveStockBill_Edit");
                tableList.Add(ds.Tables[0]);
                tableList.Add(ds.Tables[1]);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = tableList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶å®ƒå…¥åº“单审核/反审核功能
        [Route("Kf_MoveStockBill/CheckKf_MoveStockBill")]
        [HttpGet]
        public object CheckKf_MoveStockBill(string HInterID, int Type, string user)
        {
            try
            {
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill();
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_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;
                }
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Kf_MoveStockBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核单据
                    if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Kf_MoveStockBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //===========================================================
                    //反审核单据
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶å®ƒå…¥åº“单关闭/反关闭功能
        [Route("Kf_MoveStockBill/CloseKf_MoveStockBill")]
        [HttpGet]
        public object CloseKf_MoveStockBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_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 = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不需要再关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶ä»–入库单 ä½œåºŸ/反作废功能
        [Route("Kf_MoveStockBill/DropKf_MoveStockBill")]
        [HttpGet]
        public object DropKf_MoveStockBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_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 = "Kf_ICStockBillMain";
                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
        #region è°ƒæ‹¨å•列表
        /// <summary>
        /// è°ƒæ‹¨å•列表
        /// </summary>
@@ -931,7 +1587,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region è°ƒæ‹¨å•  åˆ é™¤
        [Route("Kf_MoveStockBill/DelteteGetMoveStockBill")]
@@ -940,6 +1596,9 @@
        {
            try
            {
                string s = "";
                DAL.ClsKf_MoveStockBill oBill = new DAL.ClsKf_MoveStockBill();
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Drop", 1, false, user))
                {
@@ -950,9 +1609,57 @@
                    return objJsonResult;
                }
                //删除前控制=========================================
                string sql1 = "exec h_p_Kf_MoveStockBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                //删除后控制==================================================================================
                string sql2 = "exec h_p_Kf_MoveStockBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_Kf_MoveStockBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    s = "删除后判断失败,请与网络管理人员联系";
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                //==============================================================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -971,6 +1678,9 @@
            }
        }
        #endregion
        #endregion
        /// <summary>
        /// é”€å”®å‡ºåº“单列表
@@ -1152,7 +1862,227 @@
        }
        #endregion
        #region  å…¶ä»–出库单
        #region å…¶ä»–出库单保存/编辑
        /// <summary>
        /// å…¶ä»–入库单
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("Kf_OtherOutBill/SaveKf_OtherOutBillMain")]
        [HttpPost]
        public object SaveKf_OtherOutBillMain([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString(); //子表
            string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string msg4 = sArray[3].ToString();//用户名
            DBUtility.ClsPub.CurUserName = msg4;
            string UserName = "";
            string s = "";
            ListModels oListModels = new ListModels();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsKf_OtherOutBill oBill = new DAL.ClsKf_OtherOutBill();
                List<Model.ClsKf_OtherOutBillMain> lsmain = new List<Model.ClsKf_OtherOutBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Kf_OtherOutBillMain(msg2);
                foreach (Model.ClsKf_OtherOutBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (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;
                        }
                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = s + ",不允许修改";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    oItem.HMaker = msg4;
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "1206";
                    oItem.HBillSubType = "1206";
                    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;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsKf_OtherOutBillSub> ls = new List<Model.ClsKf_OtherOutBillSub>();
                ls = oListModels.getObjectByJson_Kf_OtherOutBillSub(msg3);
                int i = 0;
                oBill.DetailColl.Clear();
                foreach (Model.ClsKf_OtherOutBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HCloseType = false;   //关闭类型
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (refSav == "Add")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (refSav == "Update")
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = false;
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶ä»–出库单 ç¼–辑页面初始化
        [Route("Kf_OtherOutBill/Kf_OtherOutBillEdit")]
        [HttpGet]
        public object Kf_OtherOutBillEdit(long HInterID)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                ds = oCN.RunProcReturn("exec h_p_Kf_OtherOutBill_Edit  " + HInterID, "h_p_Kf_OtherOutBill_Edit");
                tableList.Add(ds.Tables[0]);
                tableList.Add(ds.Tables[1]);
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = tableList;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  å…¶ä»–出库单列表
        /// <summary>
        /// å…¶ä»–出库单列表
        /// </summary>
@@ -1209,6 +2139,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region å…¶ä»–出库单  åˆ é™¤
        [Route("Kf_OtherOutBill/DelteteGetOtherOutBill")]
@@ -1217,6 +2148,9 @@
        {
            try
            {
                string s = "";
                DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill();
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Drop", 1, false, user))
                {
@@ -1227,9 +2161,76 @@
                    return objJsonResult;
                }
                if (oBill.ShowBill(long.Parse(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;
                }
                //删除前控制=========================================
                string sql1 = "exec h_p_Kf_OtherOutBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                //删除后控制==================================================================================
                string sql2 = "exec h_p_Kf_OtherOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_Kf_ICStockBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    s = "删除后判断失败,请与网络管理人员联系";
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                //==============================================================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -1256,6 +2257,10 @@
        {
            try
            {
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                DAL.ClsKf_OtherOutBill oBill = new DAL.ClsKf_OtherOutBill() ;
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Check", 1, false, user))
                {
@@ -1271,6 +2276,35 @@
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -1297,8 +2331,35 @@
                            return objJsonResult;
                        }
                    }
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Kf_OtherOutBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_OtherOutBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -1324,8 +2385,31 @@
                            return objJsonResult;
                        }
                    }
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Kf_OtherOutBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //===========================================================
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_OtherOutBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
@@ -1474,7 +2558,137 @@
        }
        #endregion
        #region å…¶å®ƒå‡ºåº“单 ä½œåºŸ/反作废功能
        [Route("Kf_OtherInBill/DropKf_ICStockBill")]
        [HttpGet]
        public object DropKf_ICStockBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_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 = "Kf_ICStockBillMain";
                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
        #endregion
@@ -2375,7 +3589,7 @@
               
                    //审核单据
                    if (!BillOld.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -2427,7 +3641,7 @@
                    //反审核单据
                    if (BillOld.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs
@@ -590,7 +590,45 @@
        #endregion
        //---------------------------------------------------------------PDA模块调用
        #region å‡ºé—¨ç¡®è®¤å•列表
        /// <summary>
        /// èŽ·å–å‡ºé—¨ç¡®è®¤å•åˆ—è¡¨ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBillList_PDA_Json")]
        [HttpGet]
        public object GetXs_OutDoorCheckBillList_PDA_Json(string sWhere)
        {
            try
            {
                //返回列表信息
                ds = oCn.RunProcReturn("exec h_p_Xs_OutDoorCheckBillList_PDA '" + sWhere + "'", "h_p_Xs_OutDoorCheckBillList_PDA");
                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
    }
}
WebAPI/Controllers/XSGL/YF_PayMentOtherBillController.cs
File was deleted
WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -105,8 +105,8 @@
                    //反写产量汇报单,质量汇报单关联字段,生产订单关联数量
                    Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," +
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" +
                        "Edit" + "'," + HBackQty
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" +
                        "Edit" + "'," + HBackQty + "," + DetailColl[0].HICMOTempID
                        , "h_p_Sc_ICMOReportBill_ReverseWriteQty");
                    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1")
                    {
@@ -262,7 +262,7 @@
                    //反写产量汇报单,质量汇报单关联字段,生产订单关联数量
                    ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," +
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" +
                        "Add" + "'," + 0+","+ DetailColl[0].HICMOTempID
                        "Add" + "'," + 0 + "," + DetailColl[0].HICMOTempID
                        , "h_p_Sc_ICMOReportBill_ReverseWriteQty");
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
                    {
WebAPI/ListModels.cs
@@ -676,6 +676,56 @@
        }
        /// <summary>
        /// å¤„理新增直接调拨单主表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsKf_MoveStockBillMain> getObjectByJson_Kf_MoveStockBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsKf_MoveStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_MoveStockBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增直接调拨单子表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsKf_MoveStockBillSub> getObjectByJson_Kf_MoveStockBillSub(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsKf_MoveStockBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_MoveStockBillSub>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增其他出库单主表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsKf_OtherOutBillMain> getObjectByJson_Kf_OtherOutBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsKf_OtherOutBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_OtherOutBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增其它出库单子表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsKf_OtherOutBillSub> getObjectByJson_Kf_OtherOutBillSub(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsKf_OtherOutBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_OtherOutBillSub>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增模具故障登记单主表的json
        /// </summary>
        /// <param name="jsonString"></param>
@@ -3151,6 +3201,31 @@
            return list;
        }
        /// <summary>
        /// å›ºå®šèµ„产卡片 ä¸»è¡¨
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        // ClsGy_FixCardBillMain
        public List<Model.ClsGy_FixCardBillMain> getObjectByJson_Gy_FixCardBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_FixCardBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å›ºå®šèµ„产卡片 å­è¡¨
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        // ClsGy_FixCardBillSub_Emp
        public List<Model.ClsGy_FixCardBillSub_Emp> getObjectByJson_Gy_FixCardBillSub_Emp(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_FixCardBillSub_Emp> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillSub_Emp>>(jsonString);
            return list;
        }
        #region å®¢è¯‰å¤„理单
        /// <summary>
        /// å®¢è¯‰å¤„理单主表json
WebAPI/Models/ClsKf_ICStockBillMain.cs
@@ -47,13 +47,17 @@
        public Int64 HPURCHASEORGID;    //            int                --采购组织
        public Int64 HPAYORGID;         //            int                --付款结算组织
        public string HOWNERTYPEID;     //            varchar(100)    --货主类型
        public Int64 HOrgID;
        public string HStockStyle;      //            varchar(100)    --库存类型
                                        //源单信息
        public string HSourceBillNo;
        public string HSourceBillType;
        public Int64 HSourceInterID;
        public Int64 HSourceEntryID;
        public string HChecker;
        public string HCheckDate;
        public string HMaker;
        public string HMakeDate;
        public long HPSStyleID { get; internal set; }
    }
WebAPI/Models/ClsKf_ICStockBillSub.cs
@@ -5,7 +5,9 @@
namespace WebAPI.Models
{
    public class ClsKf_ICStockBillSub:DBUtility.ClsXt_BaseBillSub
    {
    {
        public Int64 HInterID;
        public Int64 HEntryID;
        public Int64 HMaterID;              //        int                --物料ID
        public Int64 HPropertyID;           //        int                --辅助属性
        public Int64 HSecUnitID;            //        int                --辅助计量单位
@@ -66,9 +68,13 @@
        public string HRECEIVEOWNERTYPEID;  //        varchar(100)    --收料货主类型
        public Single HTaxRate;             //        money           --税率
        public Int64 HSTOCKORGID;           //        int             --库存组织
        public string HSourceBillNo;
        public string HSourceBillType;
        public string HBatchNO;
        public Int64 HSourceInterID;
        public Int64 HSourceEntryID;
        public Int64 HAuxPropID;
        public int HAuxPropID { get; internal set; }
        public string HBatchNO { get; internal set; }
        public object HContainerNum { get; internal set; }
        public object HPVC { get; internal set; }
        public object HViscosity { get; internal set; }
WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -9,7 +9,7 @@
  </PropertyGroup>
  <ItemGroup>
    <File Include="apiapp.json">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="bin/Antlr3.Runtime.dll">
      <publishTime>02/22/2013 16:43:40</publishTime>
@@ -81,7 +81,7 @@
      <publishTime>08/25/2021 10:28:25</publishTime>
    </File>
    <File Include="bin/Kingdee.BOS.WebApi.Client.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="bin/Kingdee.BOS.WebApi.FormService.dll">
      <publishTime>09/20/2018 19:23:20</publishTime>
@@ -115,7 +115,7 @@
      <publishTime>03/15/2024 14:00:30</publishTime>
    </File>
    <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="bin/Newtonsoft.Json.dll">
      <publishTime>08/04/2014 04:33:56</publishTime>
@@ -251,7 +251,7 @@
      <publishTime>11/28/2018 21:01:00</publishTime>
    </File>
    <File Include="bin/System.Web.Http.WebHost.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="bin/System.Web.Mvc.dll">
      <publishTime>01/28/2015 12:02:18</publishTime>
@@ -306,58 +306,58 @@
      <publishTime>11/29/2018 21:26:30</publishTime>
    </File>
    <File Include="Config/kdapi.config">
      <publishTime>04/06/2023 15:57:01</publishTime>
      <publishTime>12/08/2023 09:50:18</publishTime>
    </File>
    <File Include="Content/bootstrap.css">
      <publishTime>04/06/2023 15:57:01</publishTime>
      <publishTime>12/08/2023 09:50:18</publishTime>
    </File>
    <File Include="Content/bootstrap.min.css">
      <publishTime>04/06/2023 15:57:01</publishTime>
      <publishTime>12/08/2023 09:50:18</publishTime>
    </File>
    <File Include="Content/Site.css">
      <publishTime>04/06/2023 15:57:01</publishTime>
      <publishTime>12/08/2023 09:50:18</publishTime>
    </File>
    <File Include="DLL/BLL.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/DAL.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/DBUtility.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/Kingdee.BOS.WebApi.Client.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/Model.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/Newtonsoft.Json.Net35.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/Pub_Class.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/Pub_Control.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="DLL/SQLHelper.dll">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="fonts/glyphicons-halflings-regular.eot">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="fonts/glyphicons-halflings-regular.svg">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="fonts/glyphicons-halflings-regular.ttf">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="fonts/glyphicons-halflings-regular.woff">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Global.asax">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="grpc_csharp_ext.x64.dll">
      <publishTime>03/22/2022 13:17:22</publishTime>
@@ -366,7 +366,7 @@
      <publishTime>03/22/2022 13:17:22</publishTime>
    </File>
    <File Include="Index.html">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="libgrpc_csharp_ext.x64.dylib">
      <publishTime>03/19/2022 07:38:44</publishTime>
@@ -375,121 +375,121 @@
      <publishTime>03/19/2022 07:38:42</publishTime>
    </File>
    <File Include="libman.json">
      <publishTime>07/12/2023 08:14:21</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Metadata/deploymentTemplates/apiappconfig.azureresource.json">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="packages.config">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/bootstrap.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/bootstrap.min.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery-1.10.2.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery-1.10.2.min.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery-1.10.2.min.map">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery.validate.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery.validate.min.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery.validate.unobtrusive.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/jquery.validate.unobtrusive.min.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Scripts/modernizr-2.6.2.js">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Shared/Error.cshtml">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/Shared/_Layout.cshtml">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/web.config">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Views/_ViewStart.cshtml">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_Customer_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_Department_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_Employee_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_StockPlace_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_Supplier_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsCLD_Warehouse_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_BadReason_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model_View.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Customer_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Department_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Employee_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Group_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Item30JiTai_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Source_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_StockPlace_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Supplier_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsGy_Warehouse_Model.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsKf_ICStockBill_Mould.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/ClsKf_ICStockBill_WMS.datasource">
      <publishTime>04/06/2023 15:57:02</publishTime>
      <publishTime>12/08/2023 09:50:19</publishTime>
    </File>
    <File Include="Web References/WebS/Reference.cs">
      <publishTime>12/20/2021 13:19:56</publishTime>
    </File>
    <File Include="Web References/WebS/Reference.map">
      <publishTime>02/25/2024 21:39:05</publishTime>
      <publishTime>02/28/2024 14:32:47</publishTime>
    </File>
    <File Include="Web References/WebS/WebService1.disco">
      <publishTime>12/20/2021 13:19:56</publishTime>
WebAPI/Web.config
@@ -22,7 +22,7 @@
        <!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>-->
        <!--<add key="FileIP" value="http://localhost:8080/" />-->
        <!--<add key="sUrl" value="http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"/>    -->
        <add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/> <!--颜台式机-->
        <!--<add key="sUrl" value="http://192.168.63.20/WEBS-WMS/WebService1.asmx"/>   é¢œå°å¼æœº-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> å¤å®-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> -->
        <!--<add key="sUrl" value="http://10.10.130.181/WEBS-WMS/WebService1.asmx"/>    åšæ—¥ç§‘技-->
@@ -34,9 +34,9 @@
        <!--<add key="sUrl" value="http://192.168.80.90:9090/WEBS-WMS/WebService1.asmx"/>     å®‰ç‘žæœåС噍-->
        <!--<add key="sUrl" value="http://47.96.97.237/WEBS-WMS/WebService1.asmx"/> -->    <!--测试服务器-->
        <!--<add key="sUrl" value="http://localhost:8082/WEBS/WebService1.asmx"/>    æœ¬åœ°-->
        <!--<add key="sUrl" value="http://192.168.56.1:81/web/WebService1.asmx"/>-->     <!--陈雯静本地配置-->
        <!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>--> <!--九菱-->
        <!--<add key="sUrl" value="http://192.168.60.12/WEBS-WMS/WebService1.asmx"/>--> <!--中控-->
        <add key="sUrl" value="http://192.168.110.57:81/WEBS/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" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
WebAPI/WebAPI.csproj
@@ -415,7 +415,9 @@
    <Compile Include="Controllers\MJGL\Sc_MouldLifeUseBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldScrapRequestBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldStatusChangeBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldUpperBillController.cs" />
    <Compile Include="Controllers\Pay_ReportController.cs" />
    <Compile Include="Controllers\SBGL\Gy_FixCardBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipConkBookBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" />
@@ -1079,6 +1081,7 @@
    <Folder Include="Views\Sc_MouldRepairSendWorkBill\" />
    <Folder Include="Views\Sc_MouldScrapRequestBill\" />
    <Folder Include="Views\Sc_MouldStatusChangeBill\" />
    <Folder Include="Views\Sc_MouldUpperBill\" />
    <Folder Include="Views\Sc_ProcessExchangeIssueBill\" />
    <Folder Include="Views\Sc_ProcessSendWork\" />
    <Folder Include="Views\Sc_ProcExchRecordBackBill\" />
@@ -1158,6 +1161,8 @@
    <PlatformTarget>x86</PlatformTarget>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
    <RunCodeAnalysis>true</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <PlatformTarget>x86</PlatformTarget>
WebAPI/WebAPI.csproj.user
@@ -9,7 +9,7 @@
    <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
    <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
    <NameOfLastUsedPublishProfile>D:\Git\houduan\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
    <NameOfLastUsedPublishProfile>D:\网站发布\后端代码\MES-WEB-API\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
    <NameOfLastUsedPublishProfile>D:\MES-WEB\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
    <UseIISExpress>false</UseIISExpress>
    <Use64BitIISExpress />