using WmsMobileServe.Annotation;
using WmsMobileServe.DataBase.Base.Po;
namespace WmsMobileServe.DataBase.Base.Dao;
///
/// 入库单操作
///
[Component]
public class TRKWareNOticeTabDao(DataBaseClient client)
{
public List? SelectWithOrderIdAndGoodsId(string? orderId, string? goodsId)
{
try
{
var sqlFuc = client.Instance().Queryable()
.Where(w => w.PurchaseId == orderId && w.GoodsId == goodsId)
.OrderBy(o => o.PoLineId);
return sqlFuc.ToList();
}
catch (Exception ex)
{
_ = ex;
return default;
}
}
public bool UpdateStatusAndInsertInTask(string? status, List? goodsShelves, string? vehicleNo)
{
if (goodsShelves == null || goodsShelves.Count < 1) return false;
try
{
var sqlFuc = client.Instance().UseTran(() =>
{
foreach(var goodsShelf in goodsShelves)
{
client.Instance().Updateable()
.SetColumns(s => s.PrintSts == status)
.SetColumns(s => s.PackageId == vehicleNo)
.SetColumns(s => s.ArrAmount == goodsShelf.ShelfNum)
.Where(w => w.PurchaseId == goodsShelf.ProviderId && w.GoodsId == goodsShelf.GoodsId && w.PoLineId == Convert.ToInt32(goodsShelf.PoLineId)).ExecuteCommand();
client.Instance().Insertable(goodsShelf).ExecuteCommand();
}
});
return sqlFuc.IsSuccess;
}
catch (Exception ex)
{
_ = ex;
return false;
}
}
}