去除引用common.props
This commit is contained in:
@@ -1,37 +1,31 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Models;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.RemoteRequest;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using SqlSugar.Extensions;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.BasicData;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using SQLitePCL;
|
||||
using SqlSugar.Extensions;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -41,7 +35,7 @@ namespace Tnb.ProductionMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService
|
||||
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
@@ -86,7 +80,7 @@ namespace Tnb.ProductionMgr
|
||||
create_time = a.create_time.ToString()
|
||||
}).ToListAsync();
|
||||
var treeList = list.ToTree();
|
||||
treeList= treeList.Skip((input.currentPage-1)* input.pageSize).Take(input.pageSize).ToList();
|
||||
treeList = treeList.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList();
|
||||
SqlSugarPagedList<PrdMoTaskTreeOutput> pagedList = new()
|
||||
{
|
||||
list = treeList,
|
||||
@@ -113,13 +107,13 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
throw Oops.Bah("请先选择工位");
|
||||
}
|
||||
|
||||
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
|
||||
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = input.bill_type,
|
||||
@@ -148,7 +142,7 @@ namespace Tnb.ProductionMgr
|
||||
// code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
// barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
barcode = item.ContainsKey("barcode") ? item["barcode"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "",
|
||||
quantity = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
@@ -186,10 +180,10 @@ namespace Tnb.ProductionMgr
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "",
|
||||
pr_qty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
@@ -198,7 +192,7 @@ namespace Tnb.ProductionMgr
|
||||
// code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
// barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
barcode = item.ContainsKey("barcode") ? item["barcode"] : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "",
|
||||
code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "",
|
||||
codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
@@ -207,7 +201,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
@@ -219,17 +213,17 @@ namespace Tnb.ProductionMgr
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result2.IsSuccess ? "保存成功" : result2.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -277,24 +271,24 @@ namespace Tnb.ProductionMgr
|
||||
if (!string.IsNullOrEmpty(equip_code)) throw Oops.Bah("请传机台号");
|
||||
var db = _repository.AsSugarClient();
|
||||
EqpEquipment equipment = await db.Queryable<EqpEquipment>().Where(x => x.code == equip_code).FirstAsync();
|
||||
if(equipment==null ) throw Oops.Bah("未找到机台");
|
||||
if(string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位");
|
||||
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x=>x.id==equipment.as_location_id);
|
||||
if(basLocation==null) throw Oops.Bah("未找到入库库位");
|
||||
if (equipment == null) throw Oops.Bah("未找到机台");
|
||||
if (string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位");
|
||||
BasLocation basLocation = await db.Queryable<BasLocation>().SingleAsync(x => x.id == equipment.as_location_id);
|
||||
if (basLocation == null) throw Oops.Bah("未找到入库库位");
|
||||
PrdReport prdReport = await db.Queryable<PrdReport>()
|
||||
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
|
||||
.FirstAsync();
|
||||
if(prdReport==null) throw Oops.Bah("未找到提报记录");
|
||||
if (prdReport == null) throw Oops.Bah("未找到提报记录");
|
||||
|
||||
PrdInstockH prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==prdReport.material_id);
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
@@ -319,11 +313,11 @@ namespace Tnb.ProductionMgr
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
code_batch = prdReport.barcode + "0001",
|
||||
quantity = (int)prdReport.reported_qty,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||
@@ -349,14 +343,14 @@ namespace Tnb.ProductionMgr
|
||||
code_batch = prdReport.barcode,
|
||||
pr_qty = (int)prdReport.reported_qty,
|
||||
});
|
||||
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
code_batch = prdReport.barcode + "0001",
|
||||
codeqty = (int)prdReport.reported_qty,
|
||||
});
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
@@ -364,7 +358,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
@@ -376,17 +370,17 @@ namespace Tnb.ProductionMgr
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result2.IsSuccess ? "申请成功" : result2.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -400,12 +394,12 @@ namespace Tnb.ProductionMgr
|
||||
PrdInstockH prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==prdReport.material_id);
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
@@ -430,11 +424,11 @@ namespace Tnb.ProductionMgr
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
code_batch = prdReport.barcode + "0001",
|
||||
quantity = (int)prdReport.reported_qty,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||
@@ -460,14 +454,14 @@ namespace Tnb.ProductionMgr
|
||||
code_batch = prdReport.barcode,
|
||||
pr_qty = (int)prdReport.reported_qty,
|
||||
});
|
||||
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
code_batch = prdReport.barcode + "0001",
|
||||
codeqty = (int)prdReport.reported_qty,
|
||||
});
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
@@ -475,7 +469,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
@@ -487,13 +481,13 @@ namespace Tnb.ProductionMgr
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user