|
@@ -18,6 +18,7 @@ use app\api\controller\GroupUser as GroupUserController;
|
|
|
use app\common\model\ShopDelivery as ShopDeliveryModel;
|
|
use app\common\model\ShopDelivery as ShopDeliveryModel;
|
|
|
use app\common\model\WorkerOut as WorkerOutModel;
|
|
use app\common\model\WorkerOut as WorkerOutModel;
|
|
|
use app\common\model\PackSpecs as PackSpecsModel;
|
|
use app\common\model\PackSpecs as PackSpecsModel;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 打包工人相关接口
|
|
* 打包工人相关接口
|
|
|
*/
|
|
*/
|
|
@@ -271,7 +272,8 @@ class Worker extends Base
|
|
|
$spec_quantity_sum=$item['spec_quantity_sum'];
|
|
$spec_quantity_sum=$item['spec_quantity_sum'];
|
|
|
$spec_labor_cost_money_sum=$item['spec_labor_cost_money_sum'];
|
|
$spec_labor_cost_money_sum=$item['spec_labor_cost_money_sum'];
|
|
|
$this->quantity_sum=bcadd($this->quantity_sum, $spec_quantity_sum,0);
|
|
$this->quantity_sum=bcadd($this->quantity_sum, $spec_quantity_sum,0);
|
|
|
- $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,2);
|
|
|
|
|
|
|
+ $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,4);
|
|
|
|
|
+ $this->labor_cost_money_sum = round((float)$this->labor_cost_money_sum, 2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$data = [
|
|
$data = [
|
|
@@ -283,6 +285,50 @@ class Worker extends Base
|
|
|
];
|
|
];
|
|
|
$this->success('ok', $data);
|
|
$this->success('ok', $data);
|
|
|
}
|
|
}
|
|
|
|
|
+ //获取数量、总价
|
|
|
|
|
+ public function quantity_labor_cost_money(ScanLog $scanLog){
|
|
|
|
|
+ $where = [];
|
|
|
|
|
+ $limit = $this->request->post('limit/d', 10); //条数
|
|
|
|
|
+ $todayTime = date("Y-m-d");
|
|
|
|
|
+ $startTime = strtotime($todayTime . ' 00:00:00');
|
|
|
|
|
+ $startTime = date('Y-m-d H:i:s', $startTime);
|
|
|
|
|
+ $endTime = strtotime($todayTime . ' 23:59:59');
|
|
|
|
|
+ $endTime = date('Y-m-d H:i:s', $endTime);
|
|
|
|
|
+ $time=$startTime.','.$endTime;
|
|
|
|
|
+
|
|
|
|
|
+ $time = $this->request->post('create_time/s',$time); //日期
|
|
|
|
|
+ $this->time=$time;
|
|
|
|
|
+ if (!empty($time)) {
|
|
|
|
|
+ $arr = explode(',', $time);
|
|
|
|
|
+ $where[] = ['sl.createtime', '>=', strtotime($arr[0])];
|
|
|
|
|
+ $where[] = ['sl.createtime', '<=', strtotime($arr[1])];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $pid = $this->userinfo['id'];
|
|
|
|
|
+ $where[] = ['sl.user_id', '=', $pid];
|
|
|
|
|
+
|
|
|
|
|
+ $list_sum = $scanLog->alias('sl')
|
|
|
|
|
+ ->join("shop_delivery sd", "sl.code = sd.waybill_no", "INNER")
|
|
|
|
|
+ ->where('sl.order_status', 1)
|
|
|
|
|
+ ->where('sl.spec_id','<>', null)
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->field("sl.code,sl.spec_id,SUM(COALESCE(sd.num,0) * 1) as spec_quantity_sum,SUM(COALESCE(sd.num,0) * COALESCE(sd.labor_cost_money,0)) as spec_labor_cost_money_sum")
|
|
|
|
|
+ ->group('sl.spec_id')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ foreach ($list_sum as $item) {
|
|
|
|
|
+ $spec_quantity_sum=$item['spec_quantity_sum'];
|
|
|
|
|
+ $spec_labor_cost_money_sum=$item['spec_labor_cost_money_sum'];
|
|
|
|
|
+ $this->quantity_sum=bcadd($this->quantity_sum, $spec_quantity_sum,0);
|
|
|
|
|
+ $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,4);
|
|
|
|
|
+ $this->labor_cost_money_sum = round((float)$this->labor_cost_money_sum, 2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'quantity_sum' => $this->quantity_sum,
|
|
|
|
|
+ 'labor_cost_money_sum' => $this->labor_cost_money_sum
|
|
|
|
|
+ ];
|
|
|
|
|
+ return $data;
|
|
|
|
|
+ }
|
|
|
//获取今天出工人员状态,0=未出个,1=出工
|
|
//获取今天出工人员状态,0=未出个,1=出工
|
|
|
public function get_worker_out_state($id, $pid,$time)
|
|
public function get_worker_out_state($id, $pid,$time)
|
|
|
{
|
|
{
|