Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -11,7 +11,11 @@ public static class DictConst
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 计量单位
|
/// 计量单位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string MeasurementUnit = "MeasurementUnit";
|
public const string MeasurementUnit = "MeasurementUnit";
|
||||||
|
/// <summary>
|
||||||
|
/// erp交易类型
|
||||||
|
/// </summary>
|
||||||
|
public const string TransactionType = "TransactionType";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 区域类型-工位Code
|
/// 区域类型-工位Code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -29,6 +33,10 @@ public static class DictConst
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RegionCategoryWorklineCode = "workline";
|
public const string RegionCategoryWorklineCode = "workline";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 区域类型-产线Code
|
||||||
|
/// </summary>
|
||||||
|
public const string RegionCategoryWorkstationCode = "workstation";
|
||||||
|
/// <summary>
|
||||||
/// 备品备件类型
|
/// 备品备件类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string SparePartsType = "SparePartsType";
|
public const string SparePartsType = "SparePartsType";
|
||||||
|
|||||||
@@ -61,5 +61,7 @@ namespace Tnb.ProductionMgr.Entities.Entity.ErpEntity
|
|||||||
/// mes物料类型
|
/// mes物料类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DEFNAME { get; set; }
|
public string DEFNAME { get; set; }
|
||||||
|
|
||||||
|
public string UDI { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4092,6 +4092,15 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
return await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == id);
|
return await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<OrganizeEntity> GetWorkstationByPosition(string id)
|
||||||
|
{
|
||||||
|
return await _db.Queryable<PositionEntity>()
|
||||||
|
.LeftJoin<OrganizeEntity>((a,b)=>a.OrganizeId==b.Id && b.Category==DictConst.RegionCategoryWorkstationCode)
|
||||||
|
.Select((a,b)=>b)
|
||||||
|
.FirstAsync(x => x.Id == id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1071,6 +1071,7 @@ namespace Tnb.ProductionMgr
|
|||||||
category_id = categoryId,
|
category_id = categoryId,
|
||||||
unit_id = unitId,
|
unit_id = unitId,
|
||||||
state = "1",
|
state = "1",
|
||||||
|
di = erpBdMaterial.UDI,
|
||||||
create_time = DateTime.Now
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
insertMaterial.Add(basMaterial);
|
insertMaterial.Add(basMaterial);
|
||||||
@@ -1120,6 +1121,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.SetColumns(x => x.material_standard == erpBdMaterial.MATERIALTYPE)
|
.SetColumns(x => x.material_standard == erpBdMaterial.MATERIALTYPE)
|
||||||
.SetColumns(x => x.unit_id == unitId)
|
.SetColumns(x => x.unit_id == unitId)
|
||||||
.SetColumns(x => x.name == erpBdMaterial.NAME)
|
.SetColumns(x => x.name == erpBdMaterial.NAME)
|
||||||
|
.SetColumns(x => x.di == erpBdMaterial.UDI)
|
||||||
.Where(x => x.id == materialId)
|
.Where(x => x.id == materialId)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace Tnb.QcMgr
|
|||||||
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||||
.LeftJoin<PrdMoTask>((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code)
|
.LeftJoin<PrdMoTask>((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code)
|
||||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>f.eqp_id==g.id)
|
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>f.eqp_id==g.id)
|
||||||
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorklineCode)
|
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g,h)=>d.OrganizeIdTree.Contains(h.Id) && h.Category == DictConst.RegionCategoryWorkshopCode)
|
||||||
.LeftJoin<PositionEntity>((a,b,c,d,e,f,g,h,i)=>h.Id==i.OrganizeId)
|
.LeftJoin<PositionEntity>((a,b,c,d,e,f,g,h,i)=>h.Id==i.OrganizeId)
|
||||||
.WhereIF(_userManager.LoginType=="app" && !_userManager.IsAdministrator,(a,b,c,d,e,f,g,h,i)=>i.EnCode==positionEntity.EnCode)
|
.WhereIF(_userManager.LoginType=="app" && !_userManager.IsAdministrator,(a,b,c,d,e,f,g,h,i)=>i.EnCode==positionEntity.EnCode)
|
||||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
||||||
|
|||||||
@@ -78,102 +78,108 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new ArgumentNullException(nameof(input));
|
throw new ArgumentNullException(nameof(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
// WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().SingleAsync(x=>x.id==input.requireId);
|
WmsRawmatOutstockD wmsRawmatOutstockD = await _db.Queryable<WmsRawmatOutstockD>().SingleAsync(x=>x.id==input.requireId);
|
||||||
// WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
|
WmsRawmatOutstockH wmsRawmatOutstockH = await _db.Queryable<WmsRawmatOutstockH>().SingleAsync(x=>x.id==wmsRawmatOutstockD.bill_id);
|
||||||
// List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>()
|
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>()
|
||||||
// .Where(r => r.carry_id == input.wmsDistaskH.carry_id)
|
.Where(r => r.carry_id == input.wmsDistaskH.carry_id)
|
||||||
// .Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
|
.Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
|
||||||
// .ToListAsync();
|
.ToListAsync();
|
||||||
//
|
|
||||||
// decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
|
decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
|
||||||
//
|
|
||||||
// List<String> unitCodes = wmsCarryCodes.Select(x => x.unit_id).Distinct().ToList();
|
List<String> unitCodes = wmsCarryCodes.Select(x => x.unit_id).Distinct().ToList();
|
||||||
// List<string> materialIds = wmsCarryCodes.Select(x => x.material_id).ToList();
|
List<string> materialIds = wmsCarryCodes.Select(x => x.material_id).ToList();
|
||||||
// List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
// .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
// .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
|
||||||
// .Select((x, y) => y)
|
.Select((x, y) => y)
|
||||||
// .ToListAsync();
|
.ToListAsync();
|
||||||
//
|
|
||||||
// string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
|
DictionaryDataEntity tranTypeDataEntity = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
// List<string> tableIds = new List<string>();
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
// tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
.Where((x, y) => x.EnCode == DictConst.TransactionType && wmsRawmatOutstockH.outstock_type==y.EnCode)
|
||||||
// tableIds.AddRange(materialIds);
|
.Select((x, y) => y)
|
||||||
// tableIds.Add(supplierId);
|
.FirstAsync();
|
||||||
// tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
|
||||||
//
|
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
|
||||||
// List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
|
List<string> tableIds = new List<string>();
|
||||||
// string userId = wmsRawmatOutstockH.create_id;
|
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
// string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
|
tableIds.AddRange(materialIds);
|
||||||
// ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
tableIds.Add(supplierId);
|
||||||
// string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
tableIds.Add(tranTypeDataEntity?.Id);
|
||||||
// List<WmsErpWarehouserelaH> wmsErpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>!SqlFunc.IsNullOrEmpty(x.id)).ToListAsync();
|
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||||
//
|
|
||||||
// List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
|
||||||
// Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
string userId = wmsRawmatOutstockH.create_id;
|
||||||
// erpRequestData.Add("billmaker", erpCreateId);
|
string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? "";
|
||||||
// erpRequestData.Add("ccostdomainoid", null);
|
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||||
// erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
|
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
// erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
|
List<WmsErpWarehouserelaH> wmsErpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x=>!SqlFunc.IsNullOrEmpty(x.id)).ToListAsync();
|
||||||
// erpRequestData.Add("cdrawwarehouseid", erpOrg.pk_org_v);
|
|
||||||
//
|
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||||
// erpRequestData.Add("corpoid", erpOrg.corpoid);
|
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||||
// erpRequestData.Add("corpvid", erpOrg.corpvid);
|
erpRequestData.Add("billmaker", erpCreateId);
|
||||||
// erpRequestData.Add("cdptid","1001A1100000001JFOPQ");//部门先写死
|
erpRequestData.Add("ccostdomainoid", null);
|
||||||
// erpRequestData.Add("cdptvid","0001A1100000000AOMIQ");//部门先写死
|
erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
|
||||||
// erpRequestData.Add("cotherdptid","1001A1100000001JFOPQ");//部门先写死
|
erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
|
||||||
// erpRequestData.Add("cotherdptvid","0001A1100000000AOMIQ");//部门先写死
|
// erpRequestData.Add("cdrawwarehouseid", null);
|
||||||
// erpRequestData.Add("creationtime", nowStr);
|
erpRequestData.Add("cfanaceorgoid", erpOrg.pk_org);
|
||||||
// erpRequestData.Add("creator", erpCreateId);
|
erpRequestData.Add("cfanaceorgvid", erpOrg.pk_org_v);
|
||||||
// erpRequestData.Add("ctrantypeid", "0001H11000000000D32A");//先写死
|
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
||||||
// erpRequestData.Add("cwarehouseid", outWhid);//先写死
|
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
||||||
// erpRequestData.Add("dbilldate", wmsRawmatTransferoutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
|
erpRequestData.Add("creationtime", nowStr);
|
||||||
// erpRequestData.Add("dmakedate", nowStr);
|
erpRequestData.Add("creator", erpCreateId);
|
||||||
// erpRequestData.Add("dshldarrivedate", nowStr);
|
erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x=>x.table_id==tranTypeDataEntity?.Id)?.transaction_type_id ?? "");//先写死
|
||||||
// erpRequestData.Add("dshlddiliverdate", nowStr);
|
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatOutstockH.warehouse_id)?.erp_warehouseid ?? "");
|
||||||
// erpRequestData.Add("fbillflag", 1);
|
erpRequestData.Add("dbilldate", wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||||
// erpRequestData.Add("isbackdeliver", false);
|
erpRequestData.Add("dmakedate", nowStr);
|
||||||
// erpRequestData.Add("ntotalnum", qty);
|
erpRequestData.Add("fbillflag", 2);
|
||||||
// erpRequestData.Add("pk_org", erpOrg.pk_org);
|
erpRequestData.Add("ntotalnum", qty);
|
||||||
// erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
erpRequestData.Add("pk_org", erpOrg.pk_org);
|
||||||
// erpRequestData.Add("pk_group", erpOrg.pk_group);
|
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||||
// erpRequestData.Add("vbillcode", wmsRawmatTransferoutstockH.bill_code);
|
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
||||||
// erpRequestData.Add("vtrantypecode", "4Y-01");//先写死
|
erpRequestData.Add("vbillcode", wmsRawmatOutstockH.bill_code);
|
||||||
//
|
erpRequestData.Add("vtrantypecode", wmsRawmatOutstockH.outstock_type);
|
||||||
// List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
erpRequestData.Add("vdef20", true);
|
||||||
// foreach(var item in wmsCarryCodes)
|
|
||||||
// {
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
// // 出库数量wmsMaterialSignD.sign_qty
|
foreach(var item in wmsCarryCodes)
|
||||||
// erpRequestDataDetails.Add(new Dictionary<string, object>()
|
{
|
||||||
// {
|
// 出库数量wmsMaterialSignD.sign_qty
|
||||||
// ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
// ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
|
{
|
||||||
// ["corpoid"] = erpOrg.corpoid,
|
["cbodytranstypecode"] = wmsRawmatOutstockH.outstock_type,
|
||||||
// ["corpvid"] = erpOrg.corpvid,
|
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
|
||||||
// ["crowno"] = (wmsCarryCodes.FindIndex(x => x.id == item.id) + 1) * 10,
|
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
|
||||||
// ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
["corpoid"] = erpOrg.corpoid,
|
||||||
// ["nnum"] = item.codeqty,
|
["corpvid"] = erpOrg.corpvid,
|
||||||
// ["nshouldnum"] = item.codeqty,
|
["crowno"] = wmsRawmatOutstockD.lineno,
|
||||||
// ["pk_group"] = erpOrg.pk_group,
|
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
// ["pk_org"] = erpOrg.pk_org,
|
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||||
// ["pk_org_v"] = erpOrg.pk_org_v,
|
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||||
// ["vbatchcode"] = item.code_batch,
|
["dbizdate"] = wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
//
|
["nshouldnum"] = item.codeqty,
|
||||||
// });
|
["nnum"] = item.codeqty,
|
||||||
// }
|
["pk_group"] = erpOrg.pk_group,
|
||||||
// erpRequestData.Add("dtls", erpRequestDataDetails);
|
["pk_org"] = erpOrg.pk_org,
|
||||||
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
["vbatchcode"] = item.code_batch,
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
erpRequestData.Add("dtls", erpRequestDataDetails);
|
||||||
// requestData.Add(erpRequestData);
|
// requestData.Add(erpRequestData);
|
||||||
// BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
|
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
|
||||||
// ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
||||||
// thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
||||||
// thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||||
// thirdWebapiRecord.name = "材料出库单(自制)";
|
thirdWebapiRecord.name = "材料出库单(自制)";
|
||||||
// thirdWebapiRecord.method = "POST";
|
thirdWebapiRecord.method = "POST";
|
||||||
// thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
|
thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
|
||||||
// // thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
|
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
|
||||||
// thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
|
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||||
// thirdWebapiRecord.create_time = DateTime.Now;
|
thirdWebapiRecord.create_time = DateTime.Now;
|
||||||
// await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
["crowno"] = (wmsCarryCodes.FindIndex(x => x.id == item.id) + 1) * 10,
|
["crowno"] = (wmsCarryCodes.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 ?? "",
|
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
["nnum"] = item.codeqty,
|
["nnum"] = item.codeqty,
|
||||||
["nshouldnum"] = item.codeqty,
|
["nassistnum"] = item.codeqty,
|
||||||
["pk_group"] = erpOrg.pk_group,
|
["pk_group"] = erpOrg.pk_group,
|
||||||
["pk_org"] = erpOrg.pk_org,
|
["pk_org"] = erpOrg.pk_org,
|
||||||
["pk_org_v"] = erpOrg.pk_org_v,
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
|||||||
Reference in New Issue
Block a user