wtt
2026-04-15 959e56df41816bb4d3f28090500c8226d78d7286
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
5个文件已修改
1个文件已添加
467 ■■■■■ 已修改文件
WarM/条码打印/Gy_CusBarCodeBill_KaiBei_HuaSan.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_UnitController.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Cb_OtherOutBill_CostSubjectDetailController.cs 359 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/ÌõÂë´òÓ¡/Gy_CusBarCodeBill_KaiBei_HuaSan.cs
@@ -674,20 +674,28 @@
                {
                    if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0)
                    {
                        HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);            // å®¢æˆ·æ–™å·
                        HMaterModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterModelCol].Value);      //物料规格型号
                        HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value);    // ç‰©æ–™ä»£ç 
                        HCode3 = HMaterNumber.Substring(HMaterNumber.Length - 2, 2);  //版本  å–物料代码后两位
                        HCustom3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom3Col].Value);                      // ç•Œé¢ä¸Šè¾“å…¥   MPN
                        //界面上MPN值输入为/的,版本取物料代码后两位,不为/的则为改制,取00
                        if (HCustom3!="/")
                        {
                            HCode3 = "00";
                        }
                        if (cmbHCusName.Text.Contains("紫光华智"))
                        {
                            //条码前缀 = ç‰©æ–™è§„格型号+供应商代码(固定'151003')+年月日(YYMMDD)
                            sTMNumber = HMaterModel + "151003" + sYear + sPeriod2 + sDay;
                            sTMNumber = HCusModelName + "151003" + sYear + sPeriod2 + sDay;
                        }
                        //新华三、东方通信、统合
                        else
                        {
                            //条码前缀 = ç‰©æ–™è§„格型号+供应商代码(固定'151091')+年月日(YYMMDD)
                            sTMNumber = HMaterModel + "151091" + sYear + sPeriod2 + sDay;
                            sTMNumber = HCusModelName + "151091" + sYear + sPeriod2 + sDay;
                        }
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
@@ -742,7 +750,6 @@
                            HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
                            HQty = HMinQty;
                            HCusID = ClsPub.isLong(cmbHCusName.SelectedValue);
                            HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
                            HCusModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value);
                            HGiveAwayFlag = ClsPub.isBool(grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value);
                            HISKFPERIOD = ClsPub.isBool(grdMain.Rows[j].Cells[HISKFPERIODCol].Value);
@@ -762,7 +769,6 @@
                            sHBaNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBaNoCol].Value);                        // ç•Œé¢ä¸Šè¾“入的批次位
                            HCustom1 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom1Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            HCustom2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom2Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            HCustom3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom3Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            //版本号HCode3、产品代码HCustom1、料号HCustom2、MPNHCustom3、销售订单号HInnerBillNo、规格型号HSupNumber
                            oCn.RunProc("insert into Gy_BarCodeBill_Cus" +
@@ -806,28 +812,36 @@
                {
                    if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0)
                    {
                        HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);            // å®¢æˆ·æ–™å·
                        HMaterModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterModelCol].Value);      //物料规格型号
                        HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value);    // ç‰©æ–™ä»£ç 
                        HCode3 = HMaterNumber.Substring(HMaterNumber.Length - 2, 2);                    //版本  å–物料代码后两位
                        HInnerBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HInnerBillNoCol].Value);  //销售订单号
                        HCustom3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom3Col].Value);          // ç•Œé¢ä¸Šè¾“å…¥   MPN
                        //界面上MPN值输入为/的,版本取物料代码后两位,不为/的则为改制,取0
                        if (HCustom3 != "/")
                        {
                            HCode3 = "0";
                        }
                        //获取最大流水号
                        if (cmbHCusName.Text.Contains("东方通信"))
                        {
                            //条码前缀 = 2位固定码('09') + CPN客户编码(规格型号)+ 2位预留码(固定'01')+ 5位年年月日日(YYMDD) + 3位09码流水号(固定'001') + ä¾›åº”商代码(固定'105652')
                            sWTMNumber = "09" + HMaterModel + "01" + sYear + sPeriod + sDay + "001105652";
                            sWTMNumber = "09" + HCusModelName + "01" + sYear + sPeriod + sDay + "001105652";
                        }
                        //紫光华智
                        else if (cmbHCusName.Text.Contains("紫光华智"))
                        {
                            //条码前缀 = 2位固定码('09') + CPN客户编码(规格型号)+ 2位预留码(固定'01')+ 5位年年月日日(YYMDD) + 3位09码流水号(固定'001') + ä¾›åº”商代码(固定'151003')
                            sWTMNumber = "09" + HMaterModel + "01" + sYear + sPeriod + sDay + "001151003";
                            sWTMNumber = "09" + HCusModelName + "01" + sYear + sPeriod + sDay + "001151003";
                        }
                        //新华三、统合
                        else
                        {
                            //条码前缀 = 2位固定码('09') + CPN客户编码(规格型号)+ 2位预留码(固定'01')+ 5位年年月日日(YYMDD) + 3位09码流水号(固定'001') + ä¾›åº”商代码(固定'151091')
                            sWTMNumber = "09" + HMaterModel + "01" + sYear + sPeriod + sDay + "001151091";
                            sWTMNumber = "09" + HCusModelName + "01" + sYear + sPeriod + sDay + "001151091";
                        }
                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sWTMNumber + "'", "h_p_WMS_GetMaxNo");    //获取最大流水号
                        LWSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
@@ -882,7 +896,6 @@
                            HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
                            HQty = HWMinQty;
                            HCusID = ClsPub.isLong(cmbHCusName.SelectedValue);
                            HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
                            HCusModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value);
                            HGiveAwayFlag = ClsPub.isBool(grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value);
                            HISKFPERIOD = ClsPub.isBool(grdMain.Rows[j].Cells[HISKFPERIODCol].Value);
@@ -902,7 +915,6 @@
                            sHBaNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBaNoCol].Value);                        // ç•Œé¢ä¸Šè¾“入的批次位
                            HCustom1 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom1Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            HCustom2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom2Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            HCustom3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCustom3Col].Value);                   // ç•Œé¢ä¸Šè¾“å…¥
                            //版本号HCode3、产品代码HCustom1、料号HCustom2、MPNHCustom3、销售订单号HInnerBillNo、规格型号HSupNumber
                            oCn.RunProc("insert into Gy_BarCodeBill_Cus" +
@@ -958,7 +970,7 @@
        private void Display()
        {
            //刷新内箱码列表
            DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (条码类型 in ('新华三内箱码','东方通信内箱码','统合内箱码','紫光华智内箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and æ¡ç ç±»åž‹ in ('新华三内箱码','东方通信内箱码','统合内箱码','紫光华智内箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DSet == null)
            {
@@ -969,7 +981,7 @@
            grdSub.DataSource = DSet.Tables[0].DefaultView;
            //刷新外箱码列表
            DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (条码类型 in ('新华三外箱码','东方通信外箱码','统合外箱码','紫光华智外箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and æ¡ç ç±»åž‹ in ('新华三外箱码','东方通信外箱码','统合外箱码','紫光华智外箱码') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
            //生成首行标题
            if (DWSet == null)
            {
WebAPI/Controllers/BaseSet/Gy_UnitController.cs
@@ -49,11 +49,11 @@
                }
                string sql1 = string.Format(@"select * from h_v_Gy_UnitList where ç»„织名称='" + Organization + "'");
                if (oSystemParameter.omodel.WMS_CampanyName.Contains("四维尔"))
                {
                     sql1 = string.Format(@"select * from h_v_Gy_UnitList where 1=1 ");
                //if (oSystemParameter.omodel.WMS_CampanyName.Contains("四维尔"))
                //{
                //     sql1 = string.Format(@"select * from h_v_Gy_UnitList where 1=1 ");
                }
                //}
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(sql1 + sWhere + "order by è®¡é‡å•位代码 ", "h_v_Gy_UnitList");
WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -4007,7 +4007,7 @@
        #region è§£é™¤åŒ…装关系、拆除物料(1:解除包装关系;2.拆除物料)
        [Route("Cj_SingleStation/DelRelation")]
        [HttpGet]
        public object DelRelation(string HBarCodeIDs, Int64 HICMOInterID, Int64 HICMOEntryID, Int64 HProcID, Int64 HType, string user)
        public object DelRelation(string HBarCodeIDs, Int64 HICMOInterID, Int64 HICMOEntryID, Int64 HProcID, Int64 HType, string user, string HUnBindMaterArr)
        {
            try
            {
@@ -4021,7 +4021,7 @@
                }
                else
                {
                    string sql = "exec h_p_Sc_DelbindBarRelation '" + HBarCodeIDs + "'," + HICMOInterID + "," + HICMOEntryID + "," + HProcID + "," + HType;
                    string sql = "exec h_p_Sc_DelbindBarRelation '" + HBarCodeIDs + "'," + HICMOInterID + "," + HICMOEntryID + "," + HProcID + "," + HType + ",'" + HUnBindMaterArr + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_DelbindBarRelation");
                }
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -2846,5 +2846,65 @@
        }
        #endregion
        #region  æ¯æ—¥è¿è¡ŒçŠ¶æ€åˆ†æžï¼ˆåšå•æƒ…å†µï¼‰
        /// <summary>
        /// è¿”回设备点检任务
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_ProcessExchangeBill/DailyRunStateList")]
        [HttpGet]
        public object DailyRunStateList(string sWhere, string user)
        {
            try
            {
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string HBeginDate = dic["HBeginDate"].ToString();
                string HEndDate = dic["HEndDate"].ToString();
                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("exec h_p_Cs_ProcDailyRunStateReport  '" + HBeginDate + "','" + HEndDate + "'", "h_p_Cs_ProcDailyRunStateReport");
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
                    //添加列名
                    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;
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无数据";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Cb_OtherOutBill_CostSubjectDetailController.cs
New file
@@ -0,0 +1,359 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.Models;
using WebAPI.Service;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Cb_OtherOutBill_CostSubjectDetailController : ApiController
    {
        // GET: Cb_OtherOutBill_CostSubjectDetail
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        [Route("Cb_OtherOutBill_CostSubjectDetail/list")]
        [HttpGet]
        public object list(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_CostAverageType_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Cb_OtherOutBill_CostSubjectDetail where 1=1 order by æ—¥æœŸ desc ", "h_v_Cb_OtherOutBill_CostSubjectDetail");
                }
                else
                {
                    string sql1 = "select * from h_v_Cb_OtherOutBill_CostSubjectDetail where 1=1 ";
                    string sql = sql1 + sWhere + " order by æ—¥æœŸ desc";
                    ds = oCN.RunProcReturn(sql, "h_v_Cb_OtherOutBill_CostSubjectDetail");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #region æ–‡ä»¶ä¸Šä¼ 
        [Route("Cb_OtherOutBill_CostSubjectDetail/CB_WipProcessTable_Excel")]
        [HttpPost]
        public json CB_WipProcessTable_Excel()
        {
            json res = new json();
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                SCGL.日计划管理.NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                //创建临时表
                DataTable provisional = new DataTable("dt2");
                //添加列名
                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
                {
                    provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
                }
                //provisional.Columns.Add("单据号", typeof(string));
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
                {
                    DataRow row = provisional.NewRow();
                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                    {
                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                    }
                    provisional.Rows.Add(row);
                }
                //判断列
                string error = JudgmentColumns(provisional);
                if (error.Length > 0)
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = $"Excel模板存在错误,{error}\r\n";
                    res.data = null;
                    return res;
                }
                for (int i = 0; i <= provisional.Rows.Count - 1; i++)
                {
                    string HDate = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["日期"].ToString());
                    string HBillNo = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["单据编号"].ToString());
                    string HWareHouse = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["发货仓库"].ToString());
                    string HStockPlace = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["仓位"].ToString());
                    string HUseType = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["领料类型"].ToString());
                    string HUseDepartment = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["领料部门"].ToString());
                    string HCostSubject = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["成本科目"].ToString());
                    string HCostSubjectSon = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["成本科目二级"].ToString());
                    string HSubjectProc = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["科目+工序"].ToString());
                    string HMaterNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["物料编码"].ToString());
                    string HMaterName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["物料名称"].ToString());
                    string HModel = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["规格型号"].ToString());
                    string HUnit = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["单位"].ToString());
                    string HQty = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["实发数量"].ToString());
                    string HCostPrice = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["成本价"].ToString());
                    string HTotalPrice = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["总成本"].ToString());
                    string HLOT = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["批号"].ToString());
                    string HRemark2 = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
                    string HUsePerson = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["领料人"].ToString());
                    string HWareHousePerson = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["仓管员"].ToString());
                    string HAssetName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["资产名称"].ToString());
                    string HAssetNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["资产编号"].ToString());
                    string HSearchProject = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["研发项目"].ToString());
                    string HVerify = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["核对"].ToString());
                    //string remark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
                    //获取真实行数
                    int line = i + 1;
                }
                res.code = "1";
                res.count = 1;
                res.Message = error;
                res.data = provisional;
                return res;
            }
            catch (Exception e)
            {
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        /// <summary>
        /// åˆ¤æ–­åˆ—
        /// </summary>
        /// <param name="provisional"></param>
        /// <returns></returns>
        private static string JudgmentColumns(DataTable provisional)
        {
            var error = "";
            ////查询没有的列
            //if (!provisional.Columns.Contains("客户"))
            //    error += "没有找到【客户】的标题,";
            //if (!provisional.Columns.Contains("成品料号"))
            //    error += "没有找到【成品料号】的标题,";
            return error;
        }
        #endregion
        #region ä¸Šä¼ ä¿å­˜
        [Route("Cb_OtherOutBill_CostSubjectDetail/Excel_btnSave")]
        [HttpPost]
        public object Excel_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();
            string organ = sArray[2].ToString();
            json res = new json();
            try
            {
                oCN.BeginTran();
                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
                foreach (JObject item in Excel)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (var itm in item.Properties())
                    {
                        dic.Add(itm.Name, itm.Value.ToString());
                    }
                    list.Add(dic);
                }
                // 4. æŸ¥è¯¢ç”¨æˆ·ä¿¡æ¯
                DataSet emp = oCN.RunProcReturn($"SELECT Czybm FROM Gy_Czygl WHERE Czymc = '{user.Replace("'", "''")}'", "Gy_Czygl");
                if (emp.Tables[0].Rows.Count == 0)
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = "用户不存在!";
                    res.data = null;
                    return res;
                }
                string HUserID = emp.Tables[0].Rows[0]["Czybm"].ToString();
                StringBuilder errorMessage = new StringBuilder();
                StringBuilder insertSql = new StringBuilder();
                StringBuilder updateSql = new StringBuilder();
                string currentDate = DateTime.Today.ToString("yyyy-MM-dd");
                int HEntryID = 1;
                // éåŽ†æ•°æ®å¹¶éªŒè¯
                for (int i = 0; i < list.Count; i++)
                {
                    var item = list[i];
                    List<string> intFields = new List<string>
                    {
                    };
                    bool hasError = false;
                    foreach (var field in intFields)
                    {
                        if (item.ContainsKey(field))
                        {
                            string value = item[field];
                            // æ£€æŸ¥æ˜¯å¦ä¸ºæ•´æ•°
                            if (!string.IsNullOrWhiteSpace(value))
                            {
                                if (!int.TryParse(value, out _))
                                {
                                    errorMessage.AppendLine($"第{i + 1}行数据错误:字段 '{field}' çš„值 '{value}' ä¸æ˜¯æœ‰æ•ˆçš„æ•´æ•°");
                                    hasError = true;
                                }
                            }
                        }
                    }
                    // å¦‚果有错误,跳过插入
                    if (hasError)
                    {
                        continue;
                    }
                    insertSql.AppendLine($"INSERT INTO [Cb_OtherOutBill_CostSubjectDetail] ([HYear], [HPeriod], [HBillType], [HBillSubType], [HDate], [HBillNo], [HBillStatus], [HCheckItemNowID], [HCheckItemNextID], [HCheckFlowID], [HRemark], [HBacker], [HBackDate], [HChecker], [HCheckDate], [HMaker], [HMakeDate], [HUpDater], [HUpDateDate], [HCloseMan], [HCloseDate], [HCloseType], [HDeleteMan], [HDeleteDate], [HWareHouse], [HStockPlace], [HUseType], [HUseDepartment], [HCostSubject], [HCostSubjectSon], [HSubjectProc], [HMaterNumber], [HMaterName], [HModel], [HUnit], [HQty], [HCostPrice], [HTotalPrice], [HLOT], [HRemark2], [HUsePerson], [HWareHousePerson], [HAssetName], [HAssetNumber], [HSearchProject], [HVerify])  VALUES (");
                    insertSql.AppendLine($" {item["年份"]}, {item["月份"]}, {1}, '{1}', '{item["日期"]}',  '{item["单据编号"]}', '{1}', '{1}', '{1}', '{1}', '{item["备注"]}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{""}', '{DateTime.Now}', '{"0"}', '{""}', '{DateTime.Now}', '{item["发货仓库"]}', '{item["仓位"]}', '{item["领料类型"]}', '{item["领料部门"]}', '{item["成本科目"]}', '{item["成本科目二级"]}', '{item["科目+工序"]}', '{item["物料编码"]}', '{item["物料名称"]}', '{item["规格型号"]}', '{item["单位"]}', '{item["实发数量"]}', '{item["成本价"]}', '{item["总成本"]}', '{item["批号"]}', '{"excel导入"}', '{item["领料人"]}', '{item["仓管员"]}', '{item["资产名称"]}', '{item["资产编号"]}', '{item["研发项目"]}', '{item["核对"]}');");
                }
                if (errorMessage.Length > 0)
                {
                    //oCN.Rollback();
                    res.code = "0";
                    res.count = 0;
                    res.Message = "数据验证失败:\n" + errorMessage.ToString();
                    res.data = null;
                    return res;
                }
                if (insertSql.Length == 0)
                {
                    // oCN.Rollback();
                    res.code = "0";
                    res.count = 0;
                    res.Message = "没有有效的整数数据可以导入";
                    res.data = null;
                    return res;
                }
                // æ‰§è¡Œæ‰¹é‡æ“ä½œ
                if (insertSql.Length > 0)
                {
                    oCN.RunProc(insertSql.ToString());
                }
                //if (updateSql.Length > 0)
                //{
                //    oCN.RunProc(updateSql.ToString());
                //    oCN.RunProc(updateSql_sub.ToString());
                //}
                oCN.Commit();
                res.code = "1";
                res.count = 1;
                res.Message = "导入成功!";
                res.data = null;
                return res;
            }
            catch (Exception e)
            {
                //oCN.Rollback();
                LogService.Write(e);
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
    }
}
WebAPI/WebAPI.csproj
@@ -685,6 +685,7 @@
    <Compile Include="Controllers\品质管理\车间自检单\QC_WorkSelfCheckBillController.cs" />
    <Compile Include="Controllers\华远datamapping\Gy_BarCodeBill_PNL_TempController.cs" />
    <Compile Include="Controllers\华远datamapping\Gy_BarCodeBill_Set_TempController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Cb_OtherOutBill_CostSubjectDetailController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_AssistantDataEntryController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_BilloriginController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_CostAverageTypeController.cs" />
@@ -1321,6 +1322,7 @@
    <Folder Include="Controllers\项目管理\基础建模\" />
    <Folder Include="DLL\SBGL\SBBB\" />
    <Folder Include="obj\x86\Debug\" />
    <Folder Include="Views\Cb_OtherOutBill_CostSubjectDetail\" />
    <Folder Include="Views\CB_WipProcessTable\" />
    <Folder Include="Views\Cg_ContractTransportBillList\" />
    <Folder Include="Views\Cg_PODemandPlanBill\" />