|
|
@@ -127,11 +127,7 @@ class WorkOrder extends Api
|
|
|
$where['成品代号'] = ['like',$clientNumber.'%'];
|
|
|
}
|
|
|
}
|
|
|
-// if (substr($clientNumber,0,1) === 'Y'){
|
|
|
-// $where['工单分类'] = 1;
|
|
|
-// }elseif (substr($clientNumber,0,1) === 'J'){
|
|
|
-// $where['工单分类'] = 2;
|
|
|
-// }
|
|
|
+
|
|
|
if (!empty($workOrder)){
|
|
|
$where['Gd_gdbh'] = $workOrder;
|
|
|
}
|
|
|
@@ -144,8 +140,6 @@ class WorkOrder extends Api
|
|
|
if (!empty($startTime) && !empty($endTime)){
|
|
|
$where['接单日期'] = ['between',[$startTime,$endTime]];
|
|
|
}
|
|
|
-// $where['工单分类'] = $sort;
|
|
|
-// $where['行号'] = ['in',['1','10']];
|
|
|
$total = \db('工单_基本资料')->where($where)->distinct(true)->field('Gd_gdbh')->count();
|
|
|
$list = \db('工单_基本资料')
|
|
|
->where($where)
|
|
|
@@ -3196,4 +3190,95 @@ class WorkOrder extends Api
|
|
|
}
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 糊盒标准工单列表
|
|
|
+ * @return void
|
|
|
+ * @throws \think\Exception
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function HuheWorkList()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $search = input('search');
|
|
|
+ $clientNumber = input('Gd_khdh');
|
|
|
+ $startTime = input('start');
|
|
|
+ $endTime = input('end');
|
|
|
+ $page = input('page');
|
|
|
+ $limit = input('limit');
|
|
|
+ $param = $this->request->param();
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ if (!empty($clientNumber)){
|
|
|
+ if (substr($clientNumber,0,1) !== 'Y' && substr($clientNumber,0,1) !== 'J')
|
|
|
+ {
|
|
|
+ $clientNumber = substr($clientNumber,0,4);
|
|
|
+ }
|
|
|
+ if ($clientNumber === 'Y1401'){
|
|
|
+ $where['Gd_cpdh'] = ['like',$clientNumber.'%'];
|
|
|
+ }else{
|
|
|
+ $where['成品代号'] = ['like',$clientNumber.'%'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($workOrder)){
|
|
|
+ $where['Gd_gdbh'] = $workOrder;
|
|
|
+ }
|
|
|
+ if (!empty($productCode)){
|
|
|
+ $where['Gd_cpdh'] = $productCode;
|
|
|
+ }
|
|
|
+ if (!empty($search)){
|
|
|
+ $where['Gd_gdbh|Gd_客户代号|Gd_客户名称|Gd_khdh|Gd_khmc|Gd_cpdh|Gd_cpmc|成品代号|成品名称|产品版本号'] = ['like','%'.$search.'%'];
|
|
|
+ }
|
|
|
+ if (!empty($startTime) && !empty($endTime)){
|
|
|
+ $where['接单日期'] = ['between',[$startTime,$endTime]];
|
|
|
+ }
|
|
|
+ $where['Gd_lx'] = '糊盒标准工单';
|
|
|
+ $total = \db('工单_基本资料')->where($where)->distinct(true)->field('Gd_gdbh')->count();
|
|
|
+ $list = \db('工单_基本资料')
|
|
|
+ ->where($where)
|
|
|
+ ->order('Gd_statu desc')
|
|
|
+ ->limit(($page-1)*$limit,$limit)
|
|
|
+ ->group('Gd_gdbh')
|
|
|
+ ->select();
|
|
|
+ //工单基本资料数据整理
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ $data[$key] = [
|
|
|
+ '工单编号' => rtrim($value['Gd_gdbh']),
|
|
|
+ '生产分类' => rtrim($value['Gd_生产分类']),
|
|
|
+ '销售订单号' => rtrim($value['销售订单号']),
|
|
|
+ '产品代号' => rtrim($value['成品代号']),
|
|
|
+ '产品名称' => rtrim($value['成品名称']),
|
|
|
+ '订单数量' => floatval($value['订单数量']),
|
|
|
+ '单位' => rtrim($value['计量单位']),
|
|
|
+ '折合大箱' => rtrim((int)$value['投料大箱']),
|
|
|
+ '投料率' => rtrim($value['投料率']),
|
|
|
+ '平均合格率' => '',
|
|
|
+ '开单日期' => date('Y-m-d',strtotime(rtrim($value['接单日期']))),
|
|
|
+ '交货日期' => date('Y-m-d',strtotime(rtrim($value['交货日期']))),
|
|
|
+ '工单类型' => rtrim($value['Gd_lx']),
|
|
|
+ '工单状态' => rtrim($value['gd_statu']),
|
|
|
+ '当前生产工序' => '',
|
|
|
+ '产量提交时间' => '',
|
|
|
+ '建档用户' => rtrim($value['Sys_id']),
|
|
|
+ '建档时间' => rtrim($value['Sys_rq']),
|
|
|
+ '更新时间' => rtrim($value['Mod_rq']),
|
|
|
+ 'Uniqid' => rtrim($value['Uniqid'])
|
|
|
+ ];
|
|
|
+
|
|
|
+ $number = \db('工单_工艺资料')->where('Gy0_gdbh',$data[$key]['工单编号'])->count();
|
|
|
+ if ($number === 0){
|
|
|
+ $data[$key]['status'] = '*';
|
|
|
+ }else{
|
|
|
+ $data[$key]['status'] = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->success('成功',['data'=>$data,'total'=>$total]);
|
|
|
+ }
|
|
|
}
|