chenhaozhe
2025-10-20 412008d398f3554755ffd52257e7564b83eebb1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
 
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_OperatorGroupController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        ListModels oListModels = new ListModels();
        DataSet ds;
 
 
        #region 业务组 金蝶云审核同步 API
        [Route("Gy_OperatorGroup/SaveGy_OperatorGroupListApi")]
        [HttpPost]
        public object SaveGy_OperatorGroupListApi([FromBody] JObject sMainSub)
        {
 
            try
            {
                oCN.BeginTran();
                LogService.Write("业务组 审核同步: " + sMainSub.ToString());
 
                var sMain = sMainSub["model"]["FENTRY"].ToString();
                List<Model.ClsGy_OperatorGroup> lsmain = new List<Model.ClsGy_OperatorGroup>();
                lsmain = oListModels.getObjectByJson_Gy_OperatorGroup(sMain);
                var sql = string.Empty;
                foreach(var oMain in lsmain)
                {
                    sql = $@"delete from Gy_OperatorGroup where HItemID = {oMain.HItemID}";
                    oCN.RunProc(sql);
 
                    sql = $@"insert into Gy_OperatorGroup(HItemID
                            ,HNumber ,HName,HShortNumber,HParentID,HLevel,HEndFlag
                            ,HStopflag,HRemark,HHelpCode,HUseFlag,HUSEORGID
                            ,HOperatorGroupId,HOperatorGroupType,HIsUse)
                    values({oMain.HItemID}, '{oMain.HNumber}', '{oMain.HName}', '{oMain.HShortNumber}',
                            {oMain.HParentID}, '{oMain.HLevel}', '{oMain.HEndFlag}', '{oMain.HStopflag}'
                            '{oMain.HRemark}', '{oMain.HHelpCode}' ,'{oMain.HUseFlag}', '{oMain.HUSEORGID}',
                            '{oMain.HOperatorGroupId}','{oMain.HOperatorGroupType}', '{oMain.HIsUse}'
                    )
                    ";
 
                    oCN.RunProc(sql);
                    
                }
 
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
            }
            catch(Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
    }
}