存erp到货单主子表id

This commit is contained in:
2024-08-02 11:13:05 +08:00
parent cf4c3d36b6
commit 6aa821652b
9 changed files with 299 additions and 31 deletions

View File

@@ -4,6 +4,9 @@ namespace Tnb.BasicData.Entities
{
public int Code { get; set; }
public string msgResult { get; set; }
public object msg { get; set; }
}
// public enum ThirdResultCode

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,92 @@
using JNPF.Common.Contracts;
using JNPF.Common.Security;
using SqlSugar;
namespace Tnb.ProductionMgr.Entities;
/// <summary>
/// 料仓原料条码
/// </summary>
[SugarTable("prd_raw_material_barcode")]
public partial class PrdRawMaterialBarcode : BaseEntity<string>
{
public PrdRawMaterialBarcode()
{
id = SnowflakeIdHelper.NextId();
}
/// <summary>
/// 单据编号
/// </summary>
public string bill_code { get; set; } = string.Empty;
/// <summary>
/// 料仓id/机台id
/// </summary>
public string equip_id { get; set; } = string.Empty;
/// <summary>
/// 物料id
/// </summary>
public string? material_id { get; set; }
/// <summary>
/// 1 料仓原料条码 2 机台原料
/// </summary>
public string type { get; set; }
/// <summary>
/// 是否更新
/// </summary>
public int is_update { get; set; }
/// <summary>
/// 吸料完成
/// </summary>
public int absorb_material_finish { get; set; }
/// <summary>
/// 管道状态
/// </summary>
public int piping_status { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime start_time { get; set; } = DateTime.Now;
/// <summary>
/// 结束时间
/// </summary>
public DateTime end_time { get; set; } = DateTime.Now;
/// <summary>
/// 备注
/// </summary>
public string? remark { get; set; }
/// <summary>
/// 创建用户
/// </summary>
public string? create_id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? create_time { get; set; }
/// <summary>
/// 修改用户
/// </summary>
public string? modify_id { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? modify_time { get; set; }
/// <summary>
/// 所属组织
/// </summary>
public string? org_id { get; set; }
}

View File

@@ -0,0 +1,43 @@
using JNPF.Common.Core.Manager;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Systems.Interfaces.System;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.ProductionMgr.Entities;
namespace Tnb.ProductionMgr
{
/// <summary>
/// 料仓原料条码服务
/// </summary>
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
public class PrdRawMaterialBarcodeService: IDynamicApiController, ITransient
{
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
private static Dictionary<string, Tuple<string, string>> _dicWorkLine = new();
public PrdRawMaterialBarcodeService(ISqlSugarRepository<PrdRawMaterialBarcode> repository,
IUserManager userManager,
IDictionaryDataService dictionaryDataService)
{
_db = repository.AsSugarClient();
_userManager = userManager;
_dictionaryDataService = dictionaryDataService;
}
// /// <summary>
// /// 上模校验
// /// </summary>
// /// <returns></returns>
// [HttpPost]
// public async Task<dynamic> CheckMold(string id)
// {
// // PrdRawMaterialBarcode prdRawMaterialBarcode = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
// // BasQrcode basQrcode = await _db.Queryable<BasQrcode>().Where(x => x.source_name == "TOOL_MOLDS" && x.code == input.mold_qrcode).FirstAsync();
// // return prdMoTask != null && basQrcode != null ? prdMoTask.mold_id == basQrcode.source_id : (dynamic)false;
// }
}
}

View File

@@ -113,4 +113,9 @@ public partial class WmsPurchaseD : BaseEntity<string>
/// 质检结果
/// </summary>
public string? qc_res { get; set; }
/// <summary>
/// erp到货单子表pk
/// </summary>
public string erp_arriveorder_b_pk { get;set; }
}

View File

@@ -155,5 +155,8 @@ public partial class WmsPurchaseH : BaseEntity<string>, IPurchaseAndSaleAuitEnti
/// </summary>
public string? transaction_type { get; set; }
/// <summary>
/// erp到货单主表pk
/// </summary>
public string erp_arriveorder_pk { get;set; }
}

View File

@@ -342,12 +342,13 @@ namespace Tnb.WarehouseMgr
DictionaryDataEntity tranType = await _db.Queryable<DictionaryDataEntity>().Where(x=>x.DictionaryTypeId=="25043925951909" && x.EnCode==wmsPurchaseH.transaction_type).FirstAsync();
string tranTypeId = tranType?.Id ?? "";
string supplierId = wmsPurchaseOrderH?.supplier_id ?? "";
List<string> tableIds = new List<string>();
tableIds.Add(_userManager.UserId);
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
tableIds.Add(instock.warehouse_id);
tableIds.AddRange(materialIds);
tableIds.Add(instock.supplier_id);
tableIds.Add(supplierId);
tableIds.Add(tranTypeId);
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
@@ -367,8 +368,8 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x => x.table_id == tranTypeId)?.transaction_type_id ?? "");
erpRequestData.Add("cvendorid", erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_id ?? "");
erpRequestData.Add("cvendorvid", erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_vid ?? "");
erpRequestData.Add("cvendorid", erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "");
erpRequestData.Add("cvendorvid", erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "");
erpRequestData.Add("cwarehouseid", erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取
erpRequestData.Add("dbilldate", nowStr);
erpRequestData.Add("dmakedate", nowStr);
@@ -397,8 +398,8 @@ namespace Tnb.WarehouseMgr
["corpvid"] = erpOrg.corpvid,
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["cvendorid"] = erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_id ?? "",
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_vid ?? "",
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
["dbizdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
["nnum"] = item.qty,
["nshouldnum"] = item.pr_qty,
@@ -408,15 +409,15 @@ namespace Tnb.WarehouseMgr
["pk_org_v"] = erpOrg.pk_org_v,
["pseudocolumn"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
["vbatchcode"] = item.code_batch,
["csourcebillhid"] = wmsPurchaseOrderH?.erp_pk ?? "",
["csourcebillbid"] = wmsPurchaseOrderDs?.erp_line_pk ?? "",
["vsourcebillcode"] = wmsPurchaseOrderH?.erp_bill_code ?? "",
["csourcebillhid"] = wmsPurchaseH?.erp_arriveorder_pk ?? "",
["csourcebillbid"] = wmsPurchaseD?.erp_arriveorder_b_pk ?? "",
["vsourcebillcode"] = wmsPurchaseH?.bill_code ?? "",
["lineno"] = wmsPurchaseOrderDs?.lineno ?? "",
["vfree1"] = erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_id ?? "",
["vfree1"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
});
}
erpRequestData.Add("PurchaseInBodyVODtl", erpRequestDataDetails);
erpRequestData.Add("dtls", erpRequestDataDetails);
requestData.Add(erpRequestData);
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();

View File

@@ -219,6 +219,7 @@ namespace Tnb.WarehouseMgr
["pk_srcmaterial"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
["vbatchcode"] = item.code_batch,
["Vfree1"] = item.code_batch,
["mes_detail_id"] = item.id,
});
}
erpRequestData.Add("dtls",erpRequestDataDetails);

View File

@@ -280,9 +280,9 @@ public class TestService : IDynamicApiController, ITransient
};
inserteErpExtendFields.Add(extendField);
await _sugar.Insertable(insertList).ExecuteCommandAsync();
await _sugar.Insertable(inserteErpExtendFields).ExecuteCommandAsync();
}
await _sugar.Insertable(insertList).ExecuteCommandAsync();
await _sugar.Insertable(inserteErpExtendFields).ExecuteCommandAsync();
return "测试成功";
}