Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
Conflicts:
This commit is contained in:
12
BasicData/Tnb.BasicData.Entities/Dto/TranUnitInput.cs
Normal file
12
BasicData/Tnb.BasicData.Entities/Dto/TranUnitInput.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class TranUnitInput
|
||||||
|
{
|
||||||
|
public string material_id { get; set; }
|
||||||
|
public string unit_id { get; set; }
|
||||||
|
public decimal tran_qty1 { get; set; }
|
||||||
|
public decimal tran_qty2 { get; set; }
|
||||||
|
public decimal tran_qty3 { get; set; }
|
||||||
|
public decimal tran_qty4 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
BasicData/Tnb.BasicData.Entities/Dto/TranUnitOutput.cs
Normal file
12
BasicData/Tnb.BasicData.Entities/Dto/TranUnitOutput.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class TranUnitOutput
|
||||||
|
{
|
||||||
|
public string material_id { get; set; }
|
||||||
|
public string erp_unit_id { get; set; }
|
||||||
|
public decimal tran_qty1 { get; set; }
|
||||||
|
public decimal tran_qty2 { get; set; }
|
||||||
|
public decimal tran_qty3 { get; set; }
|
||||||
|
public decimal tran_qty4 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,5 +33,14 @@ public partial class BasMaterialUnit : BaseEntity<string>
|
|||||||
/// 关联物料id
|
/// 关联物料id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string material_id { get; set; } = string.Empty;
|
public string material_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 辅助单位id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public string auxiliary_unit_id_id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public string erp_unit_id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using JNPF.Systems.Entitys.Permission;
|
|||||||
using JNPF.Systems.Entitys.System;
|
using JNPF.Systems.Entitys.System;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SQLitePCL;
|
using SQLitePCL;
|
||||||
@@ -17,6 +18,8 @@ using SqlSugar;
|
|||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.BasicData.Entities.Dto;
|
using Tnb.BasicData.Entities.Dto;
|
||||||
using Tnb.BasicData.Interfaces;
|
using Tnb.BasicData.Interfaces;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
|
||||||
namespace Tnb.BasicData
|
namespace Tnb.BasicData
|
||||||
{
|
{
|
||||||
@@ -458,5 +461,62 @@ namespace Tnb.BasicData
|
|||||||
});
|
});
|
||||||
return !result.IsSuccess ? throw Oops.Oh(result.ErrorMessage) : "保存成功";
|
return !result.IsSuccess ? throw Oops.Oh(result.ErrorMessage) : "保存成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
public TranUnitOutput TranUnit(TranUnitInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
BasMaterial basMaterial = db.Queryable<BasMaterial>().Single(x => x.id == input.material_id);
|
||||||
|
DictionaryDataEntity unit = db.Queryable<DictionaryDataEntity>().Where(x=>x.DictionaryTypeId==WmsWareHouseConst.UNITTYPEID && x.EnCode==basMaterial.unit_id).First();
|
||||||
|
if (basMaterial.unit_id == input.unit_id || (unit!=null && unit.Id==input.unit_id))
|
||||||
|
{
|
||||||
|
string wmsUnitId = db.Queryable<BasMaterial>()
|
||||||
|
.InnerJoin<DictionaryDataEntity>((a,b)=>b.DictionaryTypeId==WmsWareHouseConst.UNITTYPEID && a.unit_id==b.EnCode)
|
||||||
|
.InnerJoin<ErpExtendField>((a,b,c)=>b.Id==c.table_id)
|
||||||
|
.Select((a,b,c)=>c.cunitid)
|
||||||
|
.First();
|
||||||
|
return new TranUnitOutput
|
||||||
|
{
|
||||||
|
erp_unit_id = wmsUnitId,
|
||||||
|
tran_qty1 = input.tran_qty1,
|
||||||
|
tran_qty2 = input.tran_qty2,
|
||||||
|
tran_qty3 = input.tran_qty3,
|
||||||
|
tran_qty4 = input.tran_qty4,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BasMaterialUnit basMaterialUnit = db.Queryable<BasMaterialUnit>()
|
||||||
|
.InnerJoin<DictionaryDataEntity>((a,b)=>b.DictionaryTypeId==WmsWareHouseConst.UNITTYPEID && a.auxiliary_unit_id==b.EnCode)
|
||||||
|
.InnerJoin<ErpExtendField>((a,b,c)=>b.Id==c.table_id)
|
||||||
|
.Where((a,b)=>(a.auxiliary_unit_id==input.unit_id || b.Id==input.unit_id) && a.material_id==input.material_id)
|
||||||
|
.Select((a,b,c)=>new BasMaterialUnit
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
number_of_auxiliary_unit = a.number_of_auxiliary_unit,
|
||||||
|
number_of_primary_unit = a.number_of_primary_unit,
|
||||||
|
auxiliary_unit_id = a.auxiliary_unit_id,
|
||||||
|
auxiliary_unit_id_id = b.Id,
|
||||||
|
material_id = a.material_id,
|
||||||
|
erp_unit_id = c.cunitid
|
||||||
|
|
||||||
|
})
|
||||||
|
.First();
|
||||||
|
|
||||||
|
if (basMaterialUnit == null)
|
||||||
|
{
|
||||||
|
throw Oops.Bah($"系统未找到单位:{input.unit_id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
TranUnitOutput tranUnitOutput = new TranUnitOutput();
|
||||||
|
tranUnitOutput.erp_unit_id = basMaterialUnit.erp_unit_id;
|
||||||
|
if(input.tran_qty1>0) tranUnitOutput.tran_qty1 = input.tran_qty1 * decimal.Parse(basMaterialUnit.number_of_primary_unit) / decimal.Parse(basMaterialUnit.number_of_auxiliary_unit);
|
||||||
|
if(input.tran_qty2>0) tranUnitOutput.tran_qty2 = input.tran_qty2 * decimal.Parse(basMaterialUnit.number_of_primary_unit) / decimal.Parse(basMaterialUnit.number_of_auxiliary_unit);
|
||||||
|
if(input.tran_qty3>0) tranUnitOutput.tran_qty3 = input.tran_qty3 * decimal.Parse(basMaterialUnit.number_of_primary_unit) / decimal.Parse(basMaterialUnit.number_of_auxiliary_unit);
|
||||||
|
if(input.tran_qty4>0) tranUnitOutput.tran_qty4 = input.tran_qty4 * decimal.Parse(basMaterialUnit.number_of_primary_unit) / decimal.Parse(basMaterialUnit.number_of_auxiliary_unit);
|
||||||
|
return tranUnitOutput;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -485,7 +485,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认传给erp的用户id
|
/// 默认传给erp的用户id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ERPUSERID = "1001A110000000003NBJ";
|
public const string ERPUSERID = "1001A1100000002QG0WU";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ERPId(天益4厂)
|
/// ERPId(天益4厂)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using SqlSugar;
|
|||||||
namespace Tnb.WarehouseMgr.Entities.Entity;
|
namespace Tnb.WarehouseMgr.Entities.Entity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 委外订单表子表
|
/// 委外收货表子表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("wms_outsource_d")]
|
[SugarTable("wms_outsource_d")]
|
||||||
public partial class WmsOutsourceD : BaseEntity<string>
|
public partial class WmsOutsourceD : BaseEntity<string>
|
||||||
|
|||||||
@@ -3158,13 +3158,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
work_station = ""
|
work_station = ""
|
||||||
}).Where(r => r.id == dt.carry_id).ExecuteCommandAsync();
|
}).Where(r => r.id == dt.carry_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
await QTRK2BIP(dt, db);
|
//await QTRK2BIP(dt, db);
|
||||||
// require_code是任务单
|
// require_code是任务单
|
||||||
//string mo_task_code = dt.require_code;
|
//string mo_task_code = dt.require_code;
|
||||||
}
|
}
|
||||||
else if (dt.biz_type == "erp_qtrk")
|
else if (dt.biz_type == "erp_qtrk")
|
||||||
{
|
{
|
||||||
await QTRK2BIP(dt, db);
|
//await QTRK2BIP(dt, db);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ using Tnb.WarehouseMgr.Interfaces;
|
|||||||
using Tnb.ProductionMgr.Entities.Entity;
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity;
|
using Tnb.WarehouseMgr.Entities.Entity;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -297,11 +298,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
// 采购入库
|
// 采购入库
|
||||||
if (instock.bill_type == WmsWareHouseConst.BILLTYPE_MATERIALINSTOCK_ID)
|
if (instock.bill_type == WmsWareHouseConst.BILLTYPE_MATERIALINSTOCK_ID)
|
||||||
{
|
{
|
||||||
//await _db.Updateable<WmsCarryCode>().SetColumns(r => new WmsCarryCode
|
WmsPurchaseD wmsPurchaseD = await _db.Queryable<WmsPurchaseD>().SingleAsync(x => x.id == input.wmsDistaskH.source_id);
|
||||||
//{
|
|
||||||
// auxprop_gys = ,
|
await _db.Updateable<WmsCarryCode>().SetColumns(r => new WmsCarryCode
|
||||||
// auxprop_xph =
|
{
|
||||||
//}).Where(r => r.id == input.wmsDistaskH.carry_id).ExecuteCommandAsync();
|
auxprop_gys = wmsPurchaseD.auxprop_gys,
|
||||||
|
auxprop_xph = wmsPurchaseD.auxprop_xph
|
||||||
|
}).Where(r => r.carry_id == input.wmsDistaskH.carry_id).ExecuteCommandAsync();
|
||||||
|
|
||||||
if (instock.sync_status != WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC)
|
if (instock.sync_status != WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC)
|
||||||
{
|
{
|
||||||
@@ -449,11 +452,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
// 委外入库
|
// 委外入库
|
||||||
else if (instock.bill_type == WmsWareHouseConst.BILLTYPE_OUTSOURCEINSTOCK_ID)
|
else if (instock.bill_type == WmsWareHouseConst.BILLTYPE_OUTSOURCEINSTOCK_ID)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
// 调拨入库
|
// 调拨入库
|
||||||
else if (instock.bill_type == WmsWareHouseConst.BILLTYPE_RAWMATTRANSFERINSTOCK_ID)
|
else if (instock.bill_type == WmsWareHouseConst.BILLTYPE_RAWMATTRANSFERINSTOCK_ID)
|
||||||
{
|
{
|
||||||
|
WmsRawmatTransferinstockD wmsRawmatTransferinstockD = await _db.Queryable<WmsRawmatTransferinstockD>().SingleAsync(x => x.id == input.wmsDistaskH.source_id);
|
||||||
|
|
||||||
|
await _db.Updateable<WmsCarryCode>().SetColumns(r => new WmsCarryCode
|
||||||
|
{
|
||||||
|
auxprop_gys = wmsRawmatTransferinstockD.auxprop_gys,
|
||||||
|
auxprop_xph = wmsRawmatTransferinstockD.auxprop_xph
|
||||||
|
}).Where(r => r.carry_id == input.wmsDistaskH.carry_id).ExecuteCommandAsync();
|
||||||
// List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
// List<WmsInstockD> allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||||
//
|
//
|
||||||
// WmsTempCode wmsTempCode = await _db.Queryable<WmsCarryCode>()
|
// WmsTempCode wmsTempCode = await _db.Queryable<WmsCarryCode>()
|
||||||
@@ -569,8 +579,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Logger.LogWarning($"【WmsInStockService Modify】 {ex.Message}");
|
||||||
|
Logger.LogWarning($"【MaterialSign Modify】 {ex.StackTrace}");
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsMaterialTransferD> dList = await _db.Queryable<WmsMaterialTransferD>().Where(x => x.bill_id == wmsMaterialTransferd.bill_id).OrderBy(x => x.id).ToListAsync();
|
List<WmsMaterialTransferD> dList = await _db.Queryable<WmsMaterialTransferD>().Where(x => x.bill_id == wmsMaterialTransferd.bill_id).OrderBy(x => x.id).ToListAsync();
|
||||||
DictionaryDataEntity unitData = await _db.Queryable<DictionaryTypeEntity>()
|
DictionaryDataEntity unitData = 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 && (y.EnCode == wmsMaterialTransferd.unit_id || y.Id == wmsMaterialTransferd.unit_id))
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && (y.EnCode == wmsMaterialTransferd.unit_id || y.Id== wmsMaterialTransferd.unit_id))
|
||||||
.Select((x, y) => y)
|
.Select((x, y) => y)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
string unitId = unitData?.Id ?? "";
|
string unitId = unitData?.Id ?? "";
|
||||||
@@ -457,6 +457,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||||
erpRequestData.Add("vbillcode", wmsMaterialTransfer.bill_code);
|
erpRequestData.Add("vbillcode", wmsMaterialTransfer.bill_code);
|
||||||
erpRequestData.Add("vtrantypecode", "4I-01");//其他出库 先写死
|
erpRequestData.Add("vtrantypecode", "4I-01");//其他出库 先写死
|
||||||
|
erpRequestData.Add("csourcebillhid", wmsMaterialTransfer.erp_pk);//其他出库 先写死
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1090,6 +1090,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||||
erpRequestData.Add("vbillcode", wmsMaterialTransfer.bill_code);
|
erpRequestData.Add("vbillcode", wmsMaterialTransfer.bill_code);
|
||||||
erpRequestData.Add("vtrantypecode", "4I-01");//其他出库 先写死
|
erpRequestData.Add("vtrantypecode", "4I-01");//其他出库 先写死
|
||||||
|
erpRequestData.Add("csourcebillhid", wmsMaterialTransfer.erp_pk);
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
@@ -1126,6 +1127,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/generalout/save";
|
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/generalout/save";
|
||||||
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
|
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
|
||||||
thirdWebapiRecord.create_time = DateTime.Now;
|
thirdWebapiRecord.create_time = DateTime.Now;
|
||||||
|
thirdWebapiRecord.remark = $"原材料转库单wms_material_transfer:{wmsMaterialTransfer.bill_code}";
|
||||||
|
|
||||||
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||||
Logger.LogInformation("【WmsMaterialTransferService ModifyAsync】同步其它出库单到erp成功");
|
Logger.LogInformation("【WmsMaterialTransferService ModifyAsync】同步其它出库单到erp成功");
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
||||||
erpRequestData.Add("vbillcode", instock.bill_code);
|
erpRequestData.Add("vbillcode", instock.bill_code);
|
||||||
erpRequestData.Add("vtrantypecode", tranType?.EnCode ?? "");
|
erpRequestData.Add("vtrantypecode", tranType?.EnCode ?? "");
|
||||||
|
erpRequestData.Add("csourcebillhid", wmsPurchaseH?.erp_arriveorder_pk ?? "");
|
||||||
|
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
foreach (WmsInstockD item in allInstockDetails)
|
foreach (WmsInstockD item in allInstockDetails)
|
||||||
|
|||||||
Reference in New Issue
Block a user