产成品入库
This commit is contained in:
@@ -57,7 +57,7 @@ namespace Tnb.BasicData.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态 0 失败或未发送 1 成功
|
/// 状态 0 失败或未发送 1 成功
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int status { get; set; } = 0;
|
public string status { get; set; } = "0";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送成功时类型 自动 手动
|
/// 发送成功时类型 自动 手动
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Tnb.BasicData
|
|||||||
.SetColumns(x => x.last_send_time == now)
|
.SetColumns(x => x.last_send_time == now)
|
||||||
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
.SetColumns(x => x.send_type == "手动")
|
.SetColumns(x => x.send_type == "手动")
|
||||||
.SetColumns(x => x.status == 1)
|
.SetColumns(x => x.status == "1")
|
||||||
.Where(x=>x.id==record.id)
|
.Where(x=>x.id==record.id)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<string> SendThirdApi(string thirdNmaes)
|
public async Task<string> SendThirdApi(string thirdNmaes)
|
||||||
{
|
{
|
||||||
string[] thirdNameArr = thirdNmaes.Split("-");
|
string[] thirdNameArr = thirdNmaes.Split("-");
|
||||||
List<ThirdWebapiRecord> records = await _db.Queryable<ThirdWebapiRecord>().Where(x => thirdNameArr.Contains(x.third_name) && x.status == 0 && x.is_send == 1).ToListAsync();
|
List<ThirdWebapiRecord> records = await _db.Queryable<ThirdWebapiRecord>().Where(x => thirdNameArr.Contains(x.third_name) && x.status == "0" && x.is_send == 1).ToListAsync();
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
Stopwatch stopwatch = null;
|
Stopwatch stopwatch = null;
|
||||||
string response = "";
|
string response = "";
|
||||||
@@ -755,7 +755,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.SetColumns(x => x.last_send_time == now)
|
.SetColumns(x => x.last_send_time == now)
|
||||||
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
.SetColumns(x => x.response_time == elapsedMilliseconds)
|
||||||
.SetColumns(x => x.send_type == "自动")
|
.SetColumns(x => x.send_type == "自动")
|
||||||
.SetColumns(x => x.status == 1)
|
.SetColumns(x => x.status == "1")
|
||||||
.Where(x=>x.id==record.id)
|
.Where(x=>x.id==record.id)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,19 @@
|
|||||||
/// 物料型号
|
/// 物料型号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? material_standard { get; set; }
|
public string? material_standard { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// pc端的设备名称
|
||||||
|
/// </summary>
|
||||||
|
public string extras { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// pc端的物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowtaskid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// pc端的物料型号
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class CheckTaskOut
|
public class CheckTaskOut
|
||||||
@@ -175,6 +188,25 @@
|
|||||||
public string? checknum { get; set; }
|
public string? checknum { get; set; }
|
||||||
public string? status { get; set; }
|
public string? status { get; set; }
|
||||||
public string? result { get; set; }
|
public string? result { get; set; }
|
||||||
|
public string equip_name { get; set; }
|
||||||
|
public string mo_task_code { get; set; }
|
||||||
|
public string bill_code { get; set; }
|
||||||
|
public int? qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string? material_specification { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料型号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_standard { get; set; }
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
public string? material_name { get; set; }
|
||||||
|
public string? exectime { get; set; }
|
||||||
|
public string? execuser { get; set; }
|
||||||
|
public string batch { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<List<Checktype>>? checktypes { get; set; }
|
public List<List<Checktype>>? checktypes { get; set; }
|
||||||
public CheckCarry carryInfo { get; set; }
|
public CheckCarry carryInfo { get; set; }
|
||||||
|
|||||||
@@ -110,6 +110,9 @@ namespace Tnb.QcMgr
|
|||||||
material_standard = b.material_standard,
|
material_standard = b.material_standard,
|
||||||
material_specification = b.material_specification,
|
material_specification = b.material_specification,
|
||||||
equip_name = h.name,
|
equip_name = h.name,
|
||||||
|
extras = h.name,
|
||||||
|
f_flowid = b.material_standard,
|
||||||
|
f_flowtaskid = b.material_specification,
|
||||||
}).OrderByDescending(a => DateTime.Parse(a.tasktime)).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).OrderByDescending(a => DateTime.Parse(a.tasktime)).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
foreach (QcCheckExecHOut? item in result.list)
|
foreach (QcCheckExecHOut? item in result.list)
|
||||||
{
|
{
|
||||||
@@ -406,14 +409,33 @@ namespace Tnb.QcMgr
|
|||||||
List<QcErrorCause> QcErrorCauses = await db.Queryable<QcErrorCause>().ToListAsync();
|
List<QcErrorCause> QcErrorCauses = await db.Queryable<QcErrorCause>().ToListAsync();
|
||||||
List<QcErrorLevel> QcErrorLevels = await db.Queryable<QcErrorLevel>().ToListAsync();
|
List<QcErrorLevel> QcErrorLevels = await db.Queryable<QcErrorLevel>().ToListAsync();
|
||||||
|
|
||||||
Result Result = new()
|
Result Result = await db.Queryable<QcCheckExecH>().LeftJoin<BasMaterial>((a, b) => a.materialid == b.id)
|
||||||
{
|
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||||
mainid = id,
|
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||||
checknum = QcCheckExecH.checknum!,
|
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||||
status = QcCheckExecH.status!,
|
.LeftJoin<PrdReport>((a, b, c, d, e, f) => a.report_id == f.id)
|
||||||
checktypes = new List<List<Checktype>>(),
|
.LeftJoin<PrdMoTask>((a, b, c, d, e, f, g) => a.mo_task_code == g.mo_task_code)
|
||||||
result = QcCheckExecH.result
|
.LeftJoin<EqpEquipment>((a, b, c, d, e, f, g, h) => g.eqp_id == h.id)
|
||||||
};
|
.Where((a, b, c, d, e) => a.id==id)
|
||||||
|
.Select((a, b, c, d, e, f, g, h) => new Result
|
||||||
|
{
|
||||||
|
mainid = a.id,
|
||||||
|
material_name = b.name,
|
||||||
|
material_code = b.code,
|
||||||
|
material_standard = b.material_standard,
|
||||||
|
material_specification = b.material_specification,
|
||||||
|
checknum = a.checknum,
|
||||||
|
status = a.status,
|
||||||
|
result = a.result,
|
||||||
|
exectime = a.exectime ?? "",
|
||||||
|
execuser = e.RealName ?? "",
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
batch = a.batch,
|
||||||
|
qty = a.qty,
|
||||||
|
equip_name = h.name,
|
||||||
|
checktypes = new List<List<Checktype>>(),
|
||||||
|
}).FirstAsync();
|
||||||
|
Result.checktypes = new List<List<Checktype>>();
|
||||||
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
|
if (!string.IsNullOrEmpty(QcCheckExecH.carry_code))
|
||||||
{
|
{
|
||||||
WmsCarryH carryH = await db.Queryable<WmsCarryH>().FirstAsync(x => x.carry_code == QcCheckExecH.carry_code);
|
WmsCarryH carryH = await db.Queryable<WmsCarryH>().FirstAsync(x => x.carry_code == QcCheckExecH.carry_code);
|
||||||
|
|||||||
@@ -7,13 +7,17 @@ using System.Threading.Tasks;
|
|||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Security;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using JNPF.VisualDev.Entitys;
|
using JNPF.VisualDev.Entitys;
|
||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.Util;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -25,6 +29,7 @@ using Tnb.WarehouseMgr.Entities.Dto;
|
|||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity;
|
using Tnb.WarehouseMgr.Entities.Entity;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -319,8 +324,110 @@ namespace Tnb.WarehouseMgr
|
|||||||
// 如果生产入库 输送线到仓库这条任务完成,反写单据数据
|
// 如果生产入库 输送线到仓库这条任务完成,反写单据数据
|
||||||
if (input.bizTypeId == WmsWareHouseConst.BIZTYPE_WMSPRDINSTOCK_ID)
|
if (input.bizTypeId == WmsWareHouseConst.BIZTYPE_WMSPRDINSTOCK_ID)
|
||||||
{
|
{
|
||||||
isOk = await _db.Updateable<WmsPrdInstockD>().SetColumns(it => new WmsPrdInstockD { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID })
|
isOk = await _db.Updateable<WmsPrdInstockD>()
|
||||||
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
.SetColumns(it => new WmsPrdInstockD { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID })
|
||||||
|
.Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||||
|
|
||||||
|
WmsPrdInstockD wmsPrdInstockD = await _db.Queryable<WmsPrdInstockD>().SingleAsync(x=>x.id==input.requireId);
|
||||||
|
WmsPrdInstockH instock = await _db.Queryable<WmsPrdInstockH>().SingleAsync(x=>x.id==wmsPrdInstockD.prd_instock_id);
|
||||||
|
BasWarehouse scWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.scwarehouse_id);
|
||||||
|
BasWarehouse kcWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.warehouse_id);
|
||||||
|
//todo 产成品入库
|
||||||
|
List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instock_id == instock.id).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
List<String> materialIds = Arrays.AsList(instock.material_id);
|
||||||
|
List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
|
||||||
|
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
|
||||||
|
.Select((x, y) => y)
|
||||||
|
.ToListAsync();
|
||||||
|
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>x.id!=null).ToListAsync();
|
||||||
|
string userId = instock?.create_id ?? WmsWareHouseConst.AdministratorUserId;
|
||||||
|
|
||||||
|
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
|
||||||
|
List<string> tableIds = new List<string>();
|
||||||
|
tableIds.Add(userId);
|
||||||
|
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
|
tableIds.AddRange(materialIds);
|
||||||
|
tableIds.Add(supplierId);
|
||||||
|
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||||
|
|
||||||
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
|
||||||
|
string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
|
||||||
|
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||||
|
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||||
|
erpRequestData.Add("billmaker", erpCreateId);
|
||||||
|
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
||||||
|
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
||||||
|
erpRequestData.Add("cprocalbodyoid", erpOrg.pk_org_v);
|
||||||
|
erpRequestData.Add("cprocalbodyvid", erpOrg.pk_group);
|
||||||
|
erpRequestData.Add("creationtime", nowStr);
|
||||||
|
erpRequestData.Add("creator", erpCreateId);
|
||||||
|
erpRequestData.Add("ctrantypeid", "0001H11000000000D30X");//先写死
|
||||||
|
erpRequestData.Add("cprowarehouseid", erpWarehouserelaHs.Find(x=>x.wms_warehousecode==scWarehouse.whcode)?.erp_warehouseid ?? "");//先写死
|
||||||
|
erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x=>x.wms_warehousecode==kcWarehouse.whcode)?.erp_warehouseid ?? "");//先写死
|
||||||
|
erpRequestData.Add("cwhsmanagerid", null);
|
||||||
|
erpRequestData.Add("dbilldate", nowStr);
|
||||||
|
erpRequestData.Add("dmakedate", nowStr);
|
||||||
|
erpRequestData.Add("fbillflag", 1);
|
||||||
|
erpRequestData.Add("ntotalnum", allInstockDetails.Sum(x=>x.pqty));
|
||||||
|
erpRequestData.Add("pk_org", erpOrg.pk_org);
|
||||||
|
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||||
|
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
||||||
|
erpRequestData.Add("vbillcode", instock.bill_code);
|
||||||
|
erpRequestData.Add("vtrantypecode", "46-01");
|
||||||
|
erpRequestData.Add("csourcebillhid", "");//todo 后面填
|
||||||
|
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
foreach (WmsPrdInstockCode item in allInstockDetails)
|
||||||
|
{
|
||||||
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["cbodytranstypecode"] = "46-01",
|
||||||
|
["cbodywarehouseid"] = erpWarehouserelaHs.Find(x=>x.wms_warehousecode==kcWarehouse.whcode)?.erp_warehouseid ?? "",
|
||||||
|
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
|
||||||
|
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialvid ?? "",
|
||||||
|
["corpoid"] = erpOrg.corpoid,
|
||||||
|
["corpvid"] = erpOrg.corpvid,
|
||||||
|
["cproductid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
|
||||||
|
["fproductclass"] = 1,
|
||||||
|
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
|
||||||
|
["csourcebillhid"] = "",
|
||||||
|
["csourcebillbid"] = "",
|
||||||
|
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
|
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||||
|
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||||
|
["dbizdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
["dplanarrivedate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
["dplanoutdate"] = instock.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
["nnum"] = item.pqty,
|
||||||
|
["nshouldnum"] = item.pqty,
|
||||||
|
["pk_group"] = erpOrg.pk_group,
|
||||||
|
["pk_org"] = erpOrg.pk_org,
|
||||||
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
["vbatchcode"] = item.code_batch,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
erpRequestData.Add("dtls", erpRequestDataDetails);
|
||||||
|
requestData.Add(erpRequestData);
|
||||||
|
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
|
||||||
|
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
||||||
|
thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
||||||
|
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||||
|
thirdWebapiRecord.name = "产成品入库";
|
||||||
|
thirdWebapiRecord.method = "POST";
|
||||||
|
thirdWebapiRecord.url = config.value + "uapws/rest/productin/save";
|
||||||
|
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
|
||||||
|
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
|
||||||
|
thirdWebapiRecord.create_time = DateTime.Now;
|
||||||
|
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
string userAccount = wmsRawmatTransferinstockH?.biller ?? "";
|
string userAccount = wmsRawmatTransferinstockH?.biller ?? "";
|
||||||
string deptCode = wmsRawmatTransferinstockH?.dept_code ?? "";
|
string deptCode = wmsRawmatTransferinstockH?.dept_code ?? "";
|
||||||
UserEntity userEntity = await _db.Queryable<UserEntity>().Where(x=>x.Account==userAccount).FirstAsync();
|
UserEntity userEntity = await _db.Queryable<UserEntity>().Where(x=>x.Account==userAccount).FirstAsync();
|
||||||
string userId = userEntity?.Id ?? "";
|
string userId = userEntity?.Id ?? WmsWareHouseConst.AdministratorUserId;
|
||||||
|
|
||||||
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
|
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
|
||||||
List<string> tableIds = new List<string>();
|
List<string> tableIds = new List<string>();
|
||||||
|
|||||||
Reference in New Issue
Block a user