|
@@ -4,7 +4,6 @@ namespace app\api\controller;
|
|
|
|
|
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
use think\Request;
|
|
use think\Request;
|
|
|
-use function fast\e;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 印版库管理
|
|
* 印版库管理
|
|
@@ -97,22 +96,27 @@ class PrintingPlate extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$param = $this->request->param();
|
|
$param = $this->request->param();
|
|
|
- if (empty($param) || !isset($param['code'])){
|
|
|
|
|
|
|
+ if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- //截取物料编码,带字母截取前七位,不带字母截取前五位
|
|
|
|
|
- if (preg_match('/[a-zA-Z]/', $param['code'])) {
|
|
|
|
|
|
|
+ if (isset($param['code']) && !empty($param['code'])){
|
|
|
|
|
+ //截取物料编码,带字母截取前七位,不带字母截取前五位
|
|
|
|
|
+ if (preg_match('/[a-zA-Z]/', $param['code'])) {
|
|
|
|
|
|
|
|
- $code = substr($param['code'], 0, 7);
|
|
|
|
|
- } else {
|
|
|
|
|
- $code = substr($param['code'], 0, 6);
|
|
|
|
|
|
|
+ $code = substr($param['code'], 0, 7);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $code = substr($param['code'], 0, 6);
|
|
|
|
|
+ }
|
|
|
|
|
+ $where['a.存货编码'] = ['like', $code . '%'];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($param['scarch']) && !empty($param['scarch'])){
|
|
|
|
|
+ $where['b.物料名称'] = ['like', '%' . $param['scarch'] . '%'];
|
|
|
}
|
|
}
|
|
|
//根据物料编码分类查询
|
|
//根据物料编码分类查询
|
|
|
$list = db('产品_印版库')
|
|
$list = db('产品_印版库')
|
|
|
->alias('a')
|
|
->alias('a')
|
|
|
->join('物料_存货编码 b', 'a.存货编码 = b.物料代码')
|
|
->join('物料_存货编码 b', 'a.存货编码 = b.物料代码')
|
|
|
->join('工单_印版领用记录 c', 'a.存货编码 = c.Yb_存货编码 AND a.供方批号 = c.Yb_供方批号', 'left')
|
|
->join('工单_印版领用记录 c', 'a.存货编码 = c.Yb_存货编码 AND a.供方批号 = c.Yb_供方批号', 'left')
|
|
|
- ->where('a.存货编码', 'like', $code . '%')
|
|
|
|
|
->group('a.存货编码, a.供方批号')
|
|
->group('a.存货编码, a.供方批号')
|
|
|
->order('报废日期, a.存货编码')
|
|
->order('报废日期, a.存货编码')
|
|
|
->field('
|
|
->field('
|
|
@@ -128,7 +132,7 @@ class PrintingPlate extends Api
|
|
|
a.原始印数,
|
|
a.原始印数,
|
|
|
a.考核印数,
|
|
a.考核印数,
|
|
|
a.UniqID,
|
|
a.UniqID,
|
|
|
- a.Sys_id as 创建用户,
|
|
|
|
|
|
|
+ rtrim(a.Sys_id) as 创建用户,
|
|
|
a.Sys_rq as 创建日期,
|
|
a.Sys_rq as 创建日期,
|
|
|
a.Mod_rq as 修改时间,
|
|
a.Mod_rq as 修改时间,
|
|
|
count(c.Yb_印数) as 累计印数
|
|
count(c.Yb_印数) as 累计印数
|
|
@@ -296,4 +300,72 @@ class PrintingPlate extends Api
|
|
|
$this->success('成功', $data);
|
|
$this->success('成功', $data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 印版领用
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function PrintingPlateReceive()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->request->isPost()) {
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = Request::instance()->post();
|
|
|
|
|
+ if (empty($param) || !isset($param['gdbh'])) {
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'Yb_工单编号' => $param['gdbh'],
|
|
|
|
|
+ 'Yb_印件号' => $param['yjno'],
|
|
|
|
|
+ 'Yb_存货编码' => $param['code'],
|
|
|
|
|
+ 'Yb_供方批号' => $param['batch'],
|
|
|
|
|
+ 'Yb_领用日期' => date('Y-m-d',time()),
|
|
|
|
|
+ 'Yb_领用机台' => $param['machine'],
|
|
|
|
|
+ 'Sys_id' => $param['sys_id'],
|
|
|
|
|
+ 'Sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ ];
|
|
|
|
|
+ $sql = db('工单_印版领用记录')
|
|
|
|
|
+ ->fetchSql(true)
|
|
|
|
|
+ ->insert($data);
|
|
|
|
|
+ $res = db('')->query($sql);
|
|
|
|
|
+ if ($res === false){
|
|
|
|
|
+ $this->error('领用失败');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->success('领用成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 印版工单领用
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function PrintDetailReceive()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->request->isGet()) {
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param) || !isset($param['code'])) {
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = db('工单_印版领用记录')
|
|
|
|
|
+ ->alias('a')
|
|
|
|
|
+ ->field('a.Yb_工单编号 as 工单编号,a.Yb_印件号 as 印件号,a.Yb_领用日期 as 领用日期,a.Yb_退还日期 as 退还日期,a.Yb_领用机台 as 领用机台,
|
|
|
|
|
+ a.Yb_印数 as 印数,a.Sys_id as 创建用户,a.Sys_rq as 创建时间,a.UniqID,b.成品代号,rtrim(b.成品名称) as 成品名称')
|
|
|
|
|
+ ->join('工单_基本资料 b', 'a.Yb_工单编号 = b.Gd_gdbh')
|
|
|
|
|
+ ->where('a.Yb_存货编码',$param['code'])
|
|
|
|
|
+ ->where('a.Yb_供方批号',$param['batch'])
|
|
|
|
|
+ ->order('a.Yb_领用日期 desc')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ if (empty($list)){
|
|
|
|
|
+ $this->error('未找到领用记录');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->success('成功', $list);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|