Facility.php 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. use think\Request;
  6. /**
  7. * 设备运行跟踪
  8. */
  9. class Facility extends Api
  10. {
  11. protected $noNeedLogin = ['*'];
  12. protected $noNeedRight = ['*'];
  13. /**
  14. * 左侧菜单栏
  15. * @ApiMethod (GET)
  16. * @return void
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\ModelNotFoundException
  19. * @throws \think\exception\DbException
  20. */
  21. public function getTab()
  22. {
  23. if ($this->request->isGet() === false){
  24. $this->error('请求错误');
  25. }
  26. $param = $this->request->param();
  27. if (isset($param['sort'])){
  28. $where['使用部门'] = '智能车间';
  29. }else{
  30. $where['使用部门'] = ['<>','智能车间'];
  31. }
  32. $data = [];
  33. $date = date('Y-m-d 00:00:00',time()-3888000);
  34. $department = \db('设备_基本资料')
  35. ->distinct(true)
  36. ->where('使用部门','<>','研发中心')
  37. ->where('设备编组','<>','')
  38. ->where($where)
  39. ->order('设备编组')
  40. ->column('rtrim(使用部门) as 使用部门');
  41. if (empty($department)){
  42. $this->success('为获取到机台数据');
  43. }
  44. $list = \db('设备_产量计酬')
  45. ->field([
  46. 'DISTINCT(sczl_rq)' => '时间',
  47. 'rtrim(sczl_jtbh)' => '机台编号'
  48. ])
  49. ->where('sczl_rq','>',$date)
  50. ->order('sczl_rq desc')
  51. ->select();
  52. if (empty($list)){
  53. $this->success('未找到机台生产记录');
  54. }
  55. foreach ($department as $value){
  56. $machine = \db('设备_基本资料')->where('使用部门',$value)->where('sys_sbID','<>','')->where('使用部门',$value)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->select();
  57. foreach ($machine as $k=>$v){
  58. $data[rtrim($value)][$v['设备编号'].'-->'.$v['设备名称']] = [];
  59. foreach ($list as $kk=>$vv){
  60. if ($v['设备编号'] === $vv['机台编号']){
  61. array_push($data[rtrim($value)][$v['设备编号'].'-->'.$v['设备名称']],date('Y-m-d',strtotime($vv['时间'])));
  62. }
  63. }
  64. }
  65. }
  66. $this->success('成功',$data);
  67. }
  68. /**
  69. * 机台每日产量
  70. * @ApiMethod (GET)
  71. * @param string $machine 机台编号
  72. * @param string $date 日期
  73. * @return void
  74. * @throws \think\db\exception\DataNotFoundException
  75. * @throws \think\db\exception\ModelNotFoundException
  76. * @throws \think\exception\DbException
  77. */
  78. public function chanLiang()
  79. {
  80. if ($this->request->isGet() === false){
  81. $this->error('请求错误');
  82. }
  83. $machine = input('machine');
  84. $date = input('date');
  85. $where = [
  86. 'sczl_jtbh' => $machine,
  87. 'sczl_rq' => date('Y-m-d H:i:s',strtotime($date.' 00:00:00')),
  88. ];
  89. $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_dedh) as dedh,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxh) as gxh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as num,rtrim(sczl_sj1) as sj1,
  90. rtrim(sczl_sj2) as sj2,rtrim(sczl_cl) as 产量,rtrim(sczl_bzdh) as bzdh,IF(sczl_zcfp = 0, "",sczl_zcfp) as 制程废品,IF(sczl_zccp = 0, "",sczl_zccp) as 制程次品,IF(sczl_前工序废 = 0, "",sczl_前工序废) as 前工序废,IF(sczl_来料少数 = 0, "",sczl_来料少数) as 来料异常,
  91. IF(sczl_装版工时 = 0, "",sczl_装版工时) as 装版工时, IF(sczl_保养工时 = 0, "",sczl_保养工时) as 保养工时,IF(sczl_打样工时 = 0, "",sczl_打样工时) as 打样工时,IF(sczl_异常停机工时 = 0, "",sczl_异常停机工时) as 异常总工时,IF(sczl_设备运行工时 = 0, "",sczl_设备运行工时) as 通电工时,
  92. IF(码开始行 = 0, "",码开始行) as 码开始行,IF(码结束行 = 0, "",码结束行) as 码结束行,IF(码包 = 0, "",码包) as 码包,IF(主电表 = 0, "",主电表) as 主电表,IF(辅电表 = 0, "",辅电表) as 辅电表,IF(sczl_ms = 0, "",sczl_ms) as 色度数,
  93. rtrim(sys_id) as 用户,rtrim(sys_rq) as 更新时间,IF(sczl_异常工时1 = 0, "",sczl_异常工时1) as 异常补时,IF(sczl_异常类型1 = 0, "",sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,
  94. sczl_bh3,sczl_bh4,sczl_bh5,sczl_bh6,sczl_bh7,sczl_bh8,sczl_bh9,sczl_bh10,sczl_rate1,sczl_rate2,sczl_rate3,sczl_rate4,sczl_rate5,sczl_rate6,sczl_rate7,
  95. sczl_rate8,sczl_rate9,sczl_rate10,sczl_bh98,rtrim(UniqId) as UniqId,rtrim(sczl_工价系数) as 难度系数,rtrim(sczl_dedh) as 定额代号';
  96. //机台信息
  97. $machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
  98. //组员信息
  99. $list = \db('设备_产量计酬')->where($where)->field($field)->select();
  100. $totalA = \db('设备_产量计酬')
  101. ->where($where)
  102. ->where('sczl_bzdh','like','A%')
  103. ->field('SUM(sczl_cl) as 产量, SUM(sczl_zcfp) as 制程废品, SUM(sczl_zccp) as 制程次品, SUM(sczl_来料少数) as 来料异常, SUM(sczl_装版工时) as 装版工时')
  104. ->select();
  105. $totalB = \db('设备_产量计酬')
  106. ->where($where)
  107. ->where('sczl_bzdh','like','B%')
  108. ->field('SUM(sczl_cl) as 产量, SUM(sczl_zcfp) as 制程废品, SUM(sczl_zccp) as 制程次品, SUM(sczl_来料少数) as 来料异常, SUM(sczl_装版工时) as 装版工时')
  109. ->select();
  110. if (empty($list)){
  111. $this->success('',[]);
  112. }
  113. foreach ($list as $key=>$value){
  114. //产品名称
  115. $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$value['工单编号'])->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
  116. if (!empty($productName)){
  117. if (!empty($productName['成品名称'])){
  118. $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['成品名称'];
  119. $list[$key]['cpmc'] = $productName['成品名称'];
  120. }else{
  121. $list[$key]['产品名称'] = $value['工单编号'];
  122. $list[$key]['cpmc'] = '';
  123. }
  124. }else{
  125. $list[$key]['产品名称'] = $value['工单编号'];
  126. $list[$key]['cpmc'] = '';
  127. }
  128. $process = \db('工单_工艺资料')
  129. ->where('Gy0_gdbh',$value['工单编号'])
  130. ->where('Gy0_yjno',$value['yjno'])
  131. ->where('Gy0_gxh',$value['gxh'])
  132. ->field('rtrim(工价系数) as 工价系数,rtrim(印刷方式) as 印刷方式,rtrim(版距) as 版距')
  133. ->find();
  134. if (!empty($process)){
  135. if ($value['难度系数'] == 0){
  136. $list[$key]['难度系数'] = $process['工价系数'];
  137. }else{
  138. $list[$key]['难度系数'] = $process['工价系数'].'x'.$value['难度系数'];
  139. }
  140. $list[$key]['印刷方式'] = $process['印刷方式'].' '.$process['版距'];
  141. }else{
  142. $list[$key]['难度系数'] = '';
  143. $list[$key]['印刷方式'] = '';
  144. }
  145. if ($value['yjno']<10){
  146. $list[$key]['yjno'] = '0'.$value['yjno'];
  147. }
  148. if (empty($value['定额代号'])){
  149. $list[$key]['千件工价'] = '';
  150. $list[$key]['日定额'] = '';
  151. $list[$key]['补产标准'] = '';
  152. }else{
  153. $row = \db('dic_lzde')->where('sys_bh',$value['定额代号'])->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额,rtrim(补产标准) as 补产标准')->find();
  154. $list[$key]['千件工价'] = $row['千件工价'];
  155. $list[$key]['日定额'] = $row['日定额'];
  156. $list[$key]['补产标准'] = $row['补产标准'];
  157. }
  158. $list[$key]['工序'] = $list[$key]['yjno'].'-'.$list[$key]['gxmc'];
  159. $list[$key]['备注'] = $value['bzdh'].'('.$value['num'].')'.date('H:i',strtotime($value['sj1'])).'<-->'.date('H:i',strtotime($value['sj2']));
  160. for ($i=1;$i<11;$i++){
  161. if (isset($value['sczl_bh'.$i])){
  162. $name = \db('人事_基本资料')->where('员工编号',$value['sczl_bh'.$i])->field('rtrim(员工姓名) as name')->find();
  163. if (isset($name['name'])){
  164. $list[$key]['组员'.$i] = $value['sczl_bh'.$i].$name['name'].'('.((float)$value['sczl_rate'.$i]*100).'%'.')';
  165. }
  166. }
  167. unset($list[$key]['sczl_bh'.$i],$list[$key]['sczl_rate'.$i]);
  168. }
  169. }
  170. $list['totalA'] = $totalA[0]['产量'];
  171. $list['totalB'] = $totalB[0]['产量'];
  172. $list['制程废品A'] = $totalA[0]['制程废品'];
  173. $list['制程废品B'] = $totalB[0]['制程废品'];
  174. $list['制程次品A'] = $totalA[0]['制程次品'];
  175. $list['制程次品B'] = $totalB[0]['制程次品'];
  176. $list['来料异常A'] = $totalA[0]['来料异常'];
  177. $list['来料异常B'] = $totalB[0]['来料异常'];
  178. $list['装版工时A'] = $totalA[0]['装版工时'];
  179. $list['装版工时B'] = $totalB[0]['装版工时'];
  180. $this->success('成功',$list);
  181. }
  182. /**
  183. * 当日制程检验记录
  184. * @ApiMethod (GET)
  185. * @param string $machine 机台编号
  186. * @param string $date 日期
  187. * @return void
  188. * @throws \think\db\exception\DataNotFoundException
  189. * @throws \think\db\exception\ModelNotFoundException
  190. * @throws \think\exception\DbException
  191. */
  192. public function Inspect()
  193. {
  194. if ($this->request->isGet() === false){
  195. $this->error('请求错误');
  196. }
  197. $machine = input('machine');
  198. $date = input('date');
  199. if (empty($machine) || empty($date)){
  200. $this->error('参数错误');
  201. }
  202. $where = [
  203. '设备编号' => $machine,
  204. '开工时间' => ['between',[date('Y-m-d 08:00:00',strtotime($date)),date('Y-m-d 08:00:00',strtotime($date)+86400)]],
  205. '类别' => ['in',['IPQC检验','机台检验']],
  206. ];
  207. $field = 'rtrim(工单编号) as 工单编号,rtrim(印件号) as 印件号,rtrim(工序名称) as 工序名称,提交时间,rtrim(检验项目) as 检验项目';
  208. $list = \db('制程检验_记录')
  209. ->where($where)
  210. ->field($field)
  211. ->select();
  212. if (empty($list)){
  213. $this->success('未找到检验记录');
  214. }
  215. $data = [];
  216. foreach ($list as $key=>$value)
  217. {
  218. $data['item'][$key] = $value['检验项目'];
  219. $data['InspectionTime'][$key] = date('H:i',strtotime($value['提交时间']));
  220. $data['工单编号'][$key] = $value['工单编号'];
  221. }
  222. $data['item'] = array_unique($data['item']);
  223. $data['InspectionTime'] = array_values(array_unique($data['InspectionTime']));
  224. $data['工单编号'] = array_values(array_unique($data['工单编号']));
  225. foreach ($data['工单编号'] as $key => $value){
  226. foreach ($data['item'] as $k=>$v){
  227. $time = '';
  228. foreach ($list as $kk=>$vv){
  229. if ($vv['工单编号'] === $value && $vv['检验项目'] === $v){
  230. $time = $time.date('H:i',strtotime($vv['提交时间'])).',';
  231. $data['row'][$key][$k] = [
  232. '工单编号' => $value,
  233. '印件号' => $vv['印件号'],
  234. '工序名称' => $vv['工序名称'],
  235. '检验项目' => $v,
  236. 'time' => substr($time,0,-1),
  237. ];
  238. }
  239. }
  240. }
  241. $data['row'][$key] = array_values($data['row'][$key]);
  242. }
  243. unset($data['item'],$data['工单编号']);
  244. $this->success('成功',$data);
  245. }
  246. /**
  247. * 设备生产中工单信息
  248. * @ApiMethod (GET)
  249. * @param string $machine 机台编号
  250. * @return void
  251. * @throws \think\Exception
  252. * @throws \think\db\exception\DataNotFoundException
  253. * @throws \think\db\exception\ModelNotFoundException
  254. * @throws \think\exception\DbException
  255. */
  256. public function Production()
  257. {
  258. if (Request::instance()->isGet() == false) {
  259. $this->error('非法请求');
  260. }
  261. $params = Request::instance()->param();
  262. if (!isset($params['machine']) || empty($params['machine'])) {
  263. $this->error('参数错误');
  264. }
  265. $machine = $params['machine'];
  266. $machineCode = \db('dic_lzde')->where('适用机型',$machine)->value('sys_bh');
  267. $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
  268. $list = [];
  269. $row = [];
  270. if (!empty($data['工单编号'])){
  271. $endTime = \db('工单_工艺资料')
  272. ->where('Gy0_gdbh',$data['工单编号'])
  273. ->where('Gy0_yjno',$data['印件号'])
  274. ->where('Gy0_gxh',$data['工序号'])
  275. ->find();
  276. $list['工单编号'] = $data['工单编号'];
  277. if (!empty($endTime)){
  278. $list['印件号'] = $data['印件号'];
  279. $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
  280. $code = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品代号');
  281. $list['产品名称'] = rtrim($name);
  282. $list['产品代号'] = rtrim($code);
  283. $list['工序名称'] = $data['工序名称'];
  284. }
  285. $list['状态'] = rtrim($data['当前状态']);
  286. }else{
  287. $list['工单编号'] = '';
  288. $list['印件号'] = 0;
  289. $list['产品名称'] = '';
  290. $list['工序名称'] = '';
  291. $list['产品代号'] = '';
  292. $list['状态'] = '';
  293. }
  294. $list['班组编号'] = rtrim($data['班组编号']);
  295. $list['班组Id'] = rtrim($data['班组ID']);
  296. $class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
  297. rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
  298. rtrim(sczl_bh10) as bh10")->find();
  299. if (!empty($class)){
  300. for ($i=1;$i<11;$i++) {
  301. if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
  302. $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
  303. $row[$i] = [
  304. '编号' => $class['bh' . $i],
  305. '姓名' => $name['姓名']
  306. ];
  307. }
  308. }
  309. $row = array_values($row);
  310. }
  311. $list['班组成员'] = $row;
  312. $list['定额代号'] = $machineCode;
  313. $this->success('成功',$list);
  314. }
  315. /**
  316. * 设备工作清单
  317. * @ApiMethod (GET)
  318. * @param string $machine 机台编号
  319. * @return void
  320. * @throws \think\db\exception\DataNotFoundException
  321. * @throws \think\db\exception\ModelNotFoundException
  322. * @throws \think\exception\DbException
  323. */
  324. public function EquipmentWorklist()
  325. {
  326. if ($this->request->isGet() === false){
  327. $this->error('请求错误');
  328. }
  329. $machine = input('machine');
  330. if (empty($machine)){
  331. $this->error('参数错误');
  332. }
  333. $orderList = \db('工单_工艺资料')
  334. ->alias('a')
  335. // ->join('设备_产量计酬 b','a.Gy0_gdbh = b.sczl_gdbh AND a.Gy0_yjno = b.sczl_yjno AND a.Gy0_gxh = b.sczl_gxh','LEFT')
  336. ->join('工单_基本资料 c','a.Gy0_gdbh = c.Gd_gdbh')
  337. ->join('工单_印件资料 d','a.Gy0_gdbh = d.Yj_Gdbh AND a.Gy0_yjno = d.yj_Yjno')
  338. ->field('a.Gy0_gdbh as gdbh,a.质量要求 as 质量信息,a.Gy0_yjno as yjno,a.Gy0_gxh as gxh,
  339. a.Gy0_gxmc as gxmc,a.Add_gxmc as add_gxmc,a.Gy0_辅助工时 as 装版工时,a.Gy0_小时产能 as 工序产能,a.Gy0_生产工时 as 计划工时,
  340. a.Gy0_sj1 as sj1,a.Gy0_sj2 as sj2,a.工序备注 as 排产备注,d.yj_yjmc as 印件名称,c.成品名称 as 产品名称,c.成品代号 as 产品代号,
  341. a.Gy0_计划接货数 as 计划接货数,a.Gy0_ls as ls,a.Gy0_班次安排 as 班组,a.UniqId as UniqId,a.Gy0_最早开工时间 as 最早开工时间')
  342. ->where('a.Gy0_sbbh','like','%'.$machine.'%')
  343. ->where('a.PD_WG','1900-01-01 00:00:00')
  344. ->where('a.Gy0_sj1','<>','1900-01-01 00:00:00')
  345. ->where('c.gd_statu','2-生产中')
  346. ->group('a.Gy0_gdbh,a.Gy0_yjno,a.Gy0_gxh')
  347. ->order('a.Gy0_sj1')
  348. ->select();
  349. // halt($orderList);
  350. if (!empty($orderList)){
  351. $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
  352. foreach ($orderList as $key=>$value){
  353. $cl_data = \db('设备_产量计酬')
  354. ->field('SUM(sczl_cl) as 已完成,SUM(sczl_zcfp) as 制程废品')
  355. ->where('sczl_gdbh',$value['gdbh'])
  356. ->where('sczl_yjno',$value['yjno'])
  357. ->where('sczl_gxh',$value['gxh'])
  358. ->select();
  359. $orderList[$key]['status'] = 0;
  360. if (!empty($data)){
  361. if ($value['gdbh'] === $data['工单编号'] && $value['yjno'] === $data['印件号'] && $value['gxh'] === $data['工序号']) {
  362. $orderList[$key]['status'] = 1;
  363. }
  364. }
  365. $orderList[$key]['工单编号|质量信息'] = $value['gdbh'].'|'.$value['质量信息'];
  366. $orderList[$key]['印件号'] = $value['yjno'];
  367. $orderList[$key]['工序号'] = $value['gxh'];
  368. if ($value['yjno']<10){
  369. $orderList[$key]['yjno'] = '0'.$value['yjno'];
  370. }
  371. if ($value['gxh']<10){
  372. $orderList[$key]['gxh'] = '0'.$value['gxh'];
  373. }
  374. $orderList[$key]['印件资料'] = $orderList[$key]['yjno'].'-'.$value['印件名称'];
  375. $orderList[$key]['工序名称'] = $orderList[$key]['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
  376. if ((int)$cl_data[0]['制程废品'] === 0){
  377. $orderList[$key]['计划产量/已完成'] = (int)$value['计划接货数'].'/'.$cl_data[0]['已完成']=null?'':(int)$cl_data[0]['已完成'];
  378. }else{
  379. $orderList[$key]['计划产量/已完成'] = (int)$value['计划接货数'].'/'.$cl_data[0]['已完成']=null?'':(int)$cl_data[0]['已完成'].'('.$cl_data[0]['制程废品'].')';
  380. }
  381. $orderList[$key]['计划生产时段'] =substr($value['sj1'],5,5).' '.substr($value['sj1'],11,5).'<-->'.substr($value['sj2'],5,5).' '.substr($value['sj2'],11,5);
  382. unset($orderList[$key]['gdbh'],$orderList[$key]['质量信息'],$orderList[$key]['gxh'],$orderList[$key]['yjno'],$orderList[$key]['gxmc'],$orderList[$key]['add_gxmc'],$orderList[$key]['计划接货数'],$orderList[$key]['已完成'],$orderList[$key]['印件名称'],$orderList[$key]['ls'],$orderList[$key]['制程废品']);
  383. }
  384. }
  385. $this->success('成功',$orderList);
  386. }
  387. /**
  388. * 工序、印件、完成数量
  389. * @ApiMethod (GET)
  390. * @param string $workOrder 工单编号
  391. * @return void
  392. * @throws \think\Exception
  393. * @throws \think\db\exception\DataNotFoundException
  394. * @throws \think\db\exception\ModelNotFoundException
  395. * @throws \think\exception\DbException
  396. */
  397. public function Procedure()
  398. {
  399. if ($this->request->isGet() === false){
  400. $this->error('请求错误');
  401. }
  402. $workOrder = input('Gd_gdbh');
  403. $data = [];
  404. if (!empty($workOrder)){
  405. //右边工艺及完成数量
  406. $Process = \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
  407. ->distinct(true)->order('sczl_gxh')
  408. ->column('sczl_gxh');
  409. foreach ($Process as $k=>$v){
  410. $res= \db('设备_产量计酬')->where('sczl_gdbh',$workOrder)
  411. ->where('sczl_gxh',$v)
  412. ->field('rtrim(sczl_yjno) as sczl_yjno,rtrim(sczl_gxmc) as sczl_gxmc')
  413. ->find();
  414. if ($res['sczl_yjno']<10){
  415. $res['sczl_yjno'] = '0'.$res['sczl_yjno'];
  416. }
  417. $processList['process'] = $res['sczl_yjno'].'-'.$res['sczl_gxmc'];
  418. $processList['completed'] = \db('设备_产量计酬')
  419. ->where('sczl_gdbh',$workOrder)
  420. ->where('sczl_gxh',$v)
  421. ->count();
  422. array_push($data,$processList);
  423. }
  424. }
  425. $this->success('成功',$data);
  426. }
  427. /**
  428. * 班组人员及分配比例
  429. * @ApiMethod (GET)
  430. * @param string $machine 机台编号
  431. * @return void
  432. * @throws \think\db\exception\DataNotFoundException
  433. * @throws \think\db\exception\ModelNotFoundException
  434. * @throws \think\exception\DbException
  435. */
  436. public function Team()
  437. {
  438. if ($this->request->isGet() === false){
  439. $this->error('请求错误');
  440. }
  441. $machine = input('machine');
  442. if (empty($machine)){
  443. $this->error('参数错误');
  444. }
  445. $where = [
  446. 'sczl_jtbh' => $machine,
  447. ];
  448. $field = 'rtrim(sczl_bzdh) as 班组号,rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
  449. rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
  450. rtrim(sczl_bh10) as bh10,rtrim(sczl_rate1) as rate1,rtrim(sczl_rate2) as rate2,rtrim(sczl_rate3) as rate3,rtrim(sczl_rate4) as rate4,
  451. rtrim(sczl_rate5) as rate5,rtrim(sczl_rate6) as rate6,rtrim(sczl_rate7) as rate7,rtrim(sczl_rate8) as rate8,
  452. rtrim(sczl_rate9) as rate9,rtrim(sczl_rate10) as rate10,rtrim(UniqId) as ID';
  453. $team = \db('设备_产量计酬')
  454. ->where('sczl_jtbh',$machine)
  455. ->field($field)
  456. ->order('UniqId desc')
  457. ->find();
  458. $list = \db('设备_班组资料')->where($where)->field($field)->select();
  459. $data = [];
  460. foreach ($list as $k=>$v){
  461. if ($team == $v){
  462. $data[$k]['status'] = 1;
  463. }else{
  464. $data[$k]['status'] = 0;
  465. }
  466. $data[$k]['ID'] = $v['ID'];
  467. $data[$k]['班组号'] = $v['班组号'];
  468. for ($i=1;$i<11;$i++){
  469. if ($v['bh'.$i] != '' && $v['bh'.$i] != '000000'){
  470. $name = \db('人事_基本资料')->where('员工编号',$v['bh'.$i])->field('rtrim(员工姓名) as 姓名')->find();
  471. if ($v['rate'.$i] > 0){
  472. $data[$k][$i-1] = $v['bh'.$i].' '.$name['姓名'].' ('.number_format($v['rate'.$i]*100,2).'%'.')';
  473. }else{
  474. $data[$k][$i-1] = $v['bh'.$i].' '.$name['姓名'].' (0.00%'.')';
  475. }
  476. }
  477. }
  478. }
  479. $this->success('成功',$data);
  480. }
  481. /**
  482. * 当班产量明细
  483. * @ApiMethod (GET)
  484. * @param string $machine 机台编号
  485. * @param string $workOrder 工单编号
  486. * @param string $team 班次
  487. * @return void
  488. * @throws \think\db\exception\DataNotFoundException
  489. * @throws \think\db\exception\ModelNotFoundException
  490. * @throws \think\exception\DbException
  491. */
  492. public function OutputDetail()
  493. {
  494. if ($this->request->isGet() === false){
  495. $this->error('请求错误');
  496. }
  497. $machine = input('machine');
  498. $workOrder = input('Gd_gdbh');
  499. $team = substr(input('team'),0,1);
  500. if (empty($machine) || empty($team)){
  501. $this->success('');
  502. }
  503. $sczlTime = date('Y-m-d H:i:s',time());
  504. if ($sczlTime>date('Y-m-d 00:00:00') && $sczlTime<date('Y-m-d 08:30:00')){
  505. $time = date('Y-m-d 00:00:00',time()-86400);
  506. }else{
  507. $time = date('Y-m-d 00:00:00');
  508. }
  509. $where = [
  510. 'sczl_jtbh' => $machine,
  511. 'sczl_bzdh' => ['like',$team.'%'],
  512. 'sczl_rq' => $time,
  513. ];
  514. $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as yjno,rtrim(sczl_num) as 流程单号,rtrim(sczl_dedh) as dedh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as 标牌号,rtrim(sczl_cl) as 产量,
  515. rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,rtrim(sczl_装版工时) as 装版工时,
  516. rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常停机工时,rtrim(sczl_设备运行工时) as 通电工时,
  517. rtrim(码开始行) as 码开始行,rtrim(码结束行) as 码结束行,rtrim(码包) as 码包,rtrim(主电表) as 主电表,rtrim(辅电表) as 辅电表,rtrim(sczl_ms) as 色度,
  518. rtrim(sczl_sj1) as sj1,rtrim(sczl_sj2) as sj2,rtrim(UniqId) as UniqId,rtrim(sczl_bh98) as 拉料,rtrim(sczl_ls) as ls';
  519. $list = \db('设备_产量计酬')->where($where)->field($field)->order('UniqId desc')->select();
  520. if (!empty($list)){
  521. foreach ($list as $k=>$v){
  522. $name = \db('工单_印件资料')->where('Yj_Gdbh',$v['工单编号'])->where('yj_Yjno',$v['yjno'])->field('rtrim(yj_yjmc) as cpmc')->find();
  523. if ($v['yjno']<10){
  524. $list[$k]['yjno'] = '0'.$v['yjno'];
  525. }
  526. if (!empty($v['拉料'])){
  527. $list[$k]['拉料姓名'] = \db('人事_基本资料')->where('员工编号',$v['拉料'])->value('rtrim(员工姓名) as 员工姓名');
  528. }
  529. if (isset($list[$k]['拉料姓名']) === false){
  530. $list[$k]['拉料姓名'] = '';
  531. }
  532. $list[$k]['印件及工序'] = $list[$k]['yjno'].'-'.$v['gxmc'];
  533. $list[$k]['生产时间段'] = substr($v['sj1'],5,5).' '.substr($v['sj1'],11,5).'<-->'.substr($v['sj2'],5,5).' '.substr($v['sj2'],11,5);
  534. $list[$k]['产品名称'] = $name['cpmc'];
  535. }
  536. $field1 = 'SUM(sczl_cl) as 产量,SUM(sczl_zcfp) as 制程废品,SUM(sczl_zccp) as 制程次品,SUM(sczl_前工序废) as 前工序废,
  537. SUM(sczl_来料少数) as 来料异常,SUM(sczl_装版工时) as 装版工时,SUM(sczl_保养工时) as 保养工时,SUM(sczl_打样工时) as 打样工时,
  538. SUM(sczl_异常停机工时) as 异常停机工时,SUM(sczl_设备运行工时) as 通电工时,SUM(码开始行) as 码开始行,SUM(码结束行) as 码结束行,
  539. SUM(码包) as 码包,SUM(主电表) as 主电表,SUM(辅电表) as 辅电表';
  540. $total = \db('设备_产量计酬')->where($where)->field($field1)->order('UniqId desc')->select();
  541. $total[0]['版数'] = count($list);
  542. $list['total'] = $total[0];
  543. }
  544. $this->success('成功',$list);
  545. }
  546. /**
  547. * 检验记录
  548. * @ApiMethod (GET)
  549. * @param string $machine 机台编号
  550. * @param string $workOrder 工单编号
  551. * @param string $team 班次
  552. * @return void
  553. * @throws \think\db\exception\DataNotFoundException
  554. * @throws \think\db\exception\ModelNotFoundException
  555. * @throws \think\exception\DbException
  556. */
  557. public function InspectionRecord()
  558. {
  559. if ($this->request->isGet() === false){
  560. $this->error('请求失败');
  561. }
  562. $machine = input('machine');
  563. $workOrder = input('Gd_gdbh');
  564. $team = input('team');
  565. if (empty($machine) || empty($workOrder) || empty($team)){
  566. $this->success('');
  567. }
  568. $where = [
  569. '设备编号' => $machine,
  570. '工单编号' => $workOrder,
  571. '班组编号' => $team,
  572. '类别' => ['in',['IPQC检验','机台检验']],
  573. ];
  574. //检验项目筛选
  575. $item = \db('制程检验_记录')->where($where)->distinct(true)->column('rtrim(检验项目)');
  576. //检验时间
  577. $InspectionTime = \db('制程检验_记录')->where($where)->distinct(true)->column('提交时间');
  578. foreach ($InspectionTime as $k=>$v){
  579. $InspectionTime[$k] = date('H:i',strtotime($v));
  580. }
  581. //检测记录详情
  582. $field = 'rtrim(工单编号) as 工单编号,rtrim(印件号) as 印件号,rtrim(工序名称) as 工序名称';
  583. $nameDetail = \db('制程检验_记录')->where($where)->field($field)->find();
  584. $data = [];
  585. //检测数据
  586. foreach ($item as $key=>$value){
  587. $SubmissionTime = \db('制程检验_记录')->where($where)
  588. ->where('检验项目',$value)
  589. ->where('检验结果','合格')
  590. ->field('rtrim(提交时间) as 提交时间')
  591. ->select();
  592. $time = [];
  593. foreach ($SubmissionTime as $k=>$v){
  594. $time[$k] = date('H:i',strtotime($v['提交时间']));
  595. }
  596. $data[$key] = [
  597. '工单编号' => $nameDetail['工单编号'],
  598. '印件号' => $nameDetail['印件号'],
  599. '工序名称' => $nameDetail['工序名称'],
  600. '检验项目' => $value,
  601. 'inspectresult' => implode(',',$time),
  602. ];
  603. }
  604. $data['inspectiontime'] = $InspectionTime;
  605. $this->success('成功',$data);
  606. }
  607. /**
  608. * 班组维护->班组添加
  609. * @ApiMethod (GET)
  610. * @param void
  611. * @return void
  612. * @throws \think\db\exception\DataNotFoundException
  613. * @throws \think\db\exception\ModelNotFoundException
  614. * @throws \think\exception\DbException
  615. */
  616. public function MachineTeamAdd()
  617. {
  618. if (Request::instance()->isPost() === false ){
  619. $this->error('请求错误');
  620. }
  621. $param = Request::instance()->post();
  622. if (empty($param)){
  623. $this->error('参数错误');
  624. }
  625. $lastId = \db('设备_班组资料')
  626. ->order('UniqId desc')
  627. ->value('UniqId');
  628. if (empty($lastId)){
  629. $lastId = 0;
  630. }
  631. for($i=1;$i<11;$i++){
  632. if (!empty($param['sczl_bh'.$i])){
  633. $name = \db('人事_基本资料')->where('员工编号',$param['sczl_bh'.$i])->value('员工编号');
  634. if (empty($name)){
  635. $this->error('未找到编号'.$param['sczl_bh'.$i].'员工信息,无法添加,请输入正确的员工编号');
  636. }
  637. }
  638. }
  639. $param['sys_rq'] = date('Y-m-d H:i:s',time());
  640. $param['UniqId'] = $lastId + 1;
  641. $param['mod_rq'] = date('Y-m-d H:i:s',time());
  642. $sql = \db('设备_班组资料')->fetchSql(true)->insert($param);
  643. $res = \db()->query($sql);
  644. if ($res !== false){
  645. $this->success('成功');
  646. }else{
  647. $this->error('失败');
  648. }
  649. }
  650. /**
  651. * 机台编号列表
  652. * @ApiMethod (GET)
  653. * @return void
  654. */
  655. public function MachineList()
  656. {
  657. if ($this->request->isGet() === false){
  658. $this->error('请求错误');
  659. }
  660. $list = \db('设备_基本资料')->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->select();
  661. if (empty($list)){
  662. $this->success('未找到机台编号');
  663. }
  664. $data = [];
  665. foreach ($list as $key=>$value){
  666. $data[$key] = $value['设备编号'] . '||' . $value['设备名称'];
  667. }
  668. $this->success('成功',$data);
  669. }
  670. /**
  671. * 删除班组信息
  672. * @ApiMethod (GET)
  673. * @param void
  674. * @return void
  675. * @throws \think\Exception
  676. * @throws \think\exception\PDOException
  677. */
  678. public function teamDel()
  679. {
  680. if (Request::instance()->isPost() === false){
  681. $this->error('请求错误');
  682. }
  683. $param = Request::instance()->post();
  684. if (empty($param)){
  685. $this->error('参数错误');
  686. }
  687. $machine = \db('设备_班组资料')
  688. ->where('UniqId',$param['UniqId'])
  689. ->value('sczl_jtbh');
  690. $teamId = \db('设备_产量采集')
  691. ->where('设备编号',$machine)
  692. ->order('UniqId desc')
  693. ->value('班组ID');
  694. if ($teamId === (int)$param['UniqId']){
  695. $this->success('无法删除正在生产的班组资料,请先切换班组');
  696. }
  697. $res = \db('设备_班组资料')
  698. ->where('UniqId',$param['UniqId'])
  699. ->delete();
  700. if ($res !== false){
  701. $this->success('成功');
  702. }else{
  703. $this->error('失败');
  704. }
  705. }
  706. /**
  707. * 管理人员现场巡检记录->展示
  708. * @ApiMethod (GET)
  709. * @param void
  710. * @return void
  711. * @throws \think\db\exception\DataNotFoundException
  712. * @throws \think\db\exception\ModelNotFoundException
  713. * @throws \think\exception\DbException
  714. */
  715. public function FieldInspectionRecord()
  716. {
  717. if ($this->request->isGet() === false){
  718. $this->error('请求错误');
  719. }
  720. $param = $this->request->param();
  721. if (empty($param)){
  722. $this->error('参数错误');
  723. }
  724. $date = date('Y-m-d H:i:s',time());
  725. if (empty($param['start'])){
  726. $startTime = date('Y-m-d 08:30:00',time());
  727. }else{
  728. $startTime = $param['start'];
  729. }
  730. if ($date<$startTime){
  731. $startTime = date('Y-m-d H:i:s',strtotime($startTime)-86400);
  732. }
  733. $where = [
  734. '工单编号' => $param['workOrder'],
  735. '开工时间' => $startTime,
  736. '类别' => '现场巡查记录',
  737. '班组编号' => $param['team']
  738. ];
  739. $filed = 'rtrim(工单编号) as 工单编号,rtrim(印件号) as 印件号,rtrim(工序名称) as 工序名称,rtrim(流程单号) as 流程单号,
  740. rtrim(设备编号) as 设备编号,rtrim(班组编号) as 班组编号,rtrim(检验项目) as 现场管理人员,rtrim(检验备注) as 检验备注,
  741. rtrim(提交时间) as 提交时间,rtrim(开工时间) as 开工时间';
  742. $list = \db('制程检验_记录')->where($where)
  743. ->field($filed)
  744. ->select();
  745. if (empty($list)){
  746. $this->success('',[]);
  747. }
  748. foreach ($list as $key=>$value){
  749. $number = floor((strtotime($value['提交时间'])-strtotime($value['开工时间']))/(15*60));
  750. $list[$key]['归属时段'] = $value['开工时间'];
  751. $list[$key]['分钟差数'] = $number;
  752. if ($number != 0){
  753. $list[$key]['归属时段'] = date('Y-m-d H:i:s',strtotime($value['开工时间'])+$number*15*60);
  754. }
  755. }
  756. $this->success('成功',$list);
  757. }
  758. /**
  759. * 管理人员现场巡检记录->添加
  760. * @ApiMethod (POST)
  761. * @param void
  762. * @return void
  763. */
  764. public function FieldInspectionRecordAdd()
  765. {
  766. if (Request::instance()->isPost() === false){
  767. $this->error('请求错误');
  768. }
  769. $param = Request::instance()->post();
  770. if (empty($param)){
  771. $this->error('参数错误');
  772. }
  773. if ($param['processCode']<10){
  774. $param['processCode'] = '0'.$param['processCode'];
  775. }
  776. $date = date('Y-m-d H:i:s',time());
  777. $startTime = date('Y-m-d 08:30:00',time());
  778. if ($date<$startTime){
  779. $startTime = date('Y-m-d H:i:s',strtotime($startTime)-86400);
  780. }
  781. $data = [
  782. '类别' => $param['category'],
  783. '工单编号' => $param['workOrder'],
  784. '印件号' => $param['printCode'],
  785. '工序名称' => $param['processCode'].'-'.$param['process'],
  786. '流程单号' => $param['flowCode'],
  787. '设备编号' => $param['machine'],
  788. '班组编号' => $param['team'],
  789. '检验项目' => '['.$param['employeeCode'].'/'.$param['employeeName'].']',
  790. '相关标准' => '',
  791. '量测仪器' => '',
  792. '检验结果' => '',
  793. '检验备注' => $param['remark'],
  794. '提交时间' => date('Y-m-d H:i:s',time()),
  795. '开工时间' => $startTime,
  796. 'sys_id' => '',
  797. 'sys_rq' => date('Y-m-d H:i:s',time()),
  798. 'mod_rq' => '0000-00-00 00:00:00',
  799. 'UniqId' => \db('制程检验_记录')->order('UniqId desc')->field('UniqId')->find()['UniqId']+1
  800. ];
  801. $sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
  802. $res = Db::query($sql);
  803. if ($res !== false){
  804. $this->success('成功');
  805. }else{
  806. $this->error('失败');
  807. }
  808. }
  809. /**
  810. * 设备点检->左侧菜单栏
  811. * @ApiMethod (GET)
  812. * @param void
  813. * @return void
  814. */
  815. public function SpotCheckItem()
  816. {
  817. if ($this->request->isGet() === false){
  818. $this->error('请求错误');
  819. }
  820. $param = $this->request->param();
  821. if (empty($param)){
  822. $this->error('参数错误');
  823. }
  824. $list = \db('设备_点检项目')
  825. ->where('适用机型','LIKE','%;'.$param['machine'].';%')
  826. ->distinct(true)
  827. ->column('部件名称','部件编号');
  828. if (empty($list)){
  829. $this->success('');
  830. }
  831. $this->success('成功',$list);
  832. }
  833. /**
  834. * 设备点检->检测项目
  835. * @ApiMethod (GET)
  836. * @param void
  837. * @return void
  838. * @throws \think\db\exception\DataNotFoundException
  839. * @throws \think\db\exception\ModelNotFoundException
  840. * @throws \think\exception\DbException
  841. */
  842. public function InspectionItem()
  843. {
  844. if ($this->request->isGet() === false){
  845. $this->error('请求错误');
  846. }
  847. $param = $this->request->param();
  848. if (empty($param)){
  849. $this->error('参数错误');
  850. }
  851. $list = \db('设备_点检项目')
  852. ->where('部件名称',$param['unitName'])
  853. ->where('适用机型','like','%'.$param['machine'].'#%')
  854. ->field('rtrim(检验项目) as 检验项目,rtrim(判定标准) as 判定标准,rtrim(点检方法) as 点检方法')
  855. ->select();
  856. if (empty($list)){
  857. $this->success('未找到检测项目');
  858. }
  859. $this->success('成功',$list);
  860. }
  861. /**
  862. * 设备点检->检测记录添加
  863. * @ApiMethod (POST)
  864. * @param void
  865. * @return void
  866. * @throws \think\db\exception\DataNotFoundException
  867. * @throws \think\db\exception\ModelNotFoundException
  868. * @throws \think\exception\DbException
  869. */
  870. public function InspectionItemAdd()
  871. {
  872. if (Request::instance()->isPost() === false){
  873. $this->error('请求错误');
  874. }
  875. $param = Request::instance()->post();
  876. if (empty($param)){
  877. $this->error('参数错误');
  878. }
  879. $lastNumber = \db("设备_点检记录")->field('Uniqid as ID')->order('Uniqid desc')->find()['ID'];
  880. if (empty($lastNumber)){
  881. $lastId = 0;
  882. }else{
  883. $lastId = $lastNumber;
  884. }
  885. $row = [];
  886. foreach ($param as $key=>$value){
  887. $unitCode = \db('设备_点检项目')->where('部件名称',$value['unitName'])->field('rtrim(部件编号) as 部件编号')->find();
  888. $row[$key] = [
  889. '日期' => date('Y-m-d 00:00:00',time()),
  890. '班组编号' => $value['team'],
  891. '点检设备' => $value['machine'],
  892. '部件编号' => $unitCode['部件编号'],
  893. '部件名称' => $value['unitName'],
  894. '检验项目' => $value['itemName'],
  895. '判定标准' => $value['standard'],
  896. '点检方法' => $value['method'],
  897. '点检结果' => $value['status'],
  898. '备注说明' => $value['remark'],
  899. 'Sys_id' =>'',
  900. 'Sys_rq' => date('Y-m-d H:i:s',time()),
  901. 'Mod_rq' => date('Y-m-d H:i:s',time()),
  902. 'Uniqid' => $lastId+$key+1
  903. ];
  904. }
  905. $sql = \db('设备_点检记录')->fetchSql(true)->insertAll($row);
  906. $res = Db::query($sql);
  907. if ($res !== false){
  908. $this->success('成功');
  909. }else{
  910. $this->error('失败');
  911. }
  912. }
  913. /**
  914. * 机台印版领用->左侧菜单
  915. * @ApiMethod (GET)
  916. * @param void
  917. * @return void
  918. */
  919. public function PrintGetTab()
  920. {
  921. if ($this->request->isGet() === false){
  922. $this->error('请求错误');
  923. }
  924. $param = $this->request->param();
  925. if (empty($param)){
  926. $this->error('参数错误');
  927. }
  928. $productCode = $param['productCode'];
  929. $sql = "SELECT DISTINCT(RTRIM(b.`名称`)) as `印版分类`,RTRIM(b.`编号`) as `编号` FROM `产品_印版资料` as a
  930. JOIN `物料_存货结构` as b ON b.`编号` = SUBSTRING(a.`存货编码`,1,4)
  931. WHERE a.YB_Cpdh = '{$productCode}'";
  932. $res = Db::query($sql);
  933. if (empty($res)){
  934. $this->success('');
  935. }
  936. $this->success('成功',$res);
  937. }
  938. /**
  939. * 机台印版领用记录->数据详情
  940. * @ApiMethod (GET)
  941. * @param void
  942. * @return void
  943. */
  944. public function PrintDetail()
  945. {
  946. if ($this->request->isGet() === false){
  947. $this->error('请求失败');
  948. }
  949. $param = $this->request->param();
  950. if (empty($param)){
  951. $this->error('参数错误');
  952. }
  953. $productCode = $param['productCode'];
  954. $code = $param['code'].'%';
  955. $workOrder = $param['workOrder'];
  956. $sql = "SELECT
  957. RTRIM(a.`存货编码`) as `存货编码`,
  958. RTRIM(c.`物料名称`) as `存货名称`,
  959. RTRIM(b.`印版名称`) as `印版名称`,
  960. RTRIM(b.`供方批号`) as `供方批号`,
  961. RTRIM(b.`制造日期`) as `制造日期`,
  962. SUM(d.`Yb_印数`) as `印数`,
  963. RTRIM(e.`名称`) as `印版类别`,
  964. SUBSTRING(a.YB_Cpdh,1,4) as `客户编号`,
  965. RTRIM(f.`Gd_客户名称`) as `客户名称`,
  966. RTRIM(a.YB_Cpdh) as `产品编号`,
  967. RTRIM(f.Gd_cpmc) as `产品名称`,
  968. RTRIM(d.UniqID) as UniqId
  969. FROM `产品_印版资料` as a
  970. LEFT JOIN `产品_印版库` as b ON b.`存货编码` = a.`存货编码`
  971. JOIN `物料_存货编码` as c ON c.`物料代码` = a.`存货编码`
  972. LEFT JOIN `工单_印版领用记录` as d ON d.`Yb_供方批号` = b.`供方批号`
  973. JOIN `物料_存货结构` as e ON e.`编号` = SUBSTRING(a.`存货编码`,1,4)
  974. JOIN `工单_基本资料` as f ON a.YB_Cpdh = f.Gd_cpdh
  975. WHERE a.YB_Cpdh = '{$productCode}'
  976. AND a.`存货编码` LIKE '{$code}'
  977. AND f.Gd_gdbh = '{$workOrder}'
  978. AND b.`报废日期` = '1900-01-01 00:00:00'
  979. GROUP BY b.`供方批号`
  980. ORDER BY a.`存货编码`";
  981. $list = Db::query($sql);
  982. if (empty($list)){
  983. $this->success('');
  984. }
  985. $this->success('成功',$list);
  986. }
  987. /**
  988. * 换型清场->左侧菜单栏
  989. * @ApiMethod (GET)
  990. * @param void
  991. * @return void
  992. */
  993. public function remodelGetTab()
  994. {
  995. if ($this->request->isGet() === false){
  996. $this->error('请求错误');
  997. }
  998. $date = date('Y-m-d 00:00:00',time()-3456000);
  999. $nowTime = date('Y-m-d H:i:s',time());
  1000. $list = \db('设备_基本资料')->where('使用状态',1)->order('设备编号')->column('设备编号');
  1001. if (empty($list)){
  1002. $this->error('失败');
  1003. }
  1004. $sql = "SELECT RTRIM(a.`设备编号`) as `设备编号`,RTRIM(b.`日期`) as `日期`,RTRIM(b.UniqId) as UniqId
  1005. FROM `设备_基本资料` as a
  1006. LEFT JOIN `制程_换型清场` as b ON b.`机台编号` = a.`设备编号`
  1007. WHERE b.`日期` > '{$date}' AND b.日期 < '{$nowTime}' AND b.`工单编号A` <> '' AND b.`工单编号B` <> '' ORDER BY b.`UniqId`";
  1008. $res = Db::query($sql);
  1009. $data = $result = [];
  1010. foreach ($list as $key=>$value){
  1011. $data[$value] = $result[$value]= $time = [];
  1012. foreach ($res as $k=>$v){
  1013. if ($value === $v['设备编号']){
  1014. $row = [
  1015. '日期' => $v['日期'],
  1016. 'id' => $v['UniqId']
  1017. ];
  1018. array_push($data[$value],$row);
  1019. }
  1020. }
  1021. foreach ($data[$value] as $m=>$n){
  1022. $time[$m] = $n['日期'];
  1023. }
  1024. $time = array_values(array_unique($time));
  1025. foreach ($time as $kk=>$vv){
  1026. $i=1;
  1027. foreach ($data[$value] as $kkk=>$vvv){
  1028. if ($kkk>=$kk && $vv === $vvv['日期']){
  1029. array_push($result[$value],date('Y-m-d',strtotime($vv)).'第'.$i.'次换型/'.$vvv['id']);
  1030. $i++;
  1031. }
  1032. }
  1033. }
  1034. }
  1035. $this->success('成功',$result);
  1036. }
  1037. /**
  1038. * 换型清场->详情
  1039. * @return void
  1040. * @throws \think\db\exception\DataNotFoundException
  1041. * @throws \think\db\exception\ModelNotFoundException
  1042. * @throws \think\exception\DbException
  1043. */
  1044. public function RemodelDetail()
  1045. {
  1046. if ($this->request->isGet() === false){
  1047. $this->error('请求错误');
  1048. }
  1049. $param = $this->request->param();
  1050. if (empty($param)){
  1051. $this->error('参数错误');
  1052. }
  1053. $field = 'rtrim(日期) as 日期,rtrim(班组) as 班组,rtrim(机台编号) as 机台编号,rtrim(工单编号A) as 工单编号A,rtrim(印件工序A) as 印件工序A,
  1054. rtrim(码包号A) as 码包号A,rtrim(工单编号B) as 工单编号B,rtrim(印件工序B) as 印件工序B,rtrim(码包号B) as 码包B,
  1055. rtrim(清场项目A) as 项目1,rtrim(清场项目B) as 项目2,rtrim(清场项目C) as 项目3,rtrim(清场项目D) as 项目4,rtrim(清场项目E) as 项目5,
  1056. rtrim(机长) as 机长,rtrim(班长) as 班长,rtrim(质量巡查员) as 质量巡查员';
  1057. $list = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->field($field)->find();
  1058. if (empty($list)){
  1059. $this->success('未找到该条清场记录');
  1060. }
  1061. $list['日期'] = date('Y-m-d',strtotime($list['日期']));
  1062. $printNameA = \db('工单_印件资料')->where('Yj_Gdbh',$list['工单编号A'])->field('rtrim(yj_yjmc) as yjmc')->find();
  1063. if (empty($printNameA)){
  1064. $list['印件名称A'] = '';
  1065. }else{
  1066. $list['印件名称A'] = $printNameA['yjmc'];
  1067. }
  1068. $printNameB = \db('工单_印件资料')->where('Yj_Gdbh',$list['工单编号B'])->field('rtrim(yj_yjmc) as yjmc')->find();
  1069. if (empty($printNameB)){
  1070. $list['印件名称B'] = '';
  1071. }else{
  1072. $list['印件名称B'] = $printNameB['yjmc'];
  1073. }
  1074. $this->success('成功',$list);
  1075. }
  1076. /**
  1077. * 换型清场->当前设备清场记录
  1078. * @ApiMethod (GET)
  1079. * @param void
  1080. * @return void
  1081. * @throws \think\db\exception\DataNotFoundException
  1082. * @throws \think\db\exception\ModelNotFoundException
  1083. * @throws \think\exception\DbException
  1084. */
  1085. public function ModelChangeRecord()
  1086. {
  1087. if ($this->request->isGet() === false){
  1088. $this->error('请求错误');
  1089. }
  1090. $param = $this->request->param();
  1091. if (empty($param)){
  1092. $this->error('参数错误');
  1093. }
  1094. $date = date('Y-m-d 00:00:00',time()-3888000);
  1095. $nowTime = date('Y-m-d H:i:s',time());
  1096. $where = [
  1097. '日期' =>['between',[$date,$nowTime]],
  1098. '机台编号' => $param['machine'],
  1099. '工单编号A' => ['<>',''],
  1100. '工单编号B' => ['<>',''],
  1101. ];
  1102. $field = "rtrim(日期) as 日期,rtrim(机台编号) as 机台编号,rtrim(班组) as 班组,rtrim(工单编号A) as 工单编号A,rtrim(印件工序A) as 印件工序A,
  1103. rtrim(码包号A) as 码包号A,rtrim(工单编号B) as 工单编号B,rtrim(印件工序B) as 印件工序B,rtrim(码包号B) as 码包号B,rtrim(清场项目A) as 清场项目A,
  1104. rtrim(清场项目B) as 清场项目B,rtrim(清场项目C) as 清场项目C,rtrim(清场项目D) as 清场项目D,rtrim(清场项目E) as 清场项目E,rtrim(机长) as 机长,
  1105. rtrim(班长) as 班长,rtrim(质量巡查员) as 质量巡查员,rtrim(sys_rq) as 创建时间,rtrim(UniqId) as UNIQID";
  1106. $list = \db('制程_换型清场')
  1107. ->where($where)
  1108. ->field($field)
  1109. ->select();
  1110. if (empty($list)){
  1111. $this->success('未找到换型记录');
  1112. }
  1113. foreach ($list as $key=>$value){
  1114. $printNameA = \db('工单_印件资料')->where('Yj_Gdbh',$value['工单编号A'])->value('rtrim(yj_yjmc) as yjmc');
  1115. if (empty($printNameA)){
  1116. $list[$key]['印件名称A'] = '';
  1117. }else{
  1118. $list[$key]['印件名称A'] = $printNameA;
  1119. }
  1120. $printNameB = \db('工单_印件资料')->where('Yj_Gdbh',$value['工单编号B'])->value('rtrim(yj_yjmc) as yjmc');
  1121. if (empty($printNameB)){
  1122. $list[$key]['印件名称B'] = '';
  1123. }else{
  1124. $list[$key]['印件名称B'] = $printNameB;
  1125. }
  1126. }
  1127. $this->success('成功',$list);
  1128. }
  1129. /**
  1130. * 车间机台状态列表展示
  1131. * @ApiMethod (GET)
  1132. * @param void
  1133. * @return void
  1134. * @throws \think\db\exception\BindParamException
  1135. * @throws \think\exception\PDOException
  1136. */
  1137. public function MachineDetailList()
  1138. {
  1139. if ($this->request->isGet() === false){
  1140. $this->error('请求错误');
  1141. }
  1142. $param = $this->request->param();
  1143. if (empty($param)){
  1144. $this->error('参数错误');
  1145. }
  1146. $workshop = $param['workshop'];
  1147. $sql = "SELECT
  1148. RTRIM( a.`设备编号` ) AS 设备编号,
  1149. RTRIM( a.`设备名称` ) AS 设备名称,
  1150. RTRIM( d.`当前状态` ) AS 状态
  1151. FROM
  1152. `设备_基本资料` AS a
  1153. JOIN (
  1154. SELECT
  1155. b.`设备编号`,
  1156. b.`当前状态`,
  1157. b.`开工时间`
  1158. FROM
  1159. `设备_产量采集` AS b
  1160. JOIN ( SELECT `设备编号`, MAX( `UniqId` ) AS `UniqId` FROM `设备_产量采集` GROUP BY `设备编号` ) AS c ON b.`设备编号` = c.`设备编号`
  1161. AND b.`UniqId` = c.`UniqId`
  1162. ) AS d ON a.`设备编号` = d.`设备编号`
  1163. WHERE
  1164. a.`使用部门` = '{$workshop}'
  1165. GROUP BY
  1166. a.`设备编号`
  1167. ORDER BY
  1168. a.UniqId";
  1169. $list = \db()->query($sql);
  1170. foreach ($list as $key=>$value){
  1171. if ($value['状态'] == ''){
  1172. $list[$key]['状态'] = '待单';
  1173. }
  1174. }
  1175. $this->success('成功',$list);
  1176. }
  1177. /**
  1178. * 机台当前参数展示
  1179. * @ApiMethod (GET)
  1180. * @return void
  1181. * @throws \think\db\exception\DataNotFoundException
  1182. * @throws \think\db\exception\ModelNotFoundException
  1183. * @throws \think\exception\DbException
  1184. */
  1185. public function MachineDetail()
  1186. {
  1187. if ($this->request->isGet() === false){
  1188. $this->error('请求错误');
  1189. }
  1190. $param = $this->request->param();
  1191. if (empty($param)){
  1192. $this->error('参数错误');
  1193. }
  1194. $data = [];
  1195. if ($param['start'] === ''){
  1196. if (date('Y-m-d H:i:s')>date('Y-m-d 08:30:00',time()) && date('Y-m-d H:i:s')<date('Y-m-d 20:30:00',time())){
  1197. $param['start'] = date('Y-m-d 08:30:00',time());
  1198. }elseif (date('Y-m-d H:i:s')>date('Y-m-d 20:30:00',time()) && date('Y-m-d H:i:s')<date('Y-m-d 23:59:59',time())){
  1199. $param['start'] = date('Y-m-d 20:30:00',time());
  1200. }else{
  1201. $param['start'] = date('Y-m-d 20:30:00',time()-86400);
  1202. }
  1203. }
  1204. $machineDetail = \db('设备_产量采集')
  1205. ->alias('a')
  1206. ->join('设备_基本资料 b','a.设备编号 = b.设备编号')
  1207. ->join('工单_工艺资料 c','a.工单编号 = c.Gy0_gdbh AND a.设备编号 = c.Gy0_sbbh')
  1208. ->join('工单_基本资料 d','a.工单编号 = d.Gd_gdbh')
  1209. ->field([
  1210. 'rtrim(a.开工时间)' => '开工时间',
  1211. 'rtrim(a.设备编号)' => '设备编号',
  1212. 'rtrim(a.工单编号)' => '工单编号',
  1213. 'rtrim(b.设备名称)' => '设备名称',
  1214. 'rtrim(c.Gy0_gxh)' => '工序号',
  1215. 'rtrim(c.Gy0_gxmc)' => '工序名称',
  1216. 'rtrim(d.Gd_cpmc)' => '产品名称'
  1217. ])
  1218. ->where('a.设备编号', $param['machine'])
  1219. ->order('a.UniqId desc')
  1220. ->find();
  1221. $data['machine'] = [
  1222. '日期' => $machineDetail['开工时间'],
  1223. '设备' => $machineDetail['设备编号'].'-->'.$machineDetail['设备名称'],
  1224. '工单' => $machineDetail['工单编号'].'-->'.$machineDetail['产品名称'],
  1225. '工艺' => ($machineDetail['工序号']<10?'0'.$machineDetail['工序号']:$machineDetail['工序号']).'--'.$machineDetail['工序名称']
  1226. ];
  1227. //机台状态时间
  1228. $startTime = \db('设备_产量采集')
  1229. ->where('设备编号',$param['machine'])
  1230. ->where('开工时间',$param['start'])
  1231. ->field('rtrim(时间) as 时间,当班产量,rtrim(当前状态) as 状态,MAX(时间) as 最大时间,MAX(当班产量) as 最大产量')
  1232. ->group('当前状态')
  1233. ->select();
  1234. if (!empty($startTime)){
  1235. foreach ($startTime as $key=>$value){
  1236. $data['timeDifference'][$key] = [
  1237. '时间' => round((strtotime($value['最大时间'])-strtotime($value['时间']))/3600,2),
  1238. '状态' => $value['状态'] = null?'待单':$value['状态'],
  1239. ];
  1240. if ($value['状态'] === '生产'){
  1241. $data['当班产量'] = $value['最大产量']-$value['当班产量'];
  1242. }
  1243. }
  1244. }else{
  1245. $data['timeDifference'][0] = [
  1246. '时间' => 0,
  1247. '状态' => '待单'
  1248. ];
  1249. $data['当班产量'] = 0;
  1250. }
  1251. //机台产能/时间明细
  1252. $row = \db('设备_产量采集')
  1253. ->where('设备编号',$param['machine'])
  1254. ->where('开工时间',$param['start'])
  1255. ->where('当班产量','<>',-1)
  1256. ->field('rtrim(时间) as 时间,rtrim(当班产量) as 产量,rtrim(当前状态) as 状态')
  1257. ->select();
  1258. if (empty($row)){
  1259. $data['row'] = [];
  1260. }
  1261. foreach ($row as $key=>$value){
  1262. $data['row'][$key]['时间'] = date('Y-m-d H:i',strtotime($value['时间']));
  1263. $data['row'][$key]['状态'] = $value['状态'];
  1264. if ($key<2){
  1265. $data['row'][$key]['产能'] = 0;
  1266. }else{
  1267. $data['row'][$key]['产能'] = ($row[$key-1]['产量']-$row[$key-2]['产量'])*60;
  1268. }
  1269. }
  1270. //机台状态
  1271. $status = end($row);
  1272. if (empty($status['状态'])){
  1273. $data['status'] = '待单';
  1274. }else{
  1275. $data['status'] = $status['状态'];
  1276. }
  1277. //检验数据
  1278. $list = \db('制程检验_记录')
  1279. ->where('开工时间',$param['start'])
  1280. ->where('设备编号',$param['machine'])
  1281. ->where('sys_rq','>',$param['start'])
  1282. ->where('工单编号',$machineDetail['工单编号'])
  1283. ->field('rtrim(类别) as 类别,提交时间')
  1284. ->select();
  1285. $data['首件'] = $data['自检'] = $data['IPQC'] = [];
  1286. if (!empty($list)){
  1287. foreach ($list as $key=>$value){
  1288. if ($value['类别'] == '首件与过程确认'){
  1289. array_push($data['首件'],$value['提交时间']);
  1290. }
  1291. if ($value['类别'] == '机台检验'){
  1292. array_push($data['自检'],$value['提交时间']);
  1293. }
  1294. if ($value['类别'] == 'IPQC检验'){
  1295. array_push($data['IPQC'],$value['提交时间']);
  1296. }
  1297. }
  1298. $data['首件'] = array_values(array_unique($data['首件']));
  1299. $data['自检'] = array_values(array_unique($data['自检']));
  1300. $data['IPQC'] = array_values(array_unique($data['IPQC']));
  1301. }else{
  1302. $data['首件'] = [];
  1303. $data['自检'] = [];
  1304. $data['IPQC'] = [];
  1305. }
  1306. $this->success('成功',$data);
  1307. }
  1308. /**
  1309. * 制程检验记录->检验项目
  1310. * @ApiMethod (GET)
  1311. * @param void
  1312. * @return void
  1313. * @throws \think\db\exception\DataNotFoundException
  1314. * @throws \think\db\exception\ModelNotFoundException
  1315. * @throws \think\exception\DbException
  1316. */
  1317. public function ProcessInspectionRecordsItem()
  1318. {
  1319. if ($this->request->isGet() === false){
  1320. $this->error('请求错误');
  1321. }
  1322. $param = $this->request->param();
  1323. if (empty($param)){
  1324. $this->error('参数错误');
  1325. }
  1326. $list = \db('制程检验_项目')
  1327. ->where('工序','like','%'.$param['process'].'%')
  1328. ->select();
  1329. if (empty($list)){
  1330. $this->success('未找到检测项目');
  1331. }
  1332. $data = [];
  1333. foreach ($list as $key=>$value){
  1334. $data['首件']['指标检验'][$key] = [
  1335. '检验项目' => rtrim($value['检测项目']),
  1336. '检测方法' => rtrim($value['检测方法']),
  1337. '检验频率' => rtrim($value['首件签样要求']),
  1338. '相关标准' => rtrim($value['技术要求'])
  1339. ];
  1340. $data['机台检验']['指标检验'][$key] = [
  1341. '检验项目' => rtrim($value['检测项目']),
  1342. '检测方法' => rtrim($value['检测方法']),
  1343. '检验频率' => rtrim($value['机台自检频率']),
  1344. '相关标准' => rtrim($value['技术要求'])
  1345. ];
  1346. $data['IPQC']['指标检验'][$key] = [
  1347. '检验项目' => rtrim($value['检测项目']),
  1348. '检测方法' => rtrim($value['检测方法']),
  1349. '检验频率' => rtrim($value['IPQC检验频率']),
  1350. '相关标准' => rtrim($value['技术要求'])
  1351. ];
  1352. }
  1353. $row = \db('制程检验_项目附加')
  1354. ->where('工序','like','%'.$param['process'].'%')
  1355. ->select();
  1356. foreach ($row as $key=>$value){
  1357. $data['首件']['附加'][$key] = [
  1358. '缺陷备注' => rtrim($value['缺陷备注']),
  1359. '编号' => rtrim($value['编号'])
  1360. ];
  1361. $data['机台检验']['附加'][$key] = [
  1362. '缺陷备注' => rtrim($value['缺陷备注']),
  1363. '编号' => rtrim($value['编号'])
  1364. ];
  1365. $data['IPQC']['附加'][$key] = [
  1366. '缺陷备注' => rtrim($value['缺陷备注']),
  1367. '编号' => rtrim($value['编号'])
  1368. ];
  1369. }
  1370. $this->success('成功',$data);
  1371. }
  1372. /**
  1373. * 制程检验记录->检测记录添加
  1374. * @ApiMethod (POST)
  1375. * @param void
  1376. * @return void
  1377. * @throws \think\db\exception\DataNotFoundException
  1378. * @throws \think\db\exception\ModelNotFoundException
  1379. * @throws \think\exception\DbException
  1380. */
  1381. public function ProcessInspectionRecordsItemAdd()
  1382. {
  1383. if (Request::instance()->isPost() === false){
  1384. $this->error('请求错误');
  1385. }
  1386. $param = Request::instance()->post();
  1387. if (empty($param)){
  1388. $this->error('参数错误');
  1389. }
  1390. $startID = \db('制程检验_记录')->order('UniqId desc')->value('UniqId');
  1391. if (empty($startID)){
  1392. $startID = 0;
  1393. }
  1394. $process = \db('工单_工艺资料')
  1395. ->where('Gy0_gdbh',$param[0]['workOrder'])
  1396. ->where('Gy0_sbbh','like','%'.$param[0]['machine'].'#'.'%')
  1397. ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
  1398. ->find();
  1399. $startTime = \db('设备_产量采集')
  1400. ->where('设备编号','like','%'.$param[0]['machine'].'#%')
  1401. ->where('工单编号',$param[0]['workOrder'])
  1402. ->order('UniqId desc')
  1403. ->find();
  1404. if ((int)$process['gxh']<10){
  1405. $process['gxh'] = '0'.$process['gxh'];
  1406. }
  1407. if ($process['add_gxmc'] !== ''){
  1408. $printName = $process['gxh'].'-'.$process['gxmc'].'【'.$process['add_gxmc'].'】';
  1409. }else{
  1410. $printName = $process['gxh'].'-'.$process['gxmc'];
  1411. }
  1412. if (empty($process)){
  1413. $this->success('数据错误');
  1414. }
  1415. $data = [];
  1416. foreach ($param as $key=>$value){
  1417. $data[$key] = [
  1418. '类别' => $value['category'],
  1419. '工单编号' => $value['workOrder'],
  1420. '印件号' => $value['yjno'],
  1421. '工序名称' => $printName,
  1422. '流程单号' => $value['flow'],
  1423. '设备编号' => $value['machine'].'#',
  1424. '班组编号' => $startTime['班组编号'],
  1425. '检验项目' => $value['item'],
  1426. '相关标准' => $value['standard'],
  1427. '量测仪器' => $value['instrument'],
  1428. '检验结果' => $value['result'],
  1429. '检验备注' => $value['remark'],
  1430. '提交时间' => date('Y-m-d H:i:s',time()),
  1431. '开工时间' => rtrim($startTime['开工时间']),
  1432. 'sys_id' => '',
  1433. 'sys_rq' => date('Y-m-d H:i:s',time()),
  1434. 'mod_rq' => '0000-00-00 00:00:00',
  1435. 'UniqId' => $startID + $key +1
  1436. ];
  1437. }
  1438. $res = \db('制程检验_记录')->insertAll($data);
  1439. if ($res !== false){
  1440. $this->success('成功');
  1441. }else{
  1442. $this->error('失败');
  1443. }
  1444. }
  1445. /**
  1446. * 制程检验记录->附加检验记录添加
  1447. * @ApiMethod (POST)
  1448. * @param void
  1449. * @return void
  1450. * @throws \think\db\exception\DataNotFoundException
  1451. * @throws \think\db\exception\ModelNotFoundException
  1452. * @throws \think\exception\DbException
  1453. */
  1454. public function AdditionalInspectionRecordAdd()
  1455. {
  1456. if (Request::instance()->isPost() === false){
  1457. $this->error('请求错误');
  1458. }
  1459. $param = Request::instance()->post();
  1460. if (empty($param)){
  1461. $this->error('参数错误');
  1462. }
  1463. $startID = \db('制程检验_记录附加')->order('UniqId desc')->value('UniqId');
  1464. if (empty($startID)){
  1465. $startID = 0;
  1466. }
  1467. $process = \db('工单_工艺资料')
  1468. ->where('Gy0_gdbh',$param[0]['workOrder'])
  1469. ->where('Gy0_sbbh','like','%'.$param[0]['machine'].'#'.'%')
  1470. ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
  1471. ->find();
  1472. $startTime = \db('设备_产量采集')
  1473. ->where('设备编号','like','%'.$param[0]['machine'].'#%')
  1474. ->where('工单编号',$param[0]['workOrder'])
  1475. ->order('UniqId desc')
  1476. ->find();
  1477. if ((int)$process['gxh']<10){
  1478. $process['gxh'] = '0'.$process['gxh'];
  1479. }
  1480. if ($process['add_gxmc'] !== ''){
  1481. $printName = $process['gxh'].'-'.$process['gxmc'].'【'.$process['add_gxmc'].'】';
  1482. }else{
  1483. $printName = $process['gxh'].'-'.$process['gxmc'];
  1484. }
  1485. if (empty($process)){
  1486. $this->success('数据错误');
  1487. }
  1488. $data = [];
  1489. foreach ($param as $key=>$value){
  1490. $data[$key] = [
  1491. '工单编号' => $value['workOrder'],
  1492. '印件号' => $value['yjno'],
  1493. '工序名称' => $printName,
  1494. '流程单号' => $value['flow'],
  1495. '设备编号' => $value['machine'],
  1496. '班组编号' => $startTime['班组编号'],
  1497. '缺陷备注' => $value['remark'],
  1498. '提交时间' => date('Y-m-d H:i:s',time()),
  1499. '开工时间' => rtrim($startTime['开工时间']),
  1500. 'sys_id' => '',
  1501. 'sys_rq' => date('Y-m-d H:i:s',time()),
  1502. 'mod_rq' => '0000-00-00 00:00:00',
  1503. 'UniqId' => $startID + $key +1
  1504. ];
  1505. }
  1506. $res = \db('制程检验_记录附加')->insertAll($data);
  1507. if ($res !== false){
  1508. $this->success('成功');
  1509. }else{
  1510. $this->error('失败');
  1511. }
  1512. }
  1513. /**
  1514. * 客诉记录
  1515. * @ApiMethod (GET)
  1516. * @param void
  1517. * @return void
  1518. * @throws \think\db\exception\DataNotFoundException
  1519. * @throws \think\db\exception\ModelNotFoundException
  1520. * @throws \think\exception\DbException
  1521. */
  1522. public function ComplaintRecord()
  1523. {
  1524. if ($this->request->isGet() === false){
  1525. $this->error('请求错误');
  1526. }
  1527. $param = $this->request->param();
  1528. if (isset($param['productCode'])){
  1529. $where['产品编号'] = $param['productCode'];
  1530. }
  1531. $filed = "rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,rtrim(客诉日期) as 客诉日期,rtrim(客诉单号) as 客诉单号,
  1532. rtrim(客诉方式) as 客诉方式,rtrim(订单编号) as 订单编号,rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,
  1533. rtrim(客诉描述) as 客诉描述,rtrim(缺陷关键字) as 缺陷关键字,rtrim(客诉性质) as 客诉性质,rtrim(扣分) as 扣分,
  1534. rtrim(主要责任部门) as 主要责任部门,rtrim(次要责任部门) as 次要责任部门";
  1535. $list = \db('db_客诉记录')
  1536. ->where($where)
  1537. ->field($filed)
  1538. ->select();
  1539. if (empty($list)){
  1540. $this->success('未找到该产品客诉记录');
  1541. }
  1542. $this->success('成功',$list);
  1543. }
  1544. /**
  1545. * 设置机台班组信息
  1546. * @return void
  1547. * @throws \think\db\exception\DataNotFoundException
  1548. * @throws \think\db\exception\ModelNotFoundException
  1549. * @throws \think\exception\DbException
  1550. */
  1551. public function setMachineTeam()
  1552. {
  1553. if (Request::instance()->isPost() == false) {
  1554. $this->error('非法请求');
  1555. }
  1556. $params = Request::instance()->post();
  1557. if (!isset($params['machine']) || empty($params['machine'] )) {
  1558. $this->error('参数不能为空');
  1559. }
  1560. if (empty($params['team_id']) || empty($params['sczl_bzdh'])){
  1561. $this->error('请先选择班组成员');
  1562. }
  1563. $machine = $params['machine'] . '#';
  1564. $data = [];
  1565. $lastData = \db('设备_产量采集')
  1566. ->order('UniqId desc')
  1567. ->find();
  1568. $id = $lastData['UniqId']+1;
  1569. $data['当前状态'] = $params['status'];
  1570. $data['时间'] = date('Y-m-d H:i:s');
  1571. $data['设备编号'] = $machine;
  1572. $data['工单编号'] = empty($params['order']) ? '':$params['order'];
  1573. $data['印件号'] = empty($params['yjno']) ? '':$params['yjno'];
  1574. $data['工序号'] = empty($params['gy_name']) ? '' : (int)substr($params['gy_name'], 0, 2);
  1575. $data['工序名称'] = empty($params['gy_name']) ? '' : $params['gy_name'];
  1576. $data['当班产量'] = $params['production_now'];
  1577. $data['累计产量'] = $params['production_all'];
  1578. $data['班组编号'] = $params['sczl_bzdh'];
  1579. $data['班组ID'] = $params['team_id'];
  1580. // 获取当前时间
  1581. $current_time = time();
  1582. // 设置时间范围
  1583. $start_time1 = strtotime(date('Y-m-d') . ' 08:30:00');
  1584. $end_time1 = strtotime(date('Y-m-d') . ' 20:30:00');
  1585. $end_time2 = strtotime(date('Y-m-d') . ' 24:00:00');
  1586. $start_time3 = strtotime(date('Y-m-d', strtotime('+1 day')) . ' 08:30:00');
  1587. // 判断当前时间属于哪个时间范围
  1588. if ($current_time >= $start_time1 && $current_time <= $end_time1) {
  1589. $data['开工时间'] = date('Y-m-d') . ' 08:30:00';
  1590. } elseif ($current_time > $end_time1 && $current_time <= $end_time2) {
  1591. $data['开工时间'] = date('Y-m-d') . ' 20:30:00';
  1592. } elseif ($current_time > $end_time1 && $current_time <= $start_time3) {
  1593. $data['开工时间'] = date('Y-m-d', strtotime('+1 day')) . ' 08:30:00';
  1594. }
  1595. if (!empty($params['order']) && !empty($params['yjno'])){
  1596. $option['Gy0_gdbh'] = $params['order'];
  1597. $option['Gy0_yjno'] = $params['yjno'];
  1598. $option['Gy0_gxh'] = $data['工序号'];
  1599. $data['任务ID'] = \db('工单_工艺资料')->where($option)->value('UniqId');
  1600. }else{
  1601. $data['任务ID'] = '';
  1602. }
  1603. $data['UniqId'] = $id;
  1604. $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
  1605. $res = Db::query($sql);
  1606. if ($res === false) {
  1607. $this->error('设置失败');
  1608. } else {
  1609. $this->success('设置成功');
  1610. }
  1611. }
  1612. /**
  1613. * 首页数据
  1614. * @return void
  1615. * @throws \think\Exception
  1616. * @throws \think\db\exception\DataNotFoundException
  1617. * @throws \think\db\exception\ModelNotFoundException
  1618. * @throws \think\exception\DbException
  1619. */
  1620. public function index()
  1621. {
  1622. if ($this->request->isGet() === false){
  1623. $this->error('请求错误');
  1624. }
  1625. $nowTime = date('Y-m-d H:i:s',time());
  1626. $oldTime = (date('Y')-1).'-'.date('m-d H:i:s');
  1627. $where =[
  1628. 'Mod_rq' => ['between',[$oldTime,$nowTime]],
  1629. '行号' => '1'
  1630. ];
  1631. $data = [];
  1632. //按状态查询工单信息
  1633. $orderList = \db('工单_基本资料')
  1634. ->where($where)
  1635. ->field('count(Gd_gdbh) as 数量,rtrim(gd_statu) as 状态')
  1636. ->group('gd_statu')
  1637. ->select();
  1638. foreach ($orderList as $value){
  1639. if ($value['状态'] === '1-已完工'){
  1640. $data['workOrderData']['已完工'] = $value['数量'];
  1641. }
  1642. if ($value['状态'] === '3-计划中'){
  1643. $data['workOrderData']['计划中'] = $value['数量'];
  1644. }
  1645. }
  1646. $data['workOrderData']['排程中'] = db('工单_基本资料')->alias('a')
  1647. ->join('工单_工艺资料 b', 'a.Gd_gdbh = b.Gy0_gdbh')
  1648. ->join('产品_基本资料 c', 'a.Gd_cpdh = c.产品编号')
  1649. ->where([
  1650. 'a.gd_statu' => '2-生产中',
  1651. 'a.行号' => '1',
  1652. 'a.Mod_rq' => ['between',[$oldTime,$nowTime]],
  1653. 'b.PD_WG' => '1900-01-01 00:00:00',
  1654. 'b.Gy0_sj1' => '1900-01-01 00:00:00',
  1655. 'c.状态' => '',
  1656. ])
  1657. ->group('a.Gd_gdbh')
  1658. ->count();
  1659. $data['workOrderData']['制程中'] = db('工单_基本资料')->alias('a')
  1660. ->join('工单_工艺资料 b', 'a.Gd_gdbh = b.Gy0_gdbh')
  1661. ->join('产品_基本资料 c', 'a.Gd_cpdh = c.产品编号')
  1662. ->where([
  1663. 'a.gd_statu' => '2-生产中',
  1664. 'a.行号' => '1',
  1665. 'a.Mod_rq' => ['between',[$oldTime,$nowTime]],
  1666. 'b.PD_WG' => '1900-01-01 00:00:00',
  1667. 'b.Gy0_sj1' => ['<>', '1900-01-01 00:00:00'],
  1668. 'c.状态' => '',
  1669. ])
  1670. ->group('a.Gd_gdbh')
  1671. ->count();
  1672. //按月份查询工单信息
  1673. $data['monthData'] = \db('工单_基本资料')
  1674. ->where('Mod_rq', 'between', [$oldTime, $nowTime])
  1675. ->field('DATE_FORMAT(Mod_rq, "%Y-%m") as month, COUNT(*) as count')
  1676. ->group('month')
  1677. ->order('month')
  1678. ->select();
  1679. //查询最近十条客诉信息
  1680. $data['customer'] = \db('db_客诉记录')
  1681. ->field('rtrim(客诉描述) as 客诉描述,DATE_FORMAT(客诉日期, "%Y-%m-%d") as 日期,rtrim(UniqID) as UniqId')
  1682. ->limit(10)
  1683. ->order('Sys_rq desc')
  1684. ->select();
  1685. $this->success('成功',$data);
  1686. }
  1687. /**
  1688. * 员工信息获取
  1689. * @return void
  1690. * @throws \think\db\exception\DataNotFoundException
  1691. * @throws \think\db\exception\ModelNotFoundException
  1692. * @throws \think\exception\DbException
  1693. */
  1694. public function EmployeeData()
  1695. {
  1696. if ($this->request->isGet() === false){
  1697. $this->error('请求错误');
  1698. }
  1699. $param = $this->request->param();
  1700. if (isset($param['code']) === false){
  1701. $this->error('参数错误');
  1702. }
  1703. $res = \db('人事_基本资料')
  1704. ->where('员工编号','like',$param['code'].'%')
  1705. ->field('rtrim(员工编号) as 员工编号,rtrim(员工姓名) as 员工姓名')
  1706. ->select();
  1707. if (empty($res)){
  1708. $this->success('未找到该员工');
  1709. }
  1710. $this->success('成功',$res);
  1711. }
  1712. /**
  1713. * 换型清场添加
  1714. * @return void
  1715. * @throws \think\db\exception\BindParamException
  1716. * @throws \think\exception\PDOException
  1717. */
  1718. public function remodelDataAdd()
  1719. {
  1720. if (Request::instance()->isPost() === false){
  1721. $this->error('请求错误');
  1722. }
  1723. $param = Request::instance()->post();
  1724. if (empty($param)){
  1725. $this->error('参数错误');
  1726. }
  1727. $lastId = \db('制程_换型清场')->order('UniqId desc')->value('UniqId');
  1728. $param['sys_id'] = '['.$param['机台编号'].']';
  1729. $param['sys_rq'] = date('Y-m-d H:i:s',time());
  1730. $param['mod_rq'] = date('Y-m-d H:i:s',time());
  1731. $param['UniqId'] = $lastId + 1;
  1732. $sql = \db('制程_换型清场')->fetchSql(true)->insert($param);
  1733. $res = \db()->query($sql);
  1734. if ($res !== false){
  1735. $this->success('成功');
  1736. }else{
  1737. $this->error('失败');
  1738. }
  1739. }
  1740. /**
  1741. * 换型清场记录修改
  1742. * @return void
  1743. * @throws \think\Exception
  1744. * @throws \think\db\exception\BindParamException
  1745. * @throws \think\exception\PDOException
  1746. */
  1747. public function remodelDataEdit()
  1748. {
  1749. if (Request::instance()->isPost() === false){
  1750. $this->error('请求错误');
  1751. }
  1752. $param = Request::instance()->post();
  1753. if (empty($param)){
  1754. $this->error('参数错误');
  1755. }
  1756. $param['mod_rq'] = date('Y-m-d H:i:s',time());
  1757. $sql = \db('制程_换型清场')->fetchSql(true)->update($param);
  1758. $res = \db()->query($sql);
  1759. if ($res !== false){
  1760. $this->success('成功');
  1761. }else{
  1762. $this->error('失败');
  1763. }
  1764. }
  1765. /**
  1766. * 换型清场记录删除
  1767. * @return void
  1768. * @throws \think\Exception
  1769. * @throws \think\exception\PDOException
  1770. */
  1771. public function remodelDataDel()
  1772. {
  1773. if ($this->request->isGet() === false){
  1774. $this->error('请求错误');
  1775. }
  1776. $param = $this->request->param();
  1777. if (empty($param)){
  1778. $this->error('参数错误');
  1779. }
  1780. $res = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->delete();
  1781. if ($res !== false){
  1782. $this->success('删除成功');
  1783. }else{
  1784. $this->error('删除失败');
  1785. }
  1786. }
  1787. /**
  1788. * 印版领用记录添加
  1789. * @return void
  1790. * @throws \think\db\exception\BindParamException
  1791. * @throws \think\exception\PDOException
  1792. */
  1793. public function PrintDetailAdd()
  1794. {
  1795. if (Request::instance()->isPost() === false){
  1796. $this->error('请求错误');
  1797. }
  1798. $param = Request::instance()->post();
  1799. if (empty($param)){
  1800. $this->error('参数错误');
  1801. }
  1802. $lastId = \db('工单_印版领用记录')->order('UniqID desc')->value('UniqID');
  1803. foreach ($param as $key=>$value){
  1804. $param[$key]['Yb_领用日期'] = date('Y-m-d H:i:s',time());
  1805. $param[$key]['Sys_rq'] = date('Y-m-d H:i:s',time());
  1806. $param[$key]['Mod_rq'] = date('Y-m-d H:i:s',time());
  1807. $param[$key]['UniqID'] = $lastId + $key +1;
  1808. }
  1809. $sql = \db('工单_印版领用记录')->fetchSql(true)->insertAll($param);
  1810. $res = \db()->query($sql);
  1811. if ($res !== false){
  1812. $this->success('添加成功');
  1813. }else{
  1814. $this->error('添加失败');
  1815. }
  1816. }
  1817. /**
  1818. * 印版领用记录退还
  1819. * @return void
  1820. * @throws \think\Exception
  1821. * @throws \think\db\exception\BindParamException
  1822. * @throws \think\exception\PDOException
  1823. */
  1824. public function PrintDetailEdit()
  1825. {
  1826. if ($this->request->isGet() === false){
  1827. $this->error('请求错误');
  1828. }
  1829. $param = $this->request->param();
  1830. if (empty($param)){
  1831. $this->error('参数错误');
  1832. }
  1833. $idList = explode(',',$param['id']);
  1834. $i = 0;
  1835. foreach ($idList as $key=>$value){
  1836. $data['Yb_退还日期'] = date('Y-m-d H:i:s',time());
  1837. $data['Mod_rq'] = date('Y-m-d H:i:s',time());
  1838. $sql = \db('工单_印版领用记录')->where('UniqID',$value)->fetchSql(true)->update($data);
  1839. $res = \db()->query($sql);
  1840. if ($res === false){
  1841. $i++;
  1842. }
  1843. }
  1844. if ($i !== 0){
  1845. $this->error('退还失败');
  1846. }else{
  1847. $this->success('退还成功');
  1848. }
  1849. }
  1850. /**
  1851. * 当班产量明细修改
  1852. * @return void
  1853. * @throws \think\Exception
  1854. * @throws \think\db\exception\BindParamException
  1855. * @throws \think\exception\PDOException
  1856. */
  1857. public function chanliangEdit()
  1858. {
  1859. if (Request::instance()->isPost() === false){
  1860. $this->error('请求错误');
  1861. }
  1862. $param = Request::instance()->post();
  1863. if (empty($param['UniqId'])){
  1864. $this->error('参数错误');
  1865. }
  1866. $param['sczl_打样工时'] = $param['sczl_打样总工时'];
  1867. $param['sczl_装版工时'] = $param['sczl_装版总工时'];
  1868. $param['mod_rq'] = date('Y-m-d H:i:s',time());
  1869. $data = $param;
  1870. unset($data['UniqId']);
  1871. unset($data['sczl_rq']);
  1872. $sql = \db('设备_产量计酬')
  1873. ->where('UniqId',$param['UniqId'])
  1874. ->fetchSql(true)
  1875. ->update($data);
  1876. $res = \db()->query($sql);
  1877. if ($res !== false){
  1878. $this->success('修改成功');
  1879. }else {
  1880. $this->error('修改失败');
  1881. }
  1882. }
  1883. /**
  1884. * 获取当日上报产量详细数据
  1885. * @return void
  1886. * @throws \think\db\exception\DataNotFoundException
  1887. * @throws \think\db\exception\ModelNotFoundException
  1888. * @throws \think\exception\DbException
  1889. */
  1890. public function MachineChanliangDetail()
  1891. {
  1892. if ($this->request->isGet() === false){
  1893. $this->error('请求错误');
  1894. }
  1895. $param = $this->request->param();
  1896. if (empty($param['UniqId'])){
  1897. $this->error('参数错误');
  1898. }
  1899. $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_dedh) as dedh,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxh) as gxh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_num) as num,rtrim(sczl_sj1) as sj1,rtrim(sczl_ls) as 联数,
  1900. rtrim(sczl_sj2) as sj2,rtrim(sczl_cl) as 产量,rtrim(sczl_bzdh) as bzdh,rtrim(sczl_zcfp) as 制程废品,rtrim(sczl_zccp) as 制程次品,rtrim(sczl_前工序废) as 前工序废,rtrim(sczl_来料少数) as 来料异常,
  1901. rtrim(sczl_装版工时) as 装版工时,rtrim(sczl_保养工时) as 保养工时,rtrim(sczl_打样工时) as 打样工时,rtrim(sczl_异常停机工时) as 异常总工时,rtrim(sczl_设备运行工时) as 通电工时,
  1902. rtrim(码开始行) as 码开始行,rtrim(码结束行) as 码结束行,rtrim(码包) as 码包,rtrim(主电表) as 主电表,rtrim(辅电表) as 辅电表,rtrim(sczl_ms) as 色度数,
  1903. rtrim(sczl_异常工时1) as 异常补时,rtrim(sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,rtrim(sczl_装版工时) as 装版补产工时,rtrim(sczl_打样工时) as 打样补产工时,
  1904. sczl_bh3,sczl_bh4,sczl_bh5,sczl_bh6,sczl_bh7,sczl_bh8,sczl_bh9,sczl_bh10,sczl_rate1,sczl_rate2,sczl_rate3,sczl_rate4,sczl_rate5,sczl_rate6,sczl_rate7,
  1905. sczl_rate8,sczl_rate9,sczl_rate10,sczl_bh98,rtrim(UniqId) as UniqId';
  1906. $list = \db('设备_产量计酬')->where('UniqId',$param['UniqId'])->field($field)->find();
  1907. if (empty($list)){
  1908. $this->success('未找到产量详情信息');
  1909. }
  1910. $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$list['工单编号'])->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
  1911. $list['印件名称'] = $productName['cpmc'];
  1912. if (!empty($productName['成品名称'])){
  1913. $list['cpmc'] = $productName['成品名称'];
  1914. }elseif (empty($productName['成品名称']) && !empty($productName['cpmc'])){
  1915. $list['cpmc'] = $productName['cpmc'];
  1916. }else{
  1917. $list['cpmc'] = '';
  1918. }
  1919. for ($i=1;$i<11;$i++){
  1920. if (isset($list['sczl_bh'.$i])){
  1921. $name = \db('人事_基本资料')->where('员工编号',$list['sczl_bh'.$i])->field('rtrim(员工姓名) as name')->find();
  1922. if (isset($name['name'])){
  1923. $list['组员'.$i] = [
  1924. '编号' => $list['sczl_bh'.$i],
  1925. '姓名' => $name['name'],
  1926. '比例' => ((float)$list['sczl_rate'.$i]*100).'%'
  1927. ];
  1928. }
  1929. }
  1930. if (empty($list['sczl_bh'.$i])){
  1931. $list['组员'.$i] = [
  1932. '编号' => '',
  1933. '姓名' => '',
  1934. '比例' => ''
  1935. ];
  1936. }
  1937. unset($list['sczl_bh'.$i],$list['sczl_rate'.$i]);
  1938. }
  1939. $list['拉料'] = [
  1940. '编号' => $list['sczl_bh98'],
  1941. '姓名' => \db('人事_基本资料')->where('员工编号',$list['sczl_bh98'])->value('rtrim(员工姓名)')
  1942. ];
  1943. unset($list['sczl_bh98']);
  1944. $this->success('成功',$list);
  1945. }
  1946. /**
  1947. * 当日上报产量详细数据修改
  1948. * @return void
  1949. * @throws \think\Exception
  1950. * @throws \think\db\exception\BindParamException
  1951. * @throws \think\exception\PDOException
  1952. */
  1953. public function MachineChanliangDetailEdit()
  1954. {
  1955. if (Request::instance()->isPost() === false){
  1956. $this->error('请求错误');
  1957. }
  1958. $param = Request::instance()->post();
  1959. if (empty($param['UniqId'])){
  1960. $this->error('参数错误');
  1961. }
  1962. $param['sczl_type'] = $param['sczl_gxmc'];
  1963. $param['mod_rq'] = date('Y-m-d H:i:s',time());
  1964. $UnidId = $param['UniqId'];
  1965. unset($param['UniqId']);
  1966. unset($param['sczl_rq']);
  1967. $sql = \db('设备_产量计酬')->where('UniqId',$UnidId)->fetchSql(true)->update($param);
  1968. $res = \db()->query($sql);
  1969. if ($res !== false){
  1970. $this->success('修改成功');
  1971. }else{
  1972. $this->error('修改失败');
  1973. }
  1974. }
  1975. /**
  1976. * 产量上报数据删除
  1977. * @return void
  1978. * @throws \think\Exception
  1979. * @throws \think\exception\PDOException
  1980. */
  1981. public function ChanliangDel()
  1982. {
  1983. if ($this->request->isGet() === false){
  1984. $this->error('请求错误');
  1985. }
  1986. $param = $this->request->param();
  1987. if (empty($param['UniqId'])){
  1988. $this->error('参数错误');
  1989. }
  1990. $idList = explode(',',$param['UniqId']);
  1991. foreach ($idList as $key=>$value){
  1992. $res = \db('设备_产量计酬')
  1993. ->where('UniqId',$value)
  1994. ->delete();
  1995. }
  1996. if ($res !== false){
  1997. $this->success('删除成功');
  1998. }else{
  1999. $this->error('删除失败');
  2000. }
  2001. }
  2002. /**
  2003. * 日产量上报添加
  2004. * @return void
  2005. * @throws \think\db\exception\BindParamException
  2006. * @throws \think\exception\PDOException
  2007. */
  2008. public function ChanliangAdd()
  2009. {
  2010. if (Request::instance()->isPost() === false){
  2011. $this->error('请求错误');
  2012. }
  2013. $params = Request::instance()->post();
  2014. if (empty($params['sczl_gdbh'])){
  2015. $this->error('参数错误');
  2016. }
  2017. $lastId = \db('设备_产量计酬')->order('UniqId desc')->value('rtrim(UniqId)');
  2018. $params['sczl_type'] = $params['sczl_gxmc'];
  2019. $params['sczl_wgsj'] = '1900-01-01 00:00:00';
  2020. $params['sczl_废品率系数'] = 0;
  2021. $params['sys_rq'] = date('Y-m-d H:i:s',time());
  2022. $params['mod_rq'] = date('Y-m-d H:i:s',time());
  2023. $params['UniqId'] = $lastId + 1;
  2024. $sql = \db('设备_产量计酬')->fetchSql(true)->insert($params);
  2025. $res = \db()->query($sql);
  2026. if ($res !== false){
  2027. $this->success('成功');
  2028. }else{
  2029. $this->error('失败');
  2030. }
  2031. }
  2032. /**
  2033. * 日产量上报添加获取工单信息
  2034. * @return void
  2035. * @throws \think\db\exception\DataNotFoundException
  2036. * @throws \think\db\exception\ModelNotFoundException
  2037. * @throws \think\exception\DbException
  2038. */
  2039. public function ChanliangWorkorder()
  2040. {
  2041. if ($this->request->isGet() === false)
  2042. {
  2043. $this->error('请求错误');
  2044. }
  2045. $param = $this->request->param();
  2046. if (empty($param)){
  2047. $this->error('参数错误');
  2048. }
  2049. // $where = [
  2050. // 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
  2051. // ];
  2052. // if (!empty($param['machine'])){
  2053. // $where = [
  2054. // 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
  2055. // ];
  2056. // }
  2057. if (!empty($param['search'])){
  2058. $where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
  2059. }
  2060. $list = \db('工单_基本资料')
  2061. ->alias('a')
  2062. ->field('rtrim(Gd_gdbh) as gdbh,rtrim(成品名称) as cpmc')
  2063. ->join('工单_工艺资料 b','a.Gd_gdbh = b.Gy0_gdbh')
  2064. ->where($where)
  2065. ->select();
  2066. if (empty($list)){
  2067. $this->success('未找到相关工单');
  2068. }else{
  2069. $this->success('成功',$list);
  2070. }
  2071. }
  2072. /**
  2073. * 日产量上报工单印件资料
  2074. * @return void
  2075. * @throws \think\db\exception\DataNotFoundException
  2076. * @throws \think\db\exception\ModelNotFoundException
  2077. * @throws \think\exception\DbException
  2078. */
  2079. public function ChanliangPrintDetail()
  2080. {
  2081. if ($this->request->isGet() === false){
  2082. $this->error('请求错误');
  2083. }
  2084. $param = $this->request->param();
  2085. if (empty($param['gdbh'])){
  2086. $this->error('参数错误');
  2087. }
  2088. $where = [
  2089. 'Yj_Gdbh' => $param['gdbh']
  2090. ];
  2091. $list = \db('工单_印件资料')
  2092. ->where($where)
  2093. ->field('rtrim(yj_Yjno) as yjno,rtrim(yj_yjmc) as yjmc,rtrim(yj_ls) as ls')
  2094. ->select();
  2095. if (empty($list)){
  2096. $this->success('未找到印件资料');
  2097. }else{
  2098. $this->success('成功',$list);
  2099. }
  2100. }
  2101. /**
  2102. * 日产量上报工艺资料获取
  2103. * @return void
  2104. * @throws \think\db\exception\DataNotFoundException
  2105. * @throws \think\db\exception\ModelNotFoundException
  2106. * @throws \think\exception\DbException
  2107. */
  2108. public function ChanliangProcessDetail()
  2109. {
  2110. if ($this->request->isGet() === false){
  2111. $this->error('请求错误');
  2112. }
  2113. $param = $this->request->param();
  2114. if (empty($param['gdbh'])){
  2115. $this->error('参数错误');
  2116. }
  2117. // $sys_bh = \db('dic_lzde')->where('适用机型',$param['machine'])->value('sys_bh');
  2118. $list = \db('工单_工艺资料')
  2119. ->where('Gy0_gdbh',$param['gdbh'])
  2120. ->where('Gy0_yjno',$param['yjno'])
  2121. // ->where('Gy0_sbbh','like','%'.$param['machine'].'%')
  2122. ->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
  2123. ->select();
  2124. if (empty($list)){
  2125. $this->success('未获取工序');
  2126. }
  2127. // $time = \db('设备_产量计酬')
  2128. // ->where('sczl_gdbh',$param['gdbh'])
  2129. // ->where('sczl_yjno',$param['yjno'])
  2130. // ->where('sczl_jtbh','like','%'.$param['machine'].'%')
  2131. // ->order('UniqId desc')
  2132. // ->value('sczl_sj2');
  2133. // $newTime = date('Y-m-d H:i:s');
  2134. // if ($newTime > date('Y-m-d 08:30:00') && $newTime < date('Y-m-d 20:30:00') && $time < date('Y-m-d 08:30:00')){
  2135. // $time = date('Y-m-d 08:30:00');
  2136. // }elseif ($newTime > date('Y-m-d 20:30:00') && $time < date('Y-m-d 20:30:00')){
  2137. // $time = date('Y-m-d 20:30:00');
  2138. // }
  2139. foreach ($list as $key=>$value){
  2140. if ((int)$value['gxh'] < 10){
  2141. $value['gxh'] = '0'.$value['gxh'];
  2142. }
  2143. if (empty($value['add_gxmc'])){
  2144. $list[$key]['name'] = $value['gxh'].'-'.$value['gxmc'];
  2145. }else{
  2146. $list[$key]['name'] = $value['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
  2147. }
  2148. unset( $list[$key]['add_gxmc']);
  2149. // $list[$key]['time'] = $time;
  2150. }
  2151. // $list['sys_bh'] = $sys_bh;
  2152. $this->success('成功',$list);
  2153. }
  2154. /**
  2155. * 工价系数修改
  2156. * @return void
  2157. * @throws \think\Exception
  2158. * @throws \think\db\exception\BindParamException
  2159. * @throws \think\exception\PDOException
  2160. */
  2161. public function CoefficientEdit()
  2162. {
  2163. if (Request::instance()->isPost() === false){
  2164. $this->error('请求错误');
  2165. }
  2166. $params = Request::instance()->post();
  2167. if (empty($params['id'])){
  2168. $this->error('参数错误');
  2169. }
  2170. $idList = explode(',',$params['id']);
  2171. $i=0;
  2172. foreach ($idList as $key=>$value){
  2173. $sql = \db('设备_产量计酬')
  2174. ->where('UniqId',$value)
  2175. ->fetchSql(true)
  2176. ->update(['sczl_工价系数'=>$params['工价系数']]);
  2177. $res = \db()->query($sql);
  2178. if ($res === false){
  2179. $i++;
  2180. }
  2181. }
  2182. if ($i!==0){
  2183. $this->error('修改失败');
  2184. }else{
  2185. $this->success('修改成功');
  2186. }
  2187. }
  2188. /**
  2189. * 色度系数修改
  2190. * @return void
  2191. * @throws \think\Exception
  2192. * @throws \think\db\exception\BindParamException
  2193. * @throws \think\exception\PDOException
  2194. */
  2195. public function ChromaDataEdit()
  2196. {
  2197. if (Request::instance()->isPost() === false){
  2198. $this->error('请求错误');
  2199. }
  2200. $params = Request::instance()->post();
  2201. if (empty($params['id'])){
  2202. $this->error('参数错误');
  2203. }
  2204. $idList = explode(',',$params['id']);
  2205. $i=0;
  2206. foreach ($idList as $key=>$value){
  2207. $sql = \db('设备_产量计酬')
  2208. ->where('UniqId',$value)
  2209. ->fetchSql(true)
  2210. ->update(['sczl_ms'=>$params['ms']]);
  2211. $res = \db()->query($sql);
  2212. if ($res === false){
  2213. $i++;
  2214. }
  2215. }
  2216. if ($i!==0){
  2217. $this->error('修改失败');
  2218. }else{
  2219. $this->success('修改成功');
  2220. }
  2221. }
  2222. /**
  2223. * 凹印版距修改
  2224. * @return void
  2225. * @throws \think\Exception
  2226. * @throws \think\db\exception\BindParamException
  2227. * @throws \think\exception\PDOException
  2228. */
  2229. public function PrintingModeDataEdit()
  2230. {
  2231. if (Request::instance()->isPost() === false){
  2232. $this->error('请求错误');
  2233. }
  2234. $params = Request::instance()->post();
  2235. if (empty($params['id'])){
  2236. $this->error('参数错误');
  2237. }
  2238. $idList = explode(',',$params['id']);
  2239. //获取工单印件工序
  2240. $orderList = \db('设备_产量计酬')
  2241. ->where('UniqId',$idList[0])
  2242. ->field('rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as 印件号,rtrim(sczl_gxh) as 工序号')
  2243. ->find();
  2244. //修改工艺资料
  2245. $sql = \db('工单_工艺资料')
  2246. ->where([
  2247. 'Gy0_gdbh'=>$orderList['工单编号'],
  2248. 'Gy0_yjno'=>$orderList['印件号'],
  2249. 'Gy0_gxh'=>$orderList['工序号']
  2250. ])
  2251. ->fetchSql(true)
  2252. ->update(['版距'=>$params['plate'],'印刷方式'=>$params['mode']]);
  2253. $res = \db()->query($sql);
  2254. if ($res === false){
  2255. $this->error('修改失败');
  2256. }else{
  2257. $this->success('修改成功');
  2258. }
  2259. }
  2260. /**
  2261. * 废品率系数批量修改
  2262. * @return void
  2263. * @throws \think\Exception
  2264. * @throws \think\db\exception\BindParamException
  2265. * @throws \think\exception\PDOException
  2266. */
  2267. public function RejectionEdit()
  2268. {
  2269. if (Request::instance()->isPost() === false){
  2270. $this->error('请求错误');
  2271. }
  2272. $params = Request::instance()->post();
  2273. if (empty($params['id'])){
  2274. $this->error('参数错误');
  2275. }
  2276. $idList = explode(',',$params['id']);
  2277. $i=0;
  2278. foreach ($idList as $key=>$value){
  2279. $sql = \db('设备_产量计酬')
  2280. ->where('UniqId',$value)
  2281. ->fetchSql(true)
  2282. ->update(['sczl_废品率系数'=>$params['rejection']]);
  2283. $res = \db()->query($sql);
  2284. if ($res === false){
  2285. $i++;
  2286. }
  2287. }
  2288. if ($i!==0){
  2289. $this->error('修改失败');
  2290. }else{
  2291. $this->success('修改成功');
  2292. }
  2293. }
  2294. /**
  2295. * 日产量上报班组信息批量修改
  2296. * @return void
  2297. * @throws \think\Exception
  2298. * @throws \think\db\exception\BindParamException
  2299. * @throws \think\db\exception\DataNotFoundException
  2300. * @throws \think\db\exception\ModelNotFoundException
  2301. * @throws \think\exception\DbException
  2302. * @throws \think\exception\PDOException
  2303. */
  2304. public function YieldTeamEdit()
  2305. {
  2306. if ($this->request->isGet() === false){
  2307. $this->error('请求错误');
  2308. }
  2309. $param = $this->request->param();
  2310. if (empty($param['Uniqid']) || empty($param['teamID'])){
  2311. $this->error('参数错误');
  2312. }
  2313. $idList = explode(',',$param['Uniqid']);
  2314. $teamList = \db('设备_班组资料')->where('UniqId',$param['teamID'])->find();
  2315. $data = [];
  2316. for ($i=1;$i<11;$i++){
  2317. $data['sczl_bh'.$i] = $teamList['sczl_bh'.$i];
  2318. $data['sczl_rate'.$i] = $teamList['sczl_rate'.$i];
  2319. $data['sczl_bzdh'] = $teamList['sczl_bzdh'];
  2320. }
  2321. $j = 0;
  2322. foreach ($idList as $key => $value){
  2323. $sql = \db('设备_产量计酬')
  2324. ->where('UniqId',$value)
  2325. ->fetchSql(true)
  2326. ->update($data);
  2327. $res = \db()->query($sql);
  2328. if ($res === false){
  2329. $j++;
  2330. }
  2331. }
  2332. if ($j === 0){
  2333. $this->success('修改成功');
  2334. }else{
  2335. $this->error('修改失败');
  2336. }
  2337. }
  2338. /**
  2339. * 检品机日产量上报数据修改
  2340. * @return void
  2341. * @throws \think\Exception
  2342. * @throws \think\db\exception\BindParamException
  2343. * @throws \think\exception\PDOException
  2344. */
  2345. public function JpChanliangEdit()
  2346. {
  2347. if (Request::instance()->isPost() == false){
  2348. $this->error('非法请求');
  2349. }
  2350. $params = Request::instance()->post();
  2351. if (empty($params['UniqId'])){
  2352. $this->error('参数错误');
  2353. }
  2354. $params['mod_rq'] = date('Y-m-d H:i:s');
  2355. $data = $params;
  2356. $data['sczl_装版总工时'] = $params['sczl_装版工时'];
  2357. unset($data['UniqId']);
  2358. unset($data['sczl_rq']);
  2359. $sql = \db('设备_产量计酬')->where('UniqId',$params['UniqId'])->fetchSql(true)->update($data);
  2360. $res = \db()->query($sql);
  2361. if ($res === false){
  2362. $this->error('修改失败');
  2363. }else{
  2364. $this->success('成功');
  2365. }
  2366. }
  2367. /**
  2368. * 检品机日产量上报数据列表
  2369. * @return void
  2370. * @throws \think\db\exception\DataNotFoundException
  2371. * @throws \think\db\exception\ModelNotFoundException
  2372. * @throws \think\exception\DbException
  2373. */
  2374. public function JPmachineDetail()
  2375. {
  2376. if ($this->request->isGet() === false){
  2377. $this->error('请求错误');
  2378. }
  2379. $machine = input('machine');
  2380. $date = input('date');
  2381. $where = [
  2382. 'sczl_jtbh' => $machine,
  2383. 'sczl_rq' => date('Y-m-d H:i:s',strtotime($date.' 00:00:00')),
  2384. ];
  2385. $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_dedh) as dedh,rtrim(sczl_yjno) as yjno,rtrim(sczl_gxh) as gxh,rtrim(sczl_gxmc) as gxmc,rtrim(sczl_type) as 检验类型,rtrim(sczl_num) as num,rtrim(sczl_cl) as 计件箱数,
  2386. rtrim(sczl_Pgcl) as 每箱数量,rtrim(sczl_bzdh) as bzdh,IF(sczl_废品率系数 = 0, "",sczl_废品率系数) as 废品率系数,IF(sczl_装版工时 = 0, "",sczl_装版工时) as 换膜补时, IF(sczl_保养工时 = 0, "",sczl_保养工时) as 保养工时,IF(sczl_异常停机工时 = 0, "",sczl_异常停机工时) as 异常总工时,IF(sczl_设备运行工时 = 0, "",sczl_设备运行工时) as 通电工时,
  2387. rtrim(sys_id) as 用户,rtrim(mod_rq) as 更新时间,IF(sczl_异常工时1 = 0, "",sczl_异常工时1) as 异常补时,IF(sczl_异常类型1 = 0, "",sczl_异常类型1) as 异常类型,sczl_bh1,sczl_bh2,
  2388. sczl_bh3,sczl_bh4,sczl_bh5,sczl_bh6,sczl_bh7,sczl_bh8,sczl_bh9,sczl_bh10,sczl_rate1,sczl_rate2,sczl_rate3,sczl_rate4,sczl_rate5,sczl_rate6,sczl_rate7,
  2389. sczl_rate8,sczl_rate9,sczl_rate10,sczl_bh98,rtrim(UniqId) as UniqId,rtrim(sczl_工价系数) as 难度系数,rtrim(sczl_dedh) as 定额代号,sczl_rq,sczl_装版总工时 as 换膜总工时';
  2390. //机台信息
  2391. $machineDetail = \db('设备_基本资料')->where('设备编号',$machine)->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额')->find();
  2392. //组员信息
  2393. $list = \db('设备_产量计酬')->where($where)->field($field)->select();
  2394. $totalA = \db('设备_产量计酬')
  2395. ->where($where)
  2396. ->where('sczl_bzdh','like','A%')
  2397. ->field('sczl_type as 检验类型,SUM(sczl_cl) as 箱数')
  2398. ->group('检验类型')
  2399. ->select();
  2400. $totalB = \db('设备_产量计酬')
  2401. ->where($where)
  2402. ->where('sczl_bzdh','like','B%')
  2403. ->field('sczl_type as 检验类型,SUM(sczl_cl) as 箱数')
  2404. ->group('检验类型')
  2405. ->select();
  2406. if (empty($list)){
  2407. $this->success('',[]);
  2408. }
  2409. foreach ($list as $key=>$value){
  2410. //产品名称
  2411. $productName = \db('工单_基本资料')->whereIn('Gd_gdbh',$value['工单编号'])->field('rtrim(成品名称) as 成品名称,rtrim(Gd_cpmc) as cpmc')->find();
  2412. if (!empty($productName)){
  2413. if (!empty($productName['成品名称'])){
  2414. $list[$key]['产品名称'] = $value['工单编号'].'---'.$productName['成品名称'];
  2415. $list[$key]['cpmc'] = $productName['成品名称'];
  2416. }else{
  2417. $list[$key]['产品名称'] = $value['工单编号'];
  2418. $list[$key]['cpmc'] = '';
  2419. }
  2420. }else{
  2421. $list[$key]['产品名称'] = $value['工单编号'];
  2422. $list[$key]['cpmc'] = '';
  2423. }
  2424. if (empty($value['定额代号'])){
  2425. $list[$key]['千件工价'] = '';
  2426. $list[$key]['日定额'] = '';
  2427. $list[$key]['补产标准'] = '';
  2428. }else{
  2429. $row = \db('dic_lzde')->where('sys_bh',$value['定额代号'])->field('rtrim(千件工价) as 千件工价,rtrim(日定额) as 日定额,rtrim(补产标准) as 补产标准')->find();
  2430. $list[$key]['千件工价'] = $row['千件工价'];
  2431. $list[$key]['日定额'] = $row['日定额'];
  2432. $list[$key]['补产标准'] = $row['补产标准'];
  2433. }
  2434. $list[$key]['工序'] = $list[$key]['yjno'].'-'.$list[$key]['gxmc'];
  2435. for ($i=1;$i<11;$i++){
  2436. if (isset($value['sczl_bh'.$i])){
  2437. $name = \db('人事_基本资料')->where('员工编号',$value['sczl_bh'.$i])->field('员工姓名 as name')->find();
  2438. if (isset($name['name'])){
  2439. $list[$key]['组员'.$i] = $value['sczl_bh'.$i].$name['name'].'('.((float)$value['sczl_rate'.$i]*100).'%'.')';
  2440. $list[$key]['sczl_name'.$i] = $name['name'];
  2441. }else{
  2442. $list[$key]['sczl_name'.$i] = '';
  2443. }
  2444. }
  2445. }
  2446. }
  2447. $list['totalA'] = $totalA;
  2448. $list['totalB'] = $totalB;
  2449. $this->success('成功',$list);
  2450. }
  2451. //设备运行跟踪月度数据导出
  2452. // public function MouthDataOutput()
  2453. // {
  2454. // if ($this->request->isGet() === false){
  2455. // $this->error('参数错误');
  2456. // }
  2457. // $param = $this->request->param();
  2458. // if (empty($param)){
  2459. // $this->error('参数错误');
  2460. // }
  2461. // $filed = "工单编号,产品名称,流程单号,印件号,工序号,机台编号,日期,工序产量,工序名称,机长工号,机长名称,组员工号1,组员姓名1,";
  2462. // }
  2463. }