仓库-物料Excel导入修改
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using NPOI.SS.UserModel;
|
using NPOI.SS.UserModel;
|
||||||
using NPOI.XSSF.UserModel;
|
using NPOI.XSSF.UserModel;
|
||||||
|
using SqlSugar;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using ZR.Admin.WebApi.Extensions;
|
using ZR.Admin.WebApi.Extensions;
|
||||||
@@ -169,7 +170,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var time = DateTime.Now.ToLocalTime();
|
||||||
for (int i = 2; i <= sheet.LastRowNum; i++)
|
for (int i = 2; i <= sheet.LastRowNum; i++)
|
||||||
{
|
{
|
||||||
IRow row = sheet.GetRow(i);
|
IRow row = sheet.GetRow(i);
|
||||||
@@ -177,8 +178,10 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
{
|
{
|
||||||
if (row.GetCell(0) != null && row.GetCell(0).ToString() != "")
|
if (row.GetCell(0) != null && row.GetCell(0).ToString() != "")
|
||||||
{
|
{
|
||||||
WmMaterial material = new WmMaterial();
|
|
||||||
|
|
||||||
|
WmMaterial material = new WmMaterial();
|
||||||
|
// SnowFlakeSingle.Instance.NextId().ToString();
|
||||||
|
material.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||||
material.Partnumber = row.GetCell(0)?.ToString();
|
material.Partnumber = row.GetCell(0)?.ToString();
|
||||||
material.U8InventoryCode = row.GetCell(1)?.ToString();
|
material.U8InventoryCode = row.GetCell(1)?.ToString();
|
||||||
material.BlankNum = row.GetCell(2)?.ToString();
|
material.BlankNum = row.GetCell(2)?.ToString();
|
||||||
@@ -193,7 +196,9 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
material.Search2 = row.GetCell(11)?.ToString();
|
material.Search2 = row.GetCell(11)?.ToString();
|
||||||
material.Status = 1;
|
material.Status = 1;
|
||||||
material.Sort = i;
|
material.Sort = i;
|
||||||
material.ToCreate(HttpContext);
|
material.CreatedBy = "Excel导入";
|
||||||
|
material.CreatedTime = time;
|
||||||
|
//material.ToCreate(HttpContext);
|
||||||
materials.Add(material);
|
materials.Add(material);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ namespace ZR.Service.mes.wms
|
|||||||
return (-1,-1);
|
return (-1,-1);
|
||||||
}
|
}
|
||||||
var x=Context.Storageable(materials)
|
var x=Context.Storageable(materials)
|
||||||
.WhereColumns(it => it.BlankNum).ToStorage();
|
.WhereColumns(it => it.Id)
|
||||||
|
.ToStorage();
|
||||||
|
|
||||||
int insert= x.AsInsertable.ExecuteCommand(); //执行插入
|
int insert= x.AsInsertable.ExecuteCommand(); //执行插入
|
||||||
int update= x.AsUpdateable.ExecuteCommand(); //执行更新
|
int update= x.AsUpdateable.ExecuteCommand(); //执行更新
|
||||||
|
|||||||
Reference in New Issue
Block a user