feat: 完善材料条码与焊接业务功能
This commit is contained in:
@@ -16,12 +16,13 @@
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据材料主编码获取条码扫码所需的材料信息。
|
||||
/// 根据入库条码获取扫码所需的材料信息。
|
||||
/// </summary>
|
||||
public static Model.MaterialCodeLibBarCodeOutput GetBarCodeMaterialInfo(string materialCode)
|
||||
public static Model.MaterialCodeLibBarCodeOutput GetBarCodeMaterialInfo(string barCode)
|
||||
{
|
||||
return (from x in Funs.DB.HJGL_MaterialCodeLib
|
||||
where x.MaterialCode == materialCode
|
||||
return (from detailBarCode in Funs.DB.Tw_InputDetailBarCode
|
||||
join x in Funs.DB.HJGL_MaterialCodeLib on detailBarCode.MaterialCode equals x.MaterialCode
|
||||
where detailBarCode.BarCode == barCode
|
||||
select new Model.MaterialCodeLibBarCodeOutput
|
||||
{
|
||||
MaterialCode = x.MaterialCode,
|
||||
@@ -31,10 +32,36 @@
|
||||
MaterialName = x.MaterialName,
|
||||
MaterialDef = x.MaterialDef,
|
||||
MaterialSpec = x.MaterialSpec,
|
||||
MaterialUnit = x.MaterialUnit
|
||||
MaterialUnit = x.MaterialUnit,
|
||||
BarCode = detailBarCode.BarCode,
|
||||
Quantity = detailBarCode.Quantity
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存指定入库条码的数量,并返回更新后的扫码信息。
|
||||
/// </summary>
|
||||
public static Model.MaterialCodeLibBarCodeOutput SaveBarCodeQuantity(string barCode, decimal quantity)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(barCode))
|
||||
{
|
||||
throw new System.ArgumentException("条码不能为空。");
|
||||
}
|
||||
if (quantity <= 0m)
|
||||
{
|
||||
throw new System.ArgumentException("数量必须大于0。");
|
||||
}
|
||||
|
||||
var detailBarCode = Funs.DB.Tw_InputDetailBarCode.FirstOrDefault(x => x.BarCode == barCode);
|
||||
if (detailBarCode == null)
|
||||
{
|
||||
throw new System.InvalidOperationException("未找到对应的入库条码。");
|
||||
}
|
||||
detailBarCode.Quantity = quantity;
|
||||
Funs.DB.SubmitChanges();
|
||||
return GetBarCodeMaterialInfo(barCode);
|
||||
}
|
||||
|
||||
public static List<Model.HJGL_MaterialCodeLib> GetMaterialCodeLibList()
|
||||
{
|
||||
var q = (from x in Funs.DB.HJGL_MaterialCodeLib select x).ToList();
|
||||
|
||||
Reference in New Issue
Block a user