|
|
@@ -1957,4 +1957,119 @@ class WorkOrder extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 引用产品印件、工艺资料
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
+ */
|
|
|
+ public function WorkOrderDetailListCope()
|
|
|
+ {
|
|
|
+ if (Request::instance()->isPost() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = Request::instance()->post();
|
|
|
+ if (empty($param['workorder']) || empty($param['productCode']) || empty($param['option'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ //引用印件资料
|
|
|
+ $processWhere = [
|
|
|
+ 'Gy0_方案' => $param['option'],
|
|
|
+ 'Gy0_cpdh' => $param['productCode']
|
|
|
+ ];
|
|
|
+ $ProcessList = \db('产品_工艺资料')
|
|
|
+ ->where($processWhere)
|
|
|
+ ->select();
|
|
|
+ if (empty($ProcessList)){
|
|
|
+ $this->error('未找到产品工艺资料');
|
|
|
+ }
|
|
|
+ $ProcesslastId = \db('工单_工艺资料')->order('UniqId desc')->value('rtrim(UniqId)');
|
|
|
+ foreach ($ProcessList as $key=>$value){
|
|
|
+ $ProcessList[$key]['Gy0_gdbh'] = $param['workorder'];
|
|
|
+ $ProcessList[$key]['Gy0_gxmc'] = $value['gy0_gxmc'];
|
|
|
+ $ProcessList[$key]['Gy0_SITE'] = $value['Gy0_site'];
|
|
|
+ $ProcessList[$key]['Gy0_ks'] = $value['Gy0_Ks'];
|
|
|
+ $ProcessList[$key]['Gy0_ms'] = $value['Gy0_Ms'];
|
|
|
+ $ProcessList[$key]['Gy0_oil'] = $value['Gy0_Oil'];
|
|
|
+ $ProcessList[$key]['UniqId'] = $ProcesslastId + $key + 1;
|
|
|
+ $ProcessList[$key]['PD_WG'] = '1900-01-01 00:00:00';
|
|
|
+ $ProcessList[$key]['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ $ProcessList[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ unset($ProcessList[$key]['Gy0_Oil'],$ProcessList[$key]['Gy0_Ms'],$ProcessList[$key]['Gy0_Ks'],$ProcessList[$key]['UniqID'],$ProcessList[$key]['Gy0_cpdh'],$ProcessList[$key]['gy0_gxmc'],$ProcessList[$key]['Gy0_site']);
|
|
|
+ }
|
|
|
+ //引用印件资料
|
|
|
+ $PrintList = \db('产品_印件资料')
|
|
|
+ ->where('yj_cpdh',$param['productCode'])
|
|
|
+ ->select();
|
|
|
+ if (empty($PrintList)){
|
|
|
+ $this->error('未找到印件资料');
|
|
|
+ }
|
|
|
+ $PrintLastId = \db('工单_印件资料')->order('Uniqid desc')->value('rtrim(Uniqid)');
|
|
|
+ foreach ($PrintList as $key => $value){
|
|
|
+ $PrintList[$key]['Yj_Gdbh'] = $param['workorder'];
|
|
|
+ $PrintList[$key]['yj_Yjno'] = $value['yj_yjno'];
|
|
|
+ $PrintList[$key]['yj_Yjdh'] = $value['yj_yjdh'];
|
|
|
+ $PrintList[$key]['Sys_id'] = $value['sys_id'];
|
|
|
+ $PrintList[$key]['Uniqid'] = $PrintLastId + $key + 1;
|
|
|
+ $PrintList[$key]['Sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ $PrintList[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
+ unset($PrintList[$key]['mod_rq'],$PrintList[$key]['sys_rq'],$PrintList[$key]['sys_id'],$PrintList[$key]['KgToPages'],$PrintList[$key]['yj_tll'],$PrintList[$key]['yj_yjdh'],$PrintList[$key]['yj_yjno'],$PrintList[$key]['UniqId']);
|
|
|
+ }
|
|
|
+ //插入数据
|
|
|
+ $processSql = \db('工单_工艺资料')->fetchSql(true)->insertAll($ProcessList);
|
|
|
+ $processRes = \db()->query($processSql);
|
|
|
+ if ($processRes === false){
|
|
|
+ $this->error('插入工艺资料失败');
|
|
|
+ }
|
|
|
+ $printSql = \db('工单_印件资料')->fetchSql(true)->insertAll($PrintList);
|
|
|
+ $printRes = \db()->query($printSql);
|
|
|
+ if ($printRes === false){
|
|
|
+ $this->error('插入印件资料失败');
|
|
|
+ }
|
|
|
+ $this->success('成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 引用产品印件、工艺资料->信息获取
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
+ public function ProductCopeDetail()
|
|
|
+ {
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
+ $this->error('请求错误');
|
|
|
+ }
|
|
|
+ $param = $this->request->param();
|
|
|
+ if (empty($param['workorder'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $list = \db('工单_基本资料')
|
|
|
+ ->alias('a')
|
|
|
+ ->field([
|
|
|
+ 'rtrim(a.Gd_gdbh)' => '工单编号',
|
|
|
+ 'rtrim(b.客户编号)' => '客户编号',
|
|
|
+ 'rtrim(b.客户名称)' => '客户名称',
|
|
|
+ 'rtrim(b.产品编号)' => '产品编号',
|
|
|
+ 'rtrim(b.产品名称)' => '产品名称'
|
|
|
+ ])
|
|
|
+ ->join('产品_基本资料 b','a.成品代号 = b.产品编号')
|
|
|
+ ->where('a.Gd_gdbh',$param['workorder'])
|
|
|
+ ->find();
|
|
|
+ if (empty($list)){
|
|
|
+ $this->error('未找到工单信息');
|
|
|
+ }
|
|
|
+ $option = \db('产品_工艺资料')
|
|
|
+ ->field('rtrim(Gy0_方案) as 方案')
|
|
|
+ ->where('Gy0_cpdh',$list['产品编号'])
|
|
|
+ ->group('Gy0_方案')
|
|
|
+ ->select();
|
|
|
+ $list['方案'] = $option;
|
|
|
+ $this->success('成功',$list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|