|
|
@@ -3,7 +3,8 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
-
|
|
|
+use \think\Request;
|
|
|
+use \think\Db;
|
|
|
/**
|
|
|
* 其他计件单据维护接口
|
|
|
*/
|
|
|
@@ -78,6 +79,7 @@ class OtherCountDocument extends Api
|
|
|
* @ApiMethod (GET)
|
|
|
* @param string $date 时间
|
|
|
* @param string $Sczl_bh1 员工编号
|
|
|
+ * @param string $order 工单编号
|
|
|
*/
|
|
|
public function getList()
|
|
|
{
|
|
|
@@ -95,10 +97,12 @@ class OtherCountDocument extends Api
|
|
|
$where = [];
|
|
|
if (isset($req['date']) && !empty($req['date'])){
|
|
|
$where['Sczl_rq'] = ['LIKE',$req['date'].'%'];
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ if (!empty($req['order']) && (!empty($req['date']) || !empty($req['Sczl_bh1']))){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
if (isset($req['Sczl_bh1']) && !empty($req['Sczl_bh1'])) $where['Sczl_bh1'] = $req['Sczl_bh1'];
|
|
|
+ if (isset($req['order']) && !empty($req['order'])) $where['Sczl_gdbh'] = $req['order'];
|
|
|
|
|
|
$rows = db()->table('db_拉料计件')
|
|
|
->field('rtrim(sczl_Type) as sczl_Type, LEFT(Sczl_rq, 10) as Sczl_rq, Sczl_bh1, sczl_gdbh, CAST(Sczl_cl AS SIGNED) as Sczl_cl,
|
|
|
@@ -107,6 +111,7 @@ class OtherCountDocument extends Api
|
|
|
->page($page,$limit)
|
|
|
->order('Sczl_rq asc, UniqId asc')
|
|
|
->select();
|
|
|
+
|
|
|
$total = db()->table('db_拉料计件')->where($where)->count();
|
|
|
$gd = db()->table('工单_基本资料')->column('Gd_gdbh, Gd_cpmc');
|
|
|
$rs = db()->table('人事_基本资料')->column('员工编号, 员工姓名');
|
|
|
@@ -150,4 +155,54 @@ class OtherCountDocument extends Api
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 拉料计件产量维护修改
|
|
|
+ * @ApiMethod POST
|
|
|
+ * @params array data
|
|
|
+ */
|
|
|
+ public function edit(){
|
|
|
+ if (Request::instance()->isPost() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->post();
|
|
|
+ if (!isset($params) || !isset($params['UniqId'])){
|
|
|
+ $this->error('参数不能为空');
|
|
|
+ }
|
|
|
+ $uniqId = $params['UniqId'];
|
|
|
+ unset($params['UniqId']);
|
|
|
+ $sql = Db::name('db_拉料计件')->where('UniqId',$uniqId)->fetchSql(true)->update($params);
|
|
|
+ $res = Db::query($sql);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('更新成功');
|
|
|
+ }else{
|
|
|
+ $this->error('更新失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取拉料计件产量维护其他信息
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string Sczl_bh1
|
|
|
+ * @params string Sczl_gdbh
|
|
|
+ * @params string Sczl_dedh
|
|
|
+ */
|
|
|
+ public function getOtherInfo(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (empty($params['Sczl_bh1']) && empty($params['Sczl_gdbh']) && empty($params['Sczl_dedh']) ){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $data = [];
|
|
|
+ if (!empty($params['Sczl_bh1'])){
|
|
|
+ $data = Db::name('人事_基本资料')->where('员工编号',$params['Sczl_bh1'])->field('rtrim(员工姓名) as name')->find();
|
|
|
+ }
|
|
|
+ if (!empty($params['Sczl_gdbh'])){
|
|
|
+ $data = Db::name('工单_基本资料')->where('Gd_gdbh',$params['Sczl_gdbh'])->field('rtrim(成品名称) as name')->find();
|
|
|
+ }
|
|
|
+ if (!empty($params['Sczl_dedh'])){
|
|
|
+ $data = Db::name('dic_lzde')->where('sys_bh',$params['Sczl_dedh'])->field('rtrim(sys_mc) as name')->find();
|
|
|
+ }
|
|
|
+ $this->success('请求成功',$data);
|
|
|
+ }
|
|
|
}
|