From d6070f8204ca454aabebd5b5c34bb2dd54dea3be Mon Sep 17 00:00:00 2001
From: cnf <3283105747@qq.com>
Date: 星期二, 09 十二月 2025 10:34:20 +0800
Subject: [PATCH] 增加报工接口

---
 WebApi/Gs.Wom/BaoGong/BaoGongController.cs |  260 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 260 insertions(+), 0 deletions(-)

diff --git a/WebApi/Gs.Wom/BaoGong/BaoGongController.cs b/WebApi/Gs.Wom/BaoGong/BaoGongController.cs
new file mode 100644
index 0000000..491e995
--- /dev/null
+++ b/WebApi/Gs.Wom/BaoGong/BaoGongController.cs
@@ -0,0 +1,260 @@
+锘縰sing Gs.Toolbox;
+using Gs.Toolbox.ApiCore.Abstract.Mvc;
+using Gs.Toolbox.ApiCore.Common.Mvc;
+using Gs.Toolbox.ApiCore.Group;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System.Data;
+using System.Data.SqlClient;
+using System.Dynamic;
+using static Gs.Toolbox.UtilityHelper;
+
+namespace Gs.Wom.BaoGong
+{
+
+    /// <summary>
+    /// 鎶ュ伐
+    /// </summary>
+    [ApiGroup(ApiGroupNames.WOM)]
+    public class BaoGongController : IRomteService
+    {
+        private readonly IHttpContextAccessor _http;
+        private readonly string _userCode, _userGuid, _orgFids;
+        public BaoGongController(IHttpContextAccessor httpContextAccessor)
+        {
+            _http = httpContextAccessor;
+            (_userCode, _userGuid, _orgFids) =
+                GetUserGuidAndOrgGuid(_http);
+        }
+
+        /// <summary>
+        /// 璇诲彇浜х嚎鍒楄〃
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<List<dynamic>> GetLineList([FromBody] dynamic model)
+        {
+            string inCjId = model.inCjId;
+            var lst = new List<dynamic>();
+            var dset = new DataSet();
+            SqlParameter[] parameters =
+            {
+                new("@inCjId", inCjId),
+             };
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("bg_line_list", parameters, "0");
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            string strMsg = "";
+            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
+            {
+                lst = dset.Tables[0].TableToDynamicList();
+                strMsg = dset.Tables[1].Rows[0]["dptName"].ToString();
+            }
+            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
+                strMsg);
+        }
+
+        /// <summary>
+        /// 璇诲彇宸ュ崟鍒楄〃
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<List<dynamic>> GetDaaList([FromBody] dynamic model)
+        {
+            string inLineId = model.inLineId;
+            var lst = new List<dynamic>();
+            var dset = new DataSet();
+            SqlParameter[] parameters =
+            {
+                new("@inLineId", inLineId),
+             };
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("bg_daa_list", parameters, "0");
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
+                lst = dset.Tables[0].TableToDynamicList();
+            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
+                "璇诲彇鎴愬姛锛�");
+        }
+
+
+        /// <summary>
+        /// 璇诲彇鍛樺伐鍒楄〃
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<List<dynamic>> GetYgList([FromBody] dynamic model)
+        {
+            string inCjId = model.inCjId;
+            var lst = new List<dynamic>();
+            var dset = new DataSet();
+            SqlParameter[] parameters =
+            {
+                new("@inCjId", inCjId),
+             };
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("bg_yg_list", parameters, "0");
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)
+                lst = dset.Tables[0].TableToDynamicList();
+            return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
+                "璇诲彇鎴愬姛锛�");
+        }
+
+
+        /// <summary>
+        ///     璇诲彇宸ュ崟淇℃伅
+        /// </summary>
+        /// <param name="guid"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model)
+        {
+            string inDaaGuid = model.inDaaGuid.ToString();
+            dynamic m = new ExpandoObject();
+            m.list = new List<dynamic>();
+            SqlParameter[] parameters =
+            {
+            new("@inDaaGuid", inDaaGuid),
+            new("@inUserGuid", _userGuid)
+        };
+            var dset = new DataSet();
+            try
+            {
+                dset = DbHelperSQL.RunProcedure("bg_daa_info", parameters,
+                    "0");
+                if (dset != null && dset.Tables.Count > 0 &&
+                    dset.Tables[0].Rows.Count > 0)
+                {
+                    var dr = dset.Tables[0].Rows[0];
+                    m = dr.RowToDynamic();
+                    var _tb = dset.Tables[1].TableToDynamicList();
+                    m.list = _tb;
+                }
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            if (m != null)
+                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
+                    "璇诲彇鎴愬姛锛�");
+            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
+        }
+
+        /// <summary>
+        ///   鎵撶爜鎶ュ伐锛屽厛璋冪敤 rpt_daa锛屽啀璋冪敤 prc_pda_scbg
+        /// </summary>
+        /// <param name="guid"></param>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<ExpandoObject> DaaDmbg([FromBody] dynamic model)
+        {
+            string _inEdtUserGuid = _userGuid;
+            string _inOrderGuid = model.inDaaGuid.ToString();
+            string _isDesign = "0";//100閲嶆墦,1鏄璁�
+            string _in4 = "1";//鎵╁睍鐢紝寮犳暟(鎵撳嵃寮犳暟)
+            string _in5 = model.bzsl.ToString();//鎵╁睍鐢紝鏁伴噺锛堝唴鍖呰鏁伴噺锛�
+            dynamic m = new ExpandoObject();
+            m.outSum = -1;
+            m.outMsg = "";
+            SqlParameter[] parameters =
+            {
+            new("@inOrderGuid", _inOrderGuid),
+            new("@isDesign", _isDesign),
+            new("@in1", ""),
+            new("@in2", ""),
+            new("@in3", 0),
+            new("@in4", _in4),
+            new("@in5", _in5),
+            new("@in6", "")
+        };
+            var dset = new DataSet();
+            try
+            {
+                //1鍏堣皟鐢� rpt_daa
+                dset = DbHelperSQL.RunProcedure("rpt_daa", parameters, "0");
+                if (dset != null && dset.Tables.Count > 0 &&
+                    dset.Tables[0].Rows.Count > 0)
+                {
+                    if (dset.Tables.Count != 3)
+                    {
+                        m.outSum = -1;
+                        m.outMsg = dset.Tables[0].Rows[0]["msgTxt"].ToString();
+                        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, m.outMsg);
+                    }
+                    #region 鍐嶈皟鐢� prc_pda_scbg
+                    string pi_barcode = dset.Tables[1].Rows[0]["ITEM_BARCODE"].ToString();
+                    using (var conn = new SqlConnection(DbHelperSQL.strConn))
+                    {
+                        using (var cmd = new SqlCommand("prc_pda_scbg", conn))
+                        {
+                            try
+                            {
+                                conn.Open();
+                                cmd.CommandType = CommandType.StoredProcedure;
+                                SqlParameter[] parameters2 =
+                                  {
+                                    new("@pi_user", _userCode),
+                                    new("@pi_barcode", pi_barcode),
+                                    new("@pi_inp1", ""),
+                                    new("@pi_inp2", ""),
+                                    new("@po_outMsg", SqlDbType.NVarChar, 300),
+                                    new("@po_outSum", SqlDbType.NVarChar, 300),
+                                    new("@po_womInBarSum",SqlDbType.NVarChar, 300),
+                                };
+                                parameters2[4].Direction = ParameterDirection.Output;
+                                parameters2[5].Direction = ParameterDirection.Output;
+                                parameters2[6].Direction = ParameterDirection.Output;
+                                foreach (var parameter in parameters2)
+                                    cmd.Parameters.Add(parameter);
+                                cmd.ExecuteNonQuery();
+                                m.outMsg = parameters2[4].Value.ToString();
+                                m.outSum = int.Parse(parameters2[5].Value.ToString());
+                            }
+                            catch (Exception ex)
+                            {
+                                LogHelper.Debug(ToString(),
+                                    "prc_pda_scbg error锛�" + ex.Message);
+                                m.outMsg = ex.Message;
+                                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
+                                    ex.Message);
+                            }
+                            finally
+                            {
+                                conn.Close();
+                            }
+                        }
+                    }
+                    #endregion
+                }
+                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "鎵撶爜澶辫触锛�");
+            }
+            catch (Exception ex)
+            {
+                m.outSum = -1;
+                m.outMsg = ex.Message.ToString();
+                LogHelper.Debug(ToString(), ex.Message);
+            }
+            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, m.outMsg);
+        }
+    }
+}

--
Gitblit v1.9.3