退料接口
This commit is contained in:
@@ -206,6 +206,88 @@ namespace Tnb.ProductionMgr
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetInfoByQrCodeForBackMaterial(Dictionary<String,String> dic)
|
||||
{
|
||||
string qrCode = dic["qrcode"];
|
||||
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().SingleAsync(x => x.carry_code == qrCode);
|
||||
if (wmsCarryH == null)
|
||||
{
|
||||
throw Oops.Bah($"未找到该载具{qrCode}");
|
||||
}
|
||||
|
||||
if (wmsCarryH.carrystd_id==WmsWareHouseConst.CARRY_ZYXCSTD_ID || wmsCarryH.carrystd_id==WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
||||
{
|
||||
List<FeedingDetailOutput> result = await db.Queryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<WmsCarryH>((a, b) => b.id==a.carry_id)
|
||||
.Where((a,b) => b.carry_code == qrCode && a.is_all_feeding == 0 )
|
||||
.Select((a, b) => new FeedingDetailOutput
|
||||
{
|
||||
carry_id = b.id,
|
||||
carry_name = b.carry_name,
|
||||
children = SqlFunc.Subqueryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<BasMaterial>((c, d) => c.material_id == d.id)
|
||||
.Where((c, d) => a.carry_id == c.carry_id && c.is_all_feeding == 0 )
|
||||
.ToList((c, d) => new CarryCodeDetailOutput()
|
||||
{
|
||||
unit_id = d.unit_id,
|
||||
// barcode = c.barcode,
|
||||
// code_batch = c.code_batch,
|
||||
code_batch = c.batch,
|
||||
codeqty = c.num - SqlFunc.IsNull(c.feeding_num,0),
|
||||
material_id = c.material_id,
|
||||
material_code = d.code,
|
||||
material_name = d.name
|
||||
})
|
||||
}).ToListAsync();
|
||||
if (result.Count > 1)
|
||||
{
|
||||
throw Oops.Bah("找到多条签收记录");
|
||||
}else if (result.Count == 1)
|
||||
{
|
||||
return result[0];
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
List<FeedingDetailOutput> result = await db.Queryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<WmsCarryH>((a, b) => b.carry_code==a.member_carry_code)
|
||||
.Where((a) => a.member_carry_code == qrCode && a.is_all_feeding == 0 )
|
||||
.Select((a, b) => new FeedingDetailOutput
|
||||
{
|
||||
carry_id = b.id,
|
||||
carry_name = b.carry_name,
|
||||
children = SqlFunc.Subqueryable<PrdMaterialReceiptD>()
|
||||
.LeftJoin<BasMaterial>((c, d) => c.material_id == d.id)
|
||||
.Where((c, d) => a.member_carry_code == c.member_carry_code && c.is_all_feeding == 0)
|
||||
.ToList((c, d) => new CarryCodeDetailOutput()
|
||||
{
|
||||
unit_id = d.unit_id,
|
||||
// barcode = c.barcode,
|
||||
// code_batch = c.code_batch,
|
||||
code_batch = c.batch,
|
||||
codeqty = c.num - SqlFunc.IsNull(c.feeding_num,0),
|
||||
material_id = c.material_id,
|
||||
material_code = d.code,
|
||||
material_name = d.name
|
||||
})
|
||||
}).ToListAsync();
|
||||
if (result.Count > 1)
|
||||
{
|
||||
throw Oops.Bah("找到多条签收记录");
|
||||
}else if (result.Count == 1)
|
||||
{
|
||||
return result[0];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveData(MaterialReceiptInput input)
|
||||
|
||||
Reference in New Issue
Block a user