| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use \think\Request;
- use \think\Db;
- use think\Cache;
- use function fast\e;
- /**
- * 产品管理接口
- */
- class Product extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- /**
- * 首页
- *
- */
- public function index()
- {
- $this->success('请求成功');
- }
- /**
- * 获取产品资料
- *
- * @ApiMethod GET
- *@param string custom_code
- *@param string limit
- *@param string page
- */
- public function getProduct(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- $limit = $params['limit'];
- $yjno = 10;
- if (!isset($limit)){
- $limit = 15;
- }
- if (!isset($params['page'])){
- $pages = 0;
- }else{
- $pages = ((int)$params['page'] -1 ) * (int)$limit;
- }
- $total = 0;
- if (isset($params['custom_code']) && !empty($params['custom_code'])){
- $customCode = $params['custom_code'];
- $sql = "SELECT rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,客户料号,rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,版本号,成品规格,
- rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
- FROM `产品_基本资料` WHERE `客户编号` = '{$customCode}' ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END,
- `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
- $total = db('产品_基本资料')->where('客户编号',$customCode)->count();
- }else{
- if (isset($params['search']) && !empty($params['search'])){
- $search = $params['search'];
- $sql = "SELECT rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,客户料号,rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,版本号,成品规格,
- rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
- FROM `产品_基本资料` WHERE `产品名称` LIKE '%{$search}%' OR `产品编号` LIKE '%{$search}%' ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END,
- `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
- $total = db('产品_基本资料')->where('产品名称','like','%'.$search.'%')->count();
- }else{
- $sql = "SELECT rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,客户料号,rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,版本号,成品规格,
- rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
- FROM `产品_基本资料` ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END,
- `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
- $total = db('产品_基本资料')->count();
- }
- }
- $list = Db::query($sql);
- foreach ($list as $key=>$value){
- $code = trim($value['产品编号']);
- $gd_sql = "SELECT `接单日期` FROM `工单_基本资料` WHERE `成品代号` = '{$code}' ORDER BY Uniqid DESC";
- $gdRes = Db::query($gd_sql);
- $list[$key]['receiveDate'] = '';
- if (!empty($gdRes)){
- $list[$key]['receiveDate'] = $gdRes[0]['接单日期'];
- }
- if (isset($params['sort'])){
- $gy_sql = "SELECT * FROM `产品_工艺资料` WHERE Gy0_cpdh = '{$code}' AND Gy0_yjno >= '{$yjno}'";
- $gyRes = Db::query($gy_sql);
- }else{
- $gy_sql = "SELECT * FROM `产品_工艺资料` WHERE Gy0_cpdh = '{$code}'";
- $gyRes = Db::query($gy_sql);
- }
- $list[$key]['gyData'] = '';
- if (empty($gyRes)){
- $list[$key]['gyData'] = '缺';
- }
- if (isset($params['sort'])){
- $yj_sql = "SELECT COUNT(*) as total FROM `产品_印件资料` WHERE `yj_cpdh` = '{$code}' AND yj_yjno >= '{$yjno}'";
- $yjRes = Db::query($yj_sql);
- }else{
- $yj_sql = "SELECT COUNT(*) as total FROM `产品_印件资料` WHERE `yj_cpdh` = '{$code}'";
- $yjRes = Db::query($yj_sql);
- }
- $list[$key]['yjData'] = '无';
- if ($yjRes[0]['total'] > 0){
- $list[$key]['yjData'] = $yjRes[0]['total'];
- }
- }
- $data['data'] = $list;
- $data['total'] = $total;
- $this->success('请求成功',$data);
- }
- /**
- * 获取产品基础数据
- *
- * @ApiMethod POST
- *@param string product_code
- */
- public function getProductData(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- $code = $params['product_code'];
- if (!isset($code)){
- $this->error('参数不能为空');
- }
- if (isset($params['sort'])){
- $PriWhere['yj_yjno'] = ['>=',10];
- $proWhere['Gy0_yjno'] = ['>=',10];
- }else{
- $PriWhere['yj_yjno'] = ['<',10];
- $proWhere['Gy0_yjno'] = ['<',10];
- }
- $num = config('product_code_digit');
- //工艺资料
- $option['a.Gy0_cpdh'] = $code;
- $gy_field = 'rtrim(a.Gy0_方案) as 方案,a.Gy0_yjno,a.Gy0_gxh,rtrim(a.gy0_gxmc) as gy0_gxmc,rtrim(a.Add_gxmc) as add_gxmc,a.Gy0_Ks,a.Gy0_ls,rtrim(a.工序备注) as 备注,
- a.工价系数,a.损耗系数,a.Gy0_Ms,a.人工检_正品板,a.人工检_次品板,a.人工检_废检,a.机检_正品板,a.机检_次品板,a.机检_废检,rtrim(a.Gy0_sbmc) as Gy0_sbmc,rtrim(a.Sys_id) as Sys_id,
- a.Sys_rq,a.Mod_rq,b.sys_rate0 as 基础损耗,b.sys_rate1 as 损耗率,a.UniqID';
- $gyRes = db('产品_工艺资料')->alias('a')
- ->join('dic_lzsh b','a.Gy0_shdh = b.sys_bh','left')
- ->where($option)->where($proWhere)->field($gy_field)->order('a.Gy0_yjno asc,a.Gy0_gxh asc')->select();
- //印件资料
- $where['yj_cpdh'] = $code;
- $field = 'yj_yjno,rtrim(yj_yjdh) as yj_yjdh,yj_yjmc,rtrim(yj_zzdh) as yj_zzdh,rtrim(yj_zzmc) as yj_zzmc,rtrim(yj_tlgg) as yj_tlgg,
- rtrim(yj_klgg) as yj_klgg,yj_ks,yj_ls,rtrim(yj_desc) as yj_desc,rtrim(sys_id) as sys_id,sys_rq,mod_rq,UniqId';
- $yjRes = db('产品_印件资料')->where($where)->where($PriWhere)->field($field)->select();
- //印版资料
- $filter['a.YB_Cpdh'] = $code;
- $yb_field = 'rtrim(a.YB_方案) as YB_方案,a.YB_Yjno,rtrim(a.存货编码) as 存货编码,a.考核印数,rtrim(a.Sys_id) as Sys_id,a.Mod_rq,rtrim(b.物料名称) as 印版名称,rtrim(c.名称) as 印版类别,a.UniqID';
- $ybRes = db('产品_印版资料')->alias('a')
- ->join('物料_存货编码 b','a.存货编码 = b.物料代码','left')
- ->join('物料_存货结构 c','LEFT(a.存货编码,'.$num.') = c.编号','left')
- ->where($filter)->field($yb_field)->order('a.YB_Yjno,a.存货编码')->select();
- //技术附件
- $jsRes = db('产品_技术附件')
- ->where('关联产品','like','%'.$code.'%')
- ->select();
- foreach ($jsRes as $key=>&$value){
- if(mb_detect_encoding($value['附件内容'])!='ASCII'){
- $value['附件内容'] = '';
- }
- }
- $list = [];
- $list['yjData'] = $yjRes;
- $list['gyData'] = $gyRes;
- $list['ybData'] = $ybRes;
- $list['jsData'] = $jsRes;
- $this->success('请求成功',$list);
- }
- /**
- * 4.获取单个工艺数据(排产参数调整)
- *
- * @ApiMethod GET
- *@param string product_code
- */
- public function getProductGy(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- $code = $params['product_code'];
- if (!isset($code)){
- $this->error('参数不能为空');
- }
- $option['a.Gy0_cpdh'] = $code;
- if (!empty($params['plan'])){
- $option['a.Gy0_方案'] = $params['plan'];
- }
- $gy_field = 'rtrim(a.Gy0_方案) as programme,a.Gy0_yjno,a.Gy0_gxh,rtrim(a.gy0_gxmc) as gy0_gxmc,a.A类产能 as A_power,rtrim(a.Gy0_shdh) as Gy0_shdh,rtrim(a.Gy0_sbbh) as Gy0_sbbh,
- a.工价系数 as difficulty_coe,a.损耗系数 as loss_coe,a.Gy0_Ms as ms_coe,a.Gy0_Ks,a.Gy0_ls,rtrim(a.Gy0_site) as Gy0_site,rtrim(a.Add_gxmc) as Add_gxmc,a.UniqID,a.Gy0_辅助工时,
- rtrim(a.工序备注) as remark,a.人工检_正品板 as artificial_zp,a.人工检_次品板 as artificial_cp,a.人工检_废检 as artificial_fj,a.机检_正品板 as machine_zp,a.机检_次品板 as machine_cp,
- a.机检_废检 as machine_fj,rtrim(b.客户名称) as custom_name,rtrim(b.产品名称) as product_name,a.UniqId';
- $gyRes = db('产品_工艺资料')->alias('a')
- ->join('产品_基本资料 b','a.Gy0_cpdh = b.产品编号','left')
- ->where($option)->field($gy_field)->order('a.Gy0_yjno asc,a.Gy0_gxh asc')->select();
- $this->success('请求成功',$gyRes);
- }
- /**
- * 修改工艺参数
- *
- * @ApiMethod
- * @params array data
- */
- public function editGy(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (!isset($params) || !isset($params[0]['UniqID'])){
- $this->error('参数不能为空');
- }
- $i = 0;
- foreach ($params as $key=>$value){
- $data = [];
- if (!empty($value['A_power'])){
- $data['A类产能'] = $value['A_power'];
- }
- if (!empty($value['shdh'])){
- $data['Gy0_shdh'] = $value['shdh'];
- }
- if (!empty($value['machine'])){
- $data['Gy0_sbbh'] = $value['machine'];
- }
- if (!empty($value['time'])){
- $data['Gy0_辅助工时'] = $value['time'];
- }
- if (!empty($value['difficulty_coe'])){
- $data['工价系数'] = $value['difficulty_coe'];
- }
- if (!empty($value['loss_coe'])){
- $data['损耗系数'] = $value['loss_coe'];
- }
- if (!empty($value['ms_coe'])){
- $data['Gy0_Ms'] = $value['ms_coe'];
- }
- $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
- $res = Db::query($sql);
- if ($res !== false){
- $i++;
- }
- }
- if ($i !== 0){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 修改产品信息
- *
- * @ApiMethod POST
- *
- * @params object data
- */
- public function editProduct(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params)){
- $this->error('参数不能为空');
- }
- if (!isset($params['印品代号'])){
- $this->error('印品代号不能为空');
- }
- $code = $params['印品代号'];
- unset($params['印品代号']);
- $sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->update($params);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 设置产品状态
- *
- * @ApiMethod POST
- * @params string status
- * @params string code
- */
- public function setProductStatus(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params['code']) || empty($params['status'])){
- $this->error('参数不能为空');
- }
- $code = $params['code'];
- $status = '';
- if ($params['status'] == 2){
- $status = '停产';
- }
- $sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->setField('状态',$status);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 获取产品工艺数量
- *
- * @ApiMethod GET
- * @params string code
- */
- public function getGyTotal(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- $code = $params['code'];
- if (!isset($code)){
- $this->error('参数不能为空');
- }
- $res = db('产品_工艺资料')->where('Gy0_cpdh',$code)->distinct(true)->column('rtrim(Gy0_方案) as gy_plan');
- $data['gy'] = $res;
- $product = db('产品_基本资料')->where('产品编号',$code)->find();
- $data['name'] = rtrim($product['产品名称']);
- $this->success('请求成功',$data);
- }
- /**
- * 复制产品工艺信息
- *
- * @ApiMethod POST
- * @params string from_code
- * @params string from_pro
- * @params string to_code
- * @params string to_pro
- * @params int is_copy_gy
- */
- public function copyProductGy(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params['from_code']) || empty($params['from_pro']) || empty($params['to_code']) ){
- $this->error('参数不能为空');
- }
- if ($params['is_copy_gy'] == 1){
- if (empty($params['to_pro'])){
- $this->error('工艺方案不能为空');
- }
- //查出参考的工艺数据
- $where['Gy0_cpdh'] = $params['from_code'];
- $where['Gy0_方案'] = $params['from_pro'];
- $gyList = db('产品_工艺资料')->where($where)->select();
- if (empty($gyList)){
- $this->error('参考产品无工艺资料数据');
- }
- $UniqID = db('产品_工艺资料')->order('UniqID desc')->value('UniqID');
- foreach ($gyList as $key=>$value){
- unset($gyList[$key]['UniqID']);
- $UniqID ++;
- $gyList[$key]['Gy0_方案'] = $params['to_pro'];
- $gyList[$key]['Gy0_cpdh'] = $params['to_code'];
- $gyList[$key]['UniqID'] = $UniqID;
- }
- }
- if ($params['is_copy_yb'] == 1){
- $UniqId = db('产品_印版资料')->order('UniqID desc')->value('UniqID');
- $option['YB_Cpdh'] = $params['from_code'];
- $ybList = db('产品_印版资料')->where($option)->select();
- if (empty($ybList)){
- $this->error('参考产品无印版资料数据');
- }
- foreach ($ybList as $key=>$value){
- unset($ybList[$key]['UniqID']);
- $UniqId++;
- $ybList[$key]['YB_Cpdh'] = $params['to_code'];
- $ybList[$key]['UniqID'] = $UniqId;
- }
- }
- if ($params['is_copy_gy'] == 1 && $params['is_copy_yb'] == 1){
- $gyResult = db('产品_工艺资料')->insertAll($gyList);
- if (!$gyResult){
- $this->error('复制产品工艺资料数据失败');
- }
- $ybResult = db('产品_印版资料')->insertAll($ybList);
- if (!$ybResult){
- $this->error('复制产品印版资料数据失败');
- }
- }elseif ($params['is_copy_gy'] == 1 && $params['is_copy_yb'] == 0){
- $gyResult = db('产品_工艺资料')->insertAll($gyList);
- if (!$gyResult){
- $this->error('复制产品工艺资料数据失败');
- }
- }elseif ($params['is_copy_gy'] == 0 && $params['is_copy_yb'] == 1){
- $ybResult = db('产品_印版资料')->insertAll($ybList);
- if (!$ybResult){
- $this->error('复制产品印版资料数据失败');
- }
- }else{
- $this->success('工艺、印版至少选中一个');
- }
- $this->success('工艺复制成功');
- }
- /**
- * 工艺方案更名
- *
- * @ApiMethod POST
- * @params string code
- * @params string name
- */
- public function editGyName(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params['code']) || empty($params['old_name']) || empty($params['new_name'])){
- $this->error('参数不能为空');
- }
- $where['Gy0_cpdh'] = $params['code'];
- $where['Gy0_方案'] = $params['old_name'];
- $sql = db('产品_工艺资料')->where($where)->fetchSql(true)->setField('Gy0_方案',$params['new_name']);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 工艺方案附加
- *
- * @ApiMethod POST
- * @params object data
- */
- public function editGyNo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params) || !isset($params[0]['UniqID'])){
- $this->error('参数不能为空');
- }
- $i = 0;
- foreach ($params as $key=>$value){
- $data = [];
- if (!empty($value['Gy0_yjno'])){
- $data['Gy0_yjno'] = $value['Gy0_yjno'];
- }
- if (!empty($value['Gy0_gxh'])){
- $data['Gy0_gxh'] = $value['Gy0_gxh'];
- }
- if (!empty($value['Gy0_Ks'])){
- $data['Gy0_Ks'] = $value['Gy0_Ks'];
- }
- if (!empty($value['Gy0_ls'])){
- $data['Gy0_ls'] = $value['Gy0_ls'];
- }
- $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
- $res = Db::query($sql);
- if ($res !== false){
- $i++;
- }
- }
- if ($i !== 0){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 计损色数修正
- *
- * @ApiMethod POST
- * @params object data
- */
- public function editGyMs(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params) || !isset($params[0]['UniqID'])){
- $this->error('参数不能为空');
- }
- $i = 0;
- foreach ($params as $key=>$value){
- $data = [];
- if (!empty($value['Gy0_Ms'])){
- $data['Gy0_Ms'] = $value['Gy0_Ms'];
- }
- if (!empty($value['Gy0_Ks'])){
- $data['Gy0_Ks'] = $value['Gy0_Ks'];
- }
- if (!empty($value['Gy0_ls'])){
- $data['Gy0_ls'] = $value['Gy0_ls'];
- }
- $data['Add_gxmc'] = $value['Add_gxmc'];
- $data['工序备注'] = $value['remark'];
- $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
- $res = Db::query($sql);
- if ($res !== false){
- $i++;
- }
- }
- if ($i !== 0){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 产品质检废品系数调整
- *
- * @ApiMethod POST
- * @params object data
- */
- public function editGyWaste(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params) || !isset($params[0]['UniqID'])){
- $this->error('参数不能为空');
- }
- $i = 0;
- foreach ($params as $key=>$value){
- $data = [];
- if (!empty($value['artificial_zp'])){
- $data['人工检_正品板'] = $value['artificial_zp'];
- }
- if (!empty($value['artificial_cp'])){
- $data['人工检_次品板'] = $value['artificial_cp'];
- }
- if (!empty($value['artificial_fj'])){
- $data['人工检_废检'] = $value['artificial_fj'];
- }
- if (!empty($value['machine_zp'])){
- $data['机检_正品板'] = $value['machine_zp'];
- }
- if (!empty($value['machine_cp'])){
- $data['机检_次品板'] = $value['machine_cp'];
- }
- if (!empty($value['machine_fj'])){
- $data['机检_废检'] = $value['machine_fj'];
- }
- $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
- $res = Db::query($sql);
- if ($res !== false){
- $i++;
- }
- }
- if ($i !== 0){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 获取产品印件资料
- * @ApiMethod GET
- * @params string UniqId
- */
- public function getProductYjInfo(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- if (empty($params['UniqId']) || empty($params['UniqId'])){
- $this->error('参数错误');
- }
- $field = "yj_yjno,rtrim(yj_yjdh) as yj_yjdh,rtrim(yj_yjmc) as yj_yjmc,rtrim(yj_zzdh) as yj_zzdh,rtrim(yj_zzmc) as yj_zzmc,rtrim(yj_zzdh1) as yj_zzdh1,rtrim(yj_zzdh2) as yj_zzdh2,
- rtrim(yj_zzdh3) as yj_zzdh3,rtrim(yj_zzdh4) as yj_zzdh4,rtrim(yj_zzmc1) as yj_zzmc1,rtrim(yj_zzmc2) as yj_zzmc2,rtrim(yj_zzmc3) as yj_zzmc3,
- rtrim(yj_zzmc4) as yj_zzmc4,rtrim(yj_tlgg) as yj_tlgg,rtrim(yj_klgg) as yj_klgg,yj_ks,yj_ls,KgToPages,rtrim(yj_desc) as yj_desc,UniqId";
- $list = \db('产品_印件资料')->where('UniqId',$params['UniqId'])->field($field)->select();
- $this->success('请求成功',$list);
- }
- /**
- * 修改产品印件资料
- * @ApiMethod POST
- * @params array data
- */
- public function editProductYjInfo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params) || !isset($params['UniqId'])){
- $this->error('参数不能为空');
- }
- $UniqId = $params['UniqId'];
- unset($params['UniqId']);
- $res = \db('产品_印件资料')->where('UniqId',$UniqId)->update($params);
- if ($res !== false){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 新增产品印件资料
- * @ApiMethod POST
- * @params array data
- */
- public function addProductYjInfo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- $UniqId = \db('产品_印件资料')->order('UniqId desc')->value('UniqId');
- if ($UniqId < 2000000){
- $UniqId = 2000000;
- }else{
- $UniqId = $UniqId + 1;
- }
- $params['UniqId'] = $UniqId;
- $params['sys_rq'] = date('Y-m-d H:i:s');
- $res = \db('产品_印件资料')->insert($params);
- if ($res !== false){
- $this->success('新增成功');
- }else{
- $this->error('新增失败');
- }
- }
- /**
- * 获取印件代码及名称
- * @ApiMethod GET
- *
- */
- public function getProductYjList(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->get();
- $search = $params['search'];
- $num = config('product_code_digit');
- if (!empty($search)){
- $sql = "SELECT DISTINCT rtrim(a.`物料代码`) AS `物料代码`,rtrim(a.`物料名称`) AS `物料名称`,rtrim(b.`客户编号`) AS `客户编号`,rtrim(b.`客户名称`) AS `客户名称` FROM
- `物料_存货编码` a
- JOIN `产品_基本资料` b ON LEFT(a.`物料代码`,$num) = LEFT(b.`客户编号`,$num)
- WHERE (a.`物料名称` LIKE '%{$search}%' or a.物料代码 LIKE '%{$search}%')
- ORDER BY a.`物料代码` ASC";
- }else{
- $sql = "SELECT DISTINCT rtrim(a.`物料代码`) as `物料代码`, rtrim(a.`物料名称`) as `物料名称`,rtrim(b.客户编号) as 客户编号,rtrim(b.客户名称) as 客户名称
- FROM `物料_存货编码` a
- JOIN `产品_基本资料` b ON LEFT(a.`物料代码`,$num) = LEFT(b.`客户编号`,$num)
-
- ORDER BY a.`物料代码` ASC";
- }
- $data = Db::query($sql);
- // 初始化一个关联数组,用于存储相同客户编号的数据
- $groupedData = [];
- foreach ($data as $row) {
- $customerCode = substr($row['物料代码'],0,$num).substr($row['客户编号'],2,2).'/'.$row['客户名称'];
- $materialCodePrefix = substr($row['物料代码'], 0, $num);
- if ($materialCodePrefix == 'Y1401' ){
- $materialCodePrefix = $materialCodePrefix.'/糊盒类产品(含贴码)';
- }else{
- $materialCodePrefix = $materialCodePrefix.'/直接领用产品';
- }
- // 如果关联数组中不存在该物料代码前四位的键,则创建一个空数组
- if (!isset($groupedData[$materialCodePrefix])) {
- $groupedData[$materialCodePrefix] = [];
- }
- // 如果物料代码前四位数组中不存在该客户编号的键,则创建一个空数组
- if (!isset($groupedData[$materialCodePrefix][$customerCode])) {
- $groupedData[$materialCodePrefix][$customerCode] = [];
- }
- // 去除客户编号和客户名称
- unset($row['客户编号']);
- unset($row['客户名称']);
- // 将当前行的数据添加到相应的物料代码前四位和客户编号的数组中
- $groupedData[$materialCodePrefix][$customerCode][] = $row;
- }
- $this->success('请求成功',$groupedData);
- }
- /**
- * 获取纸张代号及名称
- * @ApiMethod GET
- * @params string search
- */
- public function getProductZzList(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->get();
- $search = $params['search'];
- $num = config('product_code_digit');
- if (!empty($search)){
- $sql = "SELECT rtrim(a.`物料代码`) as 物料代码,rtrim(a.`物料名称`) as 物料名称,rtrim(a.`规格`) as 规格,rtrim(b.编号) as oneCode,rtrim(b.名称) as oneName,
- rtrim(c.`编号`) as twoCode,rtrim(c.`名称`) as twoName,rtrim(d.`编号`) as thrCode,rtrim(d.`名称`) as thrName
- FROM `物料_存货编码` a
- LEFT JOIN `物料_存货结构` b ON LEFT(a.物料代码,$num-2) = b.编号
- LEFT JOIN `物料_存货结构` c ON LEFT(a.物料代码,$num) = c.编号
- LEFT JOIN `物料_存货结构` d ON LEFT(a.物料代码,$num+2) = d.编号
- WHERE (a.物料名称 LIKE '%{$search}%' or a.物料代码 LIKE '%{$search}%') and
- (a.物料代码 LIKE 'Y00%' or a.物料代码 LIKE 'Y01%' or a.物料代码 LIKE 'Y04%' or a.物料代码 LIKE 'J03%' or a.物料代码 LIKE 'Y14%')";
- $data = Db::query($sql);
- }else{
- $sql = "SELECT rtrim(a.`物料代码`) as 物料代码,rtrim(a.`物料名称`) as 物料名称,rtrim(a.`规格`) as 规格,rtrim(b.编号) as oneCode,rtrim(b.名称) as oneName,
- rtrim(c.`编号`) as twoCode,rtrim(c.`名称`) as twoName,rtrim(d.`编号`) as thrCode,rtrim(d.`名称`) as thrName
- FROM `物料_存货编码` a
- LEFT JOIN `物料_存货结构` b ON LEFT(a.物料代码,$num-2) = b.编号
- LEFT JOIN `物料_存货结构` c ON LEFT(a.物料代码,$num) = c.编号
- LEFT JOIN `物料_存货结构` d ON LEFT(a.物料代码,$num+2) = d.编号
- WHERE a.物料代码 LIKE 'Y00%' or a.物料代码 LIKE 'Y01%' or a.物料代码 LIKE 'Y04%' or a.物料代码 LIKE 'J03%' or a.物料代码 LIKE 'Y14%'";
- $data = Db::query($sql);
- }
- $mergedArray = [];
- foreach ($data as $item) {
- $oneCode = $item['oneCode'];
- $twoCode = $item['twoCode'];
- $thrCode = $item['thrCode'];
- $oneName = $item['oneName'];
- $twoName = $item['twoName'];
- $thrName = $item['thrName'];
- // Create a unique key using the combination of oneCode, twoCode, and thrCode
- $oneKey = "{$oneCode}/{$oneName}";
- $twoKey = "{$twoCode}/{$twoName}";
- $thrKey = "{$thrCode}/{$thrName}";
- // Initialize arrays if not already set
- if (!isset($mergedArray[$oneKey])) {
- $mergedArray[$oneKey] = [];
- }
- if (!isset($mergedArray[$oneKey][$twoKey])) {
- $mergedArray[$oneKey][$twoKey] = [];
- }
- // Append items to the arrays
- $mergedArray[$oneKey][$twoKey][$thrKey][] = $item;
- }
- $this->success('请求成功',$mergedArray);
- }
- /**
- *3.6工艺资料-获取产品工艺资料
- */
- public function getProductGyInfo(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- if (empty($params['UniqID']) || empty($params['UniqID'])){
- $this->error('参数错误');
- }
- $field = "rtrim(a.Gy0_方案) as Gy0_方案,a.Gy0_yjno,a.Gy0_gxh,a.Gy0_Ks,a.Gy0_ls,rtrim(a.Gy0_site) as Gy0_site,rtrim(a.gy0_gxmc) as gy0_gxmc,rtrim(a.Add_gxmc) as Add_gxmc,a.Gy0_Ms,
- rtrim(a.Gy0_sbbh) as Gy0_sbbh,rtrim(a.Gy0_shdh) as Gy0_shdh,rtrim(b.sys_mc) as sys_mc,b.sys_rate0,b.sys_rate1,a.工价系数,a.损耗系数,rtrim(a.工序备注) as 工序备注,
- rtrim(a.质量要求) as 质量要求,rtrim(a.质量隐患) as 质量隐患,a.UniqID";
- $data = \db('产品_工艺资料')->alias('a')
- ->join('dic_lzsh b','a.Gy0_shdh = b.sys_bh','left')
- ->where('a.UniqID',$params['UniqID'])
- ->field($field)
- ->find();
- $this->success('请求成功',$data);
- }
- /**
- * 3.7工艺资料-获取车间及工艺名称
- * @ApiMethod GET
- *
- */
- public function getDepartName(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $param = $this->request->param();
- $data = \db('erp_常用字典')->where('分类','印刷工艺')->order('编号 asc')->column('名称');
- $resultArray = [];
- foreach ($data as $item) {
- $parts = explode('_', $item);
- // 使用第一个部分作为一级键,第二个部分作为二级键
- $firstKey = $parts[0];
- $secondKey = $parts[1];
- $thirdValue = $parts[2];
- $resultArray[$firstKey][$secondKey][] = $thirdValue;
- }
- if (isset($param['sort'])){
- $result['标准工艺']['智能车间'] = $resultArray['标准工艺']['智能车间'];
- }else{
- unset($resultArray['标准工艺']['智能车间']);
- $result = $resultArray;
- }
- $this->success('请求成功',$result);
- }
- /**
- * 3.8工艺资料-新增产品工艺
- */
- public function addProductGyInfo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- $UniqId = \db('产品_工艺资料')->order('UniqID desc')->value('UniqID');
- if ($UniqId < 2000000){
- $UniqId = 2000000;
- }else{
- $UniqId = $UniqId + 1;
- }
- $params['UniqID'] = $UniqId;
- $params['Sys_rq'] = date('Y-m-d H:i:s');
- $sql = \db('产品_工艺资料')->fetchSql(true)->insert($params);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('新增成功');
- }else{
- $this->error('新增失败');
- }
- }
- /**
- * 3.9印版资料-获取产品印版资料
- * @ApiMethod GET
- */
- public function getProductYbInfo(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- if (empty($params['UniqID']) || empty($params['UniqID'])){
- $this->error('参数错误');
- }
- $field = "rtrim(a.YB_方案) as YB_方案,a.YB_Yjno,a.YB_gxh,rtrim(a.存货编码) as 存货编码,rtrim(a.印版名称) as 印版名称,a.UniqID,rtrim(b.gy0_gxmc) as gy0_gxmc,
- rtrim(b.Add_gxmc) as Add_gxmc,rtrim(c.物料名称) as 物料名称,rtrim(a.YB_cpdh) as YB_cpdh";
- $data = \db('产品_印版资料')->alias('a')
- ->join('产品_工艺资料 b','a.YB_cpdh = b.Gy0_cpdh and a.YB_Yjno = b.Gy0_yjno and a.YB_gxh = b.Gy0_gxh','left')
- ->join('物料_存货编码 c','a.存货编码 = c.物料代码','left')
- ->where('a.UniqID',$params['UniqID'])->field($field)->order('存货编码')->find();
- if (empty($data)){
- $this->error('未查询到产品印版资料');
- }
- $where['Gy0_site'] = [
- ['like','胶印%'],
- ['like','烫模%'],
- 'or'
- ];
- $option['Gy0_cpdh'] = $data['YB_cpdh'];
- $option['Gy0_gxh'] = ['<',10];
- $option['Gy0_sbbh'] = ['neq',''];
- $gyData = \db('产品_工艺资料')->where($option)->where($where)
- ->field('rtrim(Gy0_方案) as Gy0_方案,Gy0_yjno,Gy0_gxh,rtrim(gy0_gxmc) as gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')
- ->order('Gy0_yjno,Gy0_gxh')->select();
- $list = [];
- foreach ($gyData as $key=>$value){
- $yjno = $value['Gy0_yjno'] > 10 ? $value['Gy0_yjno'] : '0'.$value['Gy0_yjno'];
- $gxh = $value['Gy0_gxh'] > 10 ? $value['Gy0_gxh'] : '0'.$value['Gy0_gxh'];
- $list[$key]['gy'] = $value['Gy0_方案'].'-->'.$yjno.'-'.$gxh.' '.$value['gy0_gxmc'];
- $list[$key]['gxmc'] = $value['Add_gxmc'];
- }
- $data['gy_data'] = $list;
- $this->success('请求成功',$data);
- }
- /**
- * 3.10印版资料-修改产品印版资料
- * @ApiMethod POST
- * @params string UniqId
- */
- public function editProductYbInfo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params) || !isset($params['UniqId'])){
- $this->error('参数不能为空');
- }
- $UniqId = $params['UniqId'];
- unset($params['UniqId']);
- $sql = \db('产品_印版资料')->where('UniqId',$UniqId)->fetchSql(true)->update($params);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('更新成功');
- }else{
- $this->error('更新失败');
- }
- }
- /**
- * 印版资料-获取物料名称
- * @ApiMethod GET
- *
- */
- public function getProductYbMaterialList(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $sql = "SELECT rtrim(`编号`) as 编号, rtrim(`名称`) as 名称 FROM `物料_存货结构` WHERE `编号` IN ('0502','0503','0510','0511','0512','0513','0514','0520','0521','0523','0524','0525')";
- $data = Db::query($sql);
- $this->success('请求成功',$data);
- }
- /**
- *3.12印版资料-获取详细存货名称
- * @ApiMethod GET
- * @params string code
- */
- public function getProductYbMaterialDetail(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->get();
- if (empty($params) || !isset($params['code'])){
- $this->error('参数不能为空');
- }
- $code = $params['code'];
- $search = $params['search'];
- $num = config('product_code_digit');
- if (!empty($search)){
- $sql = "SELECT rtrim(a.`物料代码`) as 物料代码,rtrim(a.`物料名称`) as 物料名称,rtrim(a.`规格`) as 规格,
- rtrim(c.`编号`) as twoCode,rtrim(c.`名称`) as twoName,rtrim(d.`编号`) as thrCode,rtrim(d.`名称`) as thrName
- FROM `物料_存货编码` a
- LEFT JOIN `物料_存货结构` c ON LEFT(a.物料代码,$num) = c.编号
- LEFT JOIN `物料_存货结构` d ON LEFT(a.物料代码,$num+2) = d.编号
- WHERE a.物料代码 LIKE '{$code}%' AND a.物料名称 LIKE '%{$search}%'";
- }else{
- $sql = "SELECT rtrim(a.`物料代码`) as 物料代码,rtrim(a.`物料名称`) as 物料名称,rtrim(a.`规格`) as 规格,
- rtrim(c.`编号`) as twoCode,rtrim(c.`名称`) as twoName,rtrim(d.`编号`) as thrCode,rtrim(d.`名称`) as thrName
- FROM `物料_存货编码` a
- LEFT JOIN `物料_存货结构` c ON LEFT(a.物料代码,$num) = c.编号
- LEFT JOIN `物料_存货结构` d ON LEFT(a.物料代码,$num+2) = d.编号
- WHERE a.物料代码 LIKE '{$code}%'";
- }
- $data = Db::query($sql);
- $mergedArray = [];
- foreach ($data as $item) {
- $oneCode = '05';
- $twoCode = $item['twoCode'];
- $thrCode = $item['thrCode'];
- $oneName = '版材';
- $twoName = $item['twoName'];
- $thrName = $item['thrName'];
- $oneKey = "{$oneCode}/{$oneName}";
- $twoKey = "{$twoCode}/{$twoName}";
- $thrKey = "{$thrCode}/{$thrName}";
- if (!isset($mergedArray[$oneKey])) {
- $mergedArray[$oneKey] = [];
- }
- if (!isset($mergedArray[$oneKey][$twoKey])) {
- $mergedArray[$oneKey][$twoKey] = [];
- }
- $mergedArray[$oneKey][$twoKey][$thrKey][] = $item;
- }
- $this->success('请求成功',$mergedArray);
- }
- /**
- * 3.13印版资料-新增产品印版资料
- * @ApiMethod POST
- * @params array data
- */
- public function addProductYbInfo(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- $UniqId = \db('产品_印版资料')->order('UniqID desc')->value('UniqID');
- if ($UniqId < 2000000){
- $UniqId = 2000000;
- }else{
- $UniqId = $UniqId + 1;
- }
- $params['UniqID'] = $UniqId;
- $params['考核印数'] = '0.00';
- $params['Sys_rq'] = date('Y-m-d H:i:s');
- $sql = \db('产品_印版资料')->fetchSql(true)->insert($params);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('新增成功');
- }else{
- $this->error('新增失败');
- }
- }
- /**
- * 3.14工艺资料-获取损耗代号
- * @ApiMethod GET
- * @params code
- */
- public function getLossCode(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->get();
- if (empty($params) || !isset($params['code'])){
- $this->error('参数不能为空');
- }
- $code = $params['code'];
- $where['sys_bh|sys_mc'] = array('like','%'.$code.'%');
- $data = \db('dic_lzsh')
- ->where($where)
- ->field('rtrim(sys_bh) as sys_bh, rtrim(sys_mc) as sys_mc,sys_rate0,sys_rate1')
- ->select();
- $this->success('请求成功',$data);
- }
- /**
- * 产品工艺资料删除
- * @return void
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function ProcessDetailDel()
- {
- if ($this->request->isGet() === false) {
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (isset($param['UniqId']) === false) {
- $this->error('参数错误');
- }
- $printId = explode(',', $param['UniqId']);
- $res = \db('产品_工艺资料')->where('UniqID','in',$printId)->delete();
- if ($res){
- $this->success('删除成功');
- }else{
- $this->error('删除失败');
- }
- }
- /**
- * 产品印件资料删除
- * @return void
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function PrintDetailDel()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (isset($param['UniqId']) === false){
- $this->error('参数错误');
- }
- $printId = explode(',',$param['UniqId']);
- $res = \db('产品_印件资料')->where('UniqID','in',$printId)->delete();
- if ($res){
- $this->success('删除成功');
- }else{
- $this->error('删除失败');
- }
- }
- /**
- * 新增产品
- * @ApiMethod POST
- *
- */
- public function addProduct(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params)){
- $this->error('参数不能为空');
- }
- $uniqId = \db('产品_基本资料')->order('UniqID desc')->value('UniqID');
- if (empty($uniqId)){
- $params['UniqID'] = 1;
- }else{
- $params['UniqID'] = $uniqId + 1;
- }
- $params['Sys_rq'] = date('Y-m-d H:i:s');
- $sql = \db('产品_基本资料')->fetchSql(true)->insert($params);
- $res = Db::query($sql);
- if ($res !== false){
- $this->success('新增成功');
- }else{
- $this->error('新增失败');
- }
- }
- /**
- * 产品资料删除
- * @return void
- * @throws \think\exception\PDOException
- */
- public function ProductDel()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (isset($param['UniqId']) === false){
- $this->error('参数错误');
- }
- $WorkOrderId = explode(',',$param['UniqId']);
- $i = 0;
- foreach ($WorkOrderId as $key=>$value){
- //获取产品编号
- $product = \db('产品_基本资料')
- ->where('UniqID',$value)
- ->value('rtrim(产品编号)');
- //删除工单资料、工艺资料、印件资料
- \db()->startTrans();
- try {
- \db('产品_基本资料')->where('UniqID',$value)->delete();
- if (!empty(\db('产品_工艺资料')->where('Gy0_cpdh',$product)->find())){
- \db('产品_工艺资料')->where('Gy0_cpdh',$product)->delete();
- }
- if (!empty(\db('产品_印件资料')->where('yj_cpdh',$product)->find())){
- \db('产品_印件资料')->where('yj_cpdh',$product)->delete();
- }
- \db()->commit();
- }catch (\Exception $e){
- \db()->rollback();
- $i++;
- }
- }
- if ($i === 0){
- $this->success('删除成功');
- }else{
- $this->error('删除失败');
- }
- }
- /**
- * 修改产品工艺资料
- * @ApiMethod POST
- *
- */
- public function productEdit(){
- if (Request::instance()->isPost() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->post();
- if (empty($params)){
- $this->error('参数不能为空');
- }
- $UniqId = $params['UniqID'];
- unset($params['UniqID']);
- $params['Mod_rq'] = date('Y-m-d H:i:s');
- $sql = \db('产品_工艺资料')->where('UniqID',$UniqId)->fetchSql(true)->update($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 getCouplet()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param['product']) || empty($param['yjno'])){
- $this->error('参数错误');
- }
- $list = \db('产品_印件资料')
- ->where('yj_cpdh',$param['product'])
- ->where('yj_yjno',$param['yjno'])
- ->field('rtrim(yj_ks) as 开数,rtrim(yj_ls) as 联数')
- ->find();
- $process = \db('产品_工艺资料')
- ->where('Gy0_cpdh',$param['product'])
- ->where('Gy0_yjno',$param['yjno'])
- ->order('Gy0_gxh desc')
- ->value('Gy0_gxh');
- $list['工序号'] = $process + 1;
- $this->success('成功',$list);
- }
- }
|