智云SRM-WEBAPI(目前客户通用API)
王 垚
2022-12-01 fc8498c2b7d6cf56f1f8a2e3c1b740fbf05ac4fd
WebAPI/Controllers/POOrderBillExcelController.cs
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
@@ -29,7 +30,7 @@
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ds1 = oCn.RunProcReturn($"exec h_p_POOrderBill_Excel {ds.Tables[0].Rows[i]["HQty"].ToString()},'{ds.Tables[0].Rows[i]["MaterialNum"].ToString()}'", "POOrderBill_Excel");
                    ds1 = oCn.RunProcReturn($"exec h_p_POOrderBill_Excel {ds.Tables[0].Rows[i]["HQty"].ToString()},'{ds.Tables[0].Rows[i]["MaterialNum"].ToString()}','1'", "POOrderBill_Excel");
                    if (i == 0)
                    {
@@ -46,10 +47,6 @@
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "";
@@ -83,7 +80,7 @@
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "2");
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
@@ -144,7 +141,7 @@
                {
                    for (int j = 0; j < tb2.Columns.Count; j++)
                    {
                        if (tb2.Rows[i][j].ToString() == "")
                        if (tb2.Rows[i][j].ToString() == ""&& tb2.Columns[i].ToString()!= "包装标识")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -261,13 +258,13 @@
                ds = oCn.RunProcReturn("select * from h_v_POOrderBill_Excel " +
                    $"where 采购组织='{dt.Rows[i]["组织"].ToString()}' and 供应商='{dt.Rows[i]["供应商"].ToString()}' " +
                    $"and 包装标识='{dt.Rows[i]["包装标识"].ToString()}'" +
                    $"and 物料编码='{dt.Rows[i]["物料编码"].ToString()}' and 关闭状态='未关闭' and 审核状态='已审核' ", "h_v_POOrderBill_Excel");
                    $"and 物料编码='{dt.Rows[i]["物料编码"].ToString()}' and 关闭状态='未关闭' ", "h_v_POOrderBill_Excel");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    double NumCount = 0;//总数量
                    foreach (DataRow item in ds.Tables[0].Rows)
                    {
                        NumCount += double.Parse(item["剩余收料数量"].ToString());
                        NumCount += double.Parse(item["未关联数量"].ToString());
                    }
                    if (NumCount < double.Parse(dt.Rows[i]["数量"].ToString()))
@@ -283,7 +280,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = $"第{(i + 1)}行,匹配不到物料信息!";
                    objJsonResult.Message = $"第{(i + 1)}行,匹配不到数据信息!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -296,5 +293,7 @@
            return objJsonResult;
        }
        #endregion
    }
}