using WmsMobileServe.Annotation;
using WmsMobileServe.DataBase.Base.Po;
namespace WmsMobileServe.DataBase.Base.Dao;
///
/// 出库任务表操作类
///
///
[Component]
public class TPickingGoodsDao(DataBaseClient client)
{
public List? SelectPickTask(string? vehicleNo)
{
try
{
var sqlFuc = client.Instance().Queryable()
.Where(w => w.VehicleNo == vehicleNo && w.Status == "6");
return sqlFuc.ToList();
}
catch (Exception ex)
{
_ = ex;
return null;
}
}
public bool PickComplete(List<(string? vehicleNo, string? goodsId, decimal? pickingNum)> pickData)
{
try
{
var sqlFuc = client.Instance().UseTran(() =>
{
foreach ((string? vehicleNo, string? goodsId, decimal? pickingNum) in pickData)
{
client.Instance().Updateable()
.SetColumns(s => s.Status == "9")
.SetColumns(s => s.GoodsNumSj == pickingNum)
.Where(w => w.VehicleNo == vehicleNo && w.GoodsId == goodsId).ExecuteCommand();
}
});
return sqlFuc.IsSuccess;
}
catch (Exception ex)
{
_ = ex;
return false;
}
}
public string InsertReturnErr(params TPickGoods[] pickGoods)
{
try
{
client.Instance().Insertable(pickGoods).ExecuteCommand();
return "";
}
catch (Exception ex)
{
_ = ex;
return ex.Message;
}
}
}