|
|
@@ -92,11 +92,12 @@ class LaborApplyService
|
|
|
$warehouses = Warehouse::all();
|
|
|
//给每个仓库计算分配数据 更改申请状态为指派成功
|
|
|
foreach ($warehouses as $warehouse) {
|
|
|
- //查询当日的的申请,将申请的男女工分别加和
|
|
|
+ //根据时间,仓库,状态 查询当日的的申请,将申请的男女工分别加和
|
|
|
$builder = DB::table('labor_applies')
|
|
|
->selectRaw("sum(man_num) as man_num ,sum(woman_num) as woman_num")
|
|
|
->whereBetween('created_at', [now()->startOfDay(), now()->endOfDay()])
|
|
|
- ->where('warehouse_id', $warehouse->id);
|
|
|
+ ->where('warehouse_id', $warehouse->id)
|
|
|
+ ->where('status', 1);
|
|
|
//如果是追加模式
|
|
|
if ($isAppend) {
|
|
|
//只查询最后一次分配后的申请
|
|
|
@@ -154,6 +155,8 @@ class LaborApplyService
|
|
|
'exceed_max_labor_num_status' => LaborCompanyDispatch::NOT_EXCEED_MAX_LABOR_NUM,//没有超限额
|
|
|
'status' => 1,//创建
|
|
|
'warehouse_id' => $warehouse_id,
|
|
|
+ 'created_at' => now(),
|
|
|
+ 'updated_at' => now(),
|
|
|
];
|
|
|
}
|
|
|
//分配男工
|