|
@@ -232,7 +232,7 @@ class Facility extends Api
|
|
|
if (empty($data)){
|
|
if (empty($data)){
|
|
|
$this->success('未找到生产订单');
|
|
$this->success('未找到生产订单');
|
|
|
}
|
|
}
|
|
|
- if (rtrim($data['工单编号']) === '' || rtrim($data['工单编号']) === null ){
|
|
|
|
|
|
|
+ if (empty($data['工单编号'])){
|
|
|
$this->success('未找到生产订单');
|
|
$this->success('未找到生产订单');
|
|
|
}
|
|
}
|
|
|
$endTime = \db('工单_工艺资料')
|
|
$endTime = \db('工单_工艺资料')
|
|
@@ -1972,4 +1972,141 @@ class Facility extends Api
|
|
|
$this->error('删除失败');
|
|
$this->error('删除失败');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 日产量上报添加
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function ChanliangAdd()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $params = Request::instance()->post();
|
|
|
|
|
+ if (empty($params['sczl_gdbh'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $lastId = \db('设备_产量计酬')->order('UniqId desc')->value('rtrim(UniqId)');
|
|
|
|
|
+ $params['sczl_type'] = $params['sczl_gxmc'];
|
|
|
|
|
+ $params['sczl_wgsj'] = '1900-01-01 00:00:00';
|
|
|
|
|
+ $params['sczl_废品率系数'] = 0;
|
|
|
|
|
+ $params['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
+ $params['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
+ $params['UniqId'] = $lastId + 1;
|
|
|
|
|
+ $sql = \db('设备_产量计酬')->fetchSql(true)->insert($params);
|
|
|
|
|
+ $res = \db()->query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 日产量上报添加获取工单信息
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function ChanliangWorkorder()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false)
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param['machine'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
+ ];
|
|
|
|
|
+ if (!empty($param['search'])){
|
|
|
|
|
+ $where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = \db('工单_基本资料')
|
|
|
|
|
+ ->alias('a')
|
|
|
|
|
+ ->field('rtrim(Gd_gdbh) as gdbh,rtrim(成品名称) as cpmc')
|
|
|
|
|
+ ->join('工单_工艺资料 b','a.Gd_gdbh = b.Gy0_gdbh')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->success('未找到相关工单');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 日产量上报工单印件资料
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function ChanliangPrintDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param['gdbh'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'Yj_Gdbh' => $param['gdbh']
|
|
|
|
|
+ ];
|
|
|
|
|
+ $list = \db('工单_印件资料')
|
|
|
|
|
+ ->where($where)
|
|
|
|
|
+ ->field('rtrim(yj_Yjno) as yjno,rtrim(yj_yjmc) as yjmc')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->success('未找到印件资料');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 日产量上报工艺资料获取
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function ChanliangProcessDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param['gdbh'])){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = \db('工单_工艺资料')
|
|
|
|
|
+ ->where('Gy0_gdbh',$param['gdbh'])
|
|
|
|
|
+ ->where('Gy0_yjno',$param['yjno'])
|
|
|
|
|
+ ->where('Gy0_sbbh','like','%'.$param['machine'].'%')
|
|
|
|
|
+ ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->success('未获取工序');
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ if ((int)$value['gxh'] < 10){
|
|
|
|
|
+ $value['gxh'] = '0'.$value['gxh'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($value['add_gxmc'])){
|
|
|
|
|
+ $list[$key]['name'] = $value['gxh'].'->'.$value['gxmc'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $list[$key]['name'] = $value['gxh'].'->'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
|
|
+ }
|
|
|
|
|
+ unset($list[$key]['gxmc'],$list[$key]['add_gxmc']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|