CostAccounting.php 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Request;
  5. /**
  6. * 各月制造费用维护
  7. */
  8. class CostAccounting extends Api
  9. {
  10. protected $noNeedLogin = ['*'];
  11. protected $noNeedRight = ['*'];
  12. /**
  13. * 各月制造费用维护菜单
  14. * @return void
  15. */
  16. public function getTab()
  17. {
  18. // 1. 请求方法验证
  19. if (!$this->request->isGet()) {
  20. $this->error('仅支持GET请求');
  21. }
  22. // 2. 使用静态变量避免重复创建数组
  23. static $tabs, $sist;
  24. if ($tabs === null) {
  25. $tabs = [
  26. '1、月度人工数据',
  27. '2、水电气直接费用',
  28. '3、水电气分摊费用',
  29. '4、其他待摊费用',
  30. '5、车间色度数'
  31. ];
  32. $sist = ['胶印车间', '凹丝印车间', '印后车间'];
  33. }
  34. // 3. 数据库查询优化
  35. $months = db('成本v23_月度成本明细')
  36. ->field('sys_ny AS year_month')
  37. ->group('sys_ny')
  38. ->order('sys_ny DESC')
  39. ->column('sys_ny');
  40. // 4. 使用模板构建策略
  41. $data = [];
  42. $template = [];
  43. // 预构建模板
  44. foreach ($tabs as $tab) {
  45. $template[$tab] = ($tab === '2、水电气直接费用') ? $sist : $tab;
  46. }
  47. // 仅需单次循环赋值
  48. foreach ($months as $month) {
  49. $data[$month] = $template;
  50. }
  51. $this->success('成功', $data);
  52. }
  53. /**
  54. * 月度车间人工维护
  55. * @return void
  56. * @throws \think\db\exception\BindParamException
  57. * @throws \think\exception\PDOException
  58. */
  59. public function ArtificialAdd()
  60. {
  61. if($this->request->isPost() === false){
  62. $this->error('请求错误');
  63. }
  64. $param = Request::instance()->post();
  65. if (empty($param)) {
  66. $this->error('参数错误');
  67. }
  68. $data = [];
  69. foreach ($param as $key => $value) {
  70. $data[$key] = [
  71. 'Sys_ny' => $value['sys_ny'],
  72. '车间' => $value['sist'],
  73. '一线工资总额' => $value['number'],
  74. 'Sys_id' => $value['sys_id'],
  75. 'Sys_rq' => date('Y-m-d H:i:s', time())
  76. ];
  77. }
  78. $sql = db('成本v23_各月人工')->fetchSql(true)->insertAll($data);
  79. $res = db()->query($sql);
  80. if ($res !== false) {
  81. $this->success('新增成功');
  82. }else{
  83. $this->error('添加失败');
  84. }
  85. }
  86. /**
  87. * 月度人工维护列表
  88. * @return void
  89. * @throws \think\db\exception\DataNotFoundException
  90. * @throws \think\db\exception\ModelNotFoundException
  91. * @throws \think\exception\DbException
  92. */
  93. public function ArtificialAddList()
  94. {
  95. if($this->request->isGet() === false){
  96. $this->error('请求错误');
  97. }
  98. $param = $this->request->param();
  99. if (empty($param) || empty($param['Sys_ny'])) {
  100. $this->error('参数错误');
  101. }
  102. $list = db('成本v23_各月人工')
  103. ->where('Sys_ny', $param['Sys_ny'])
  104. ->field('Sys_ny, 车间, 一线工资总额, Sys_id as 创建用户, Sys_rq as 创建时间,Mod_rq as 修订时间,UniqID')
  105. ->select();
  106. $this->success('成功', $list);
  107. }
  108. /**
  109. * 月度人工维护修改
  110. * @return void
  111. * @throws \think\Exception
  112. * @throws \think\db\exception\BindParamException
  113. * @throws \think\exception\PDOException
  114. */
  115. public function ArtificialEdit()
  116. {
  117. if($this->request->isPost() === false){
  118. $this->error('请求错误');
  119. }
  120. $param = Request::instance()->post();
  121. if (empty($param)) {
  122. $this->error('参数错误');
  123. }
  124. $i = 0;
  125. foreach ($param as $value) {
  126. $sql = db('成本v23_各月人工')
  127. ->where('UniqID', $value['UniqID'])
  128. ->fetchSql(true)
  129. ->update(['一线工资总额'=>$value['number'],'Mod_rq'=>date('Y-m-d H:i:s', time())]);
  130. $res = db()->query($sql);
  131. if ($res === false) {
  132. $i++;
  133. }
  134. }
  135. if ($i === 0) {
  136. $this->success('修改成功');
  137. }else{
  138. $this->error('修改失败');
  139. }
  140. }
  141. /**
  142. * 月度人工数据右侧上方列表
  143. * @return void
  144. * @throws \think\db\exception\DataNotFoundException
  145. * @throws \think\db\exception\ModelNotFoundException
  146. * @throws \think\exception\DbException
  147. */
  148. public function ArtificialList()
  149. {
  150. if (!$this->request->isGet()) {
  151. $this->error('仅支持GET请求');
  152. }
  153. $month = $this->request->param('month');
  154. if (empty($month)) {
  155. $this->error('month参数缺失或为空');
  156. }
  157. $list = db('成本v23_各月人工')->alias('a')
  158. ->join('设备_基本资料 b', 'a.车间 = b.使用部门')
  159. ->join('绩效工资汇总 c', 'a.Sys_ny = c.sys_ny AND c.sczl_jtbh = b.设备编号')
  160. ->join('成本_各月其他费用 d', 'a.Sys_ny = d.sys_ny','left')
  161. ->field([
  162. 'a.Sys_ny' => '年月',
  163. 'rtrim(a.车间)' => '车间',
  164. 'SUM(c.个人计件工资) + SUM(c.个人加班工资)' => '人工分摊因子总额',
  165. 'a.一线工资总额' => '车间实发工资',
  166. 'd.部门人员工资' => '部门人员工资实发',
  167. 'd.管理人员工资' => '管理人员工资实发'
  168. ])
  169. ->where('a.Sys_ny', $month)
  170. ->group('a.Sys_ny, a.车间')
  171. ->select();
  172. if (empty($list)) {
  173. $this->success('未找到匹配数据', []);
  174. }
  175. $this->success('获取成功', $list);
  176. }
  177. /**
  178. * 月度人工数据下方工单详情
  179. * @return void
  180. * @throws \think\db\exception\DataNotFoundException
  181. * @throws \think\db\exception\ModelNotFoundException
  182. * @throws \think\exception\DbException
  183. */
  184. public function ArtificialDetailList()
  185. {
  186. if ($this->request->isGet() === false) {
  187. $this->error('请求错误');
  188. }
  189. $param = $this->request->param();
  190. if (empty($param)) {
  191. $this->error('参数错误');
  192. }
  193. $month = $param['month'];
  194. $sist = $param['sist'];
  195. $list = db('工单_质量考核汇总')
  196. ->alias('a')
  197. ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号')
  198. ->join('工单_印件资料 c', 'a.Gy0_gdbh = c.Yj_Gdbh and a.印件及工序 = c.yj_Yjno')
  199. ->join('工单_工艺资料 d', 'a.Gy0_gdbh = d.Gy0_gdbh and a.印件及工序 = d.Gy0_yjno and a.工序 = d.Gy0_gxh')
  200. ->field([
  201. 'a.sys_ny' => '年月',
  202. 'a.Gy0_gdbh' => '工单编号',
  203. 'a.印件及工序' => '印件号',
  204. 'a.工序' => '工序号',
  205. 'c.yj_yjmc' => '印件名称',
  206. 'd.Gy0_gxmc' => '工序名称',
  207. 'a.印件工序产量' => '班组车头产量',
  208. 'd.工价系数' => '工序难度系数',
  209. 'SUM(a.CjsJe)' => '计件工资',
  210. 'rtrim(b.使用部门)' => '车间名称',
  211. ])
  212. ->where('a.Sys_ny', $month)
  213. ->where('b.使用部门', $sist)
  214. ->group('a.Sys_ny, a.Gy0_gdbh,a.印件及工序,a.印件及工序')
  215. ->order('a.Gy0_gdbh')
  216. ->select();
  217. if (empty($list)) {
  218. $this->success('未找到数据');
  219. }else{
  220. $this->success('成功', $list);
  221. }
  222. }
  223. /**
  224. * 水电气直接费用右侧列表
  225. * @return void
  226. * @throws \think\db\exception\DataNotFoundException
  227. * @throws \think\db\exception\ModelNotFoundException
  228. * @throws \think\exception\DbException
  229. */
  230. public function shuidianqiList()
  231. {
  232. if ($this->request->isGet() === false) {
  233. $this->error('请求错误');
  234. }
  235. $param = $this->request->param();
  236. if (empty($param)) {
  237. $this->error('参数错误');
  238. }
  239. $month = $param['month'];
  240. $sist = $param['sist'];
  241. $list = db('成本_各月水电气')
  242. ->field('rtrim(部门名称) as 部门名称,rtrim(设备编号) as 设备编号,rtrim(科目名称) as 设备名称,rtrim(耗电量) as 耗电量,
  243. rtrim(单位电价) as 单位电价,rtrim(耗气量) as 耗气量,rtrim(单位气价) as 单位气价,rtrim(Sys_id) as 创建用户,Sys_rq as 创建时间,UniqID,耗电量*单位电价 as 直接费用合计')
  244. ->where('Sys_ny', $month)
  245. ->where('部门名称', $sist)
  246. ->where('费用类型', '直接')
  247. ->group('Sys_ny, Sys_rq, UniqID')
  248. ->select();
  249. if (empty($list)) {
  250. $this->success('未找到数据');
  251. }else{
  252. $this->success('成功', $list);
  253. }
  254. }
  255. /**
  256. * 水电气下方工单详情
  257. * @return void
  258. * @throws \think\db\exception\DataNotFoundException
  259. * @throws \think\db\exception\ModelNotFoundException
  260. * @throws \think\exception\DbException
  261. */
  262. public function shuidianqiDetailList()
  263. {
  264. if ($this->request->isGet() === false) {
  265. $this->error('请求错误');
  266. }
  267. $param = $this->request->param();
  268. if (empty($param)) {
  269. $this->error('参数错误');
  270. }
  271. $month = substr($param['month'], 0, 4) . '-' . substr($param['month'], 4, 2);
  272. $machine = $param['machine'];
  273. $list = db('设备_产量计酬')
  274. ->alias('a')
  275. ->join('工单_印件资料 b', 'a.sczl_gdbh = b.Yj_Gdbh and a.sczl_yjno = b.yj_Yjno')
  276. ->field('a.sczl_gdbh as 工单编号,b.yj_yjmc as 印件名称,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,
  277. sum(a.sczl_cl)*a.sczl_ls as 班组车头产量,sum(a.sczl_设备运行工时) as 占用机时')
  278. ->where('a.sczl_rq','like', '%'.$month.'%')
  279. ->where('a.sczl_jtbh', $machine)
  280. ->group('a.sczl_gdbh, a.sczl_yjno, a.sczl_gxh')
  281. ->select();
  282. if (empty($list)) {
  283. $this->success('未找到数据');
  284. }
  285. foreach ($list as $k => $v) {
  286. $list[$k]['计件产量'] = $v['班组车头产量'];
  287. $list[$k]['水电气分摊因子'] = $v['占用机时'];
  288. $list[$k]['年月'] = $param['month'];
  289. }
  290. $this->success('成功', $list);
  291. }
  292. /**
  293. * 水电气分摊费用
  294. * @return void
  295. * @throws \think\db\exception\DataNotFoundException
  296. * @throws \think\db\exception\ModelNotFoundException
  297. * @throws \think\exception\DbException
  298. */
  299. public function shuidianqifentanList()
  300. {
  301. if ($this->request->isGet() === false) {
  302. $this->error('请求错误');
  303. }
  304. $param = $this->request->param();
  305. if (empty($param)) {
  306. $this->error('参数错误');
  307. }
  308. $month = $param['month'];
  309. $list = db('成本_各月水电气')
  310. ->field('rtrim(部门名称) as 部门名称,rtrim(设备编号) as 设备编号,rtrim(科目名称) as 设备名称,rtrim(耗电量) as 耗电量,
  311. rtrim(单位电价) as 单位电价,rtrim(耗气量) as 耗气量,rtrim(单位气价) as 单位气价,rtrim(Sys_id) as 创建用户,Sys_rq as 创建时间,UniqID,耗电量*单位电价 as 直接费用合计')
  312. ->where('Sys_ny', $month)
  313. ->where('费用类型', '分摊')
  314. ->group('Sys_ny, Sys_rq, UniqID')
  315. ->select();
  316. if (empty($list)) {
  317. $this->success('未找到数据');
  318. }else{
  319. $this->success('成功', $list);
  320. }
  321. }
  322. /**
  323. * 各月工单人工明细
  324. * @return void
  325. * @throws \think\db\exception\BindParamException
  326. * @throws \think\db\exception\DataNotFoundException
  327. * @throws \think\db\exception\ModelNotFoundException
  328. * @throws \think\exception\DbException
  329. * @throws \think\exception\PDOException
  330. */
  331. public function ChromaticityAdd()
  332. {
  333. if ($this->request->isGet() === false) {
  334. $this->error('请求错误');
  335. }
  336. $param = $this->request->param();
  337. if (empty($param)) {
  338. $this->error('参数错误');
  339. }
  340. $list = db('绩效工资汇总')
  341. ->alias('a')
  342. ->join('工单_工艺资料 b','a.sczl_gdbh = b.Gy0_gdbh and a.sczl_yjno = b.Gy0_yjno and a.sczl_gxh = b.Gy0_gxh')
  343. ->join('设备_基本资料 c','a.sczl_jtbh = c.设备编号','LEFT')
  344. ->join('工单_印件资料 d','a.sczl_gdbh = d.Yj_Gdbh and a.sczl_yjno = d.yj_Yjno')
  345. ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,sum(a.班组车头产量) as 班组车头产量,b.Gy0_gxmc as 工序名称,
  346. a.sczl_ms as 墨色数,c.使用部门,b.印刷方式,b.版距,b.工价系数,a.sczl_jtbh,d.yj_yjmc as 印件名称,sum(a.车头产量占用机时) as 占用机时,a.sys_rq as 年月,
  347. a.工序难度系数,sum(a.班组换算产量) as 班组换算产量,a.千件工价')
  348. ->where('a.sys_ny', $param['month'])
  349. ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  350. ->select();
  351. $data = [];
  352. foreach ($list as $k => $v) {
  353. if ($v['版距'] === '0.0'){
  354. $list[$k]['版距'] = 1000;
  355. }
  356. if ($v['墨色数'] === '0.00'){
  357. $list[$k]['墨色数'] = 1;
  358. }
  359. if (strpos($v['工序名称'],'切废')){
  360. $list[$k]['墨色数'] = 0.2;
  361. }
  362. $chanliang = $v['班组车头产量']*$v['工序难度系数'] + $v['班组换算产量'];
  363. $data[] = [
  364. '车间名称' => $v['使用部门'],
  365. 'sys_ny' => $param['month'],
  366. 'sczl_gdbh' => $v['工单编号'],
  367. '印件名称' => $v['印件名称'],
  368. 'sczl_yjno' => $v['印件号'],
  369. 'sczl_gxh' => $v['工序号'],
  370. '工序名称' => $v['工序名称'],
  371. 'sczl_jtbh' => $v['sczl_jtbh'],
  372. '卷张换算系数' => $list[$k]['版距']/1000,
  373. '占用机时' => $v['占用机时'],
  374. '班组车头产量' => $v['班组车头产量'],
  375. 'sczl_ms' => $list[$k]['墨色数'],
  376. '工序难度系数' => $v['工序难度系数'],
  377. '班组换算产量' => $v['班组换算产量'],
  378. '千件工价' => $v['千件工价'],
  379. '计件产量' => $chanliang,
  380. '水电分摊因子' => $v['占用机时'],
  381. '材料分摊因子' => $chanliang,
  382. '人工分摊因子' => ($chanliang/1000)*$v['千件工价'],
  383. 'Sys_id' => $param['sys_id'],
  384. 'Sys_rq' => date('Y-m-d H:i:s', time())
  385. ];
  386. }
  387. $sql = db('成本v23_月度成本明细')->fetchSql(true)->insertAll($data);
  388. $res = db()->query($sql);
  389. if ($res !== false) {
  390. $this->success('成功');
  391. }else{
  392. $this->error('失败');
  393. }
  394. }
  395. /**
  396. * 各月工单色度数
  397. * @return void
  398. * @throws \think\db\exception\BindParamException
  399. * @throws \think\db\exception\DataNotFoundException
  400. * @throws \think\db\exception\ModelNotFoundException
  401. * @throws \think\exception\DbException
  402. * @throws \think\exception\PDOException
  403. */
  404. public function ChromaticityDetailAdd()
  405. {
  406. if ($this->request->isGet() === false) {
  407. $this->error('请求错误');
  408. }
  409. $param = $this->request->param();
  410. if (empty($param)) {
  411. $this->error('参数错误');
  412. }
  413. $monthArr = db('成本v23_月度成本明细')->where(['sys_ny' => $param['month']])->select();
  414. if (empty($monthArr)) {
  415. $this->error('请先创建月度数据...');
  416. }
  417. $sist = ['胶印车间','凹丝印车间','印后车间','检验车间'];
  418. $list = db('成本v23_月度成本明细')
  419. ->alias('a')
  420. ->join('设备_基本资料 b','a.sczl_jtbh = b.设备编号')
  421. ->join('工单_工艺资料 c','a.sczl_gdbh = c.Gy0_gdbh and a.sczl_yjno = c.Gy0_yjno and a.sczl_gxh = c.Gy0_gxh')
  422. ->field('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh,a.工序名称,sum(a.计件产量) as 产量,a.sczl_jtbh,a.sczl_ms,b.使用部门,
  423. sum(a.占用机时) as 通电工时,c.Gy0_dedh,c.Gy0_gxmc')
  424. ->where('a.sys_ny', $param['month'])
  425. ->whereIn('车间名称',$sist)
  426. ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  427. ->select();
  428. if (empty($list)) {
  429. $this->error('没找到生产数据');
  430. }
  431. $data = [];
  432. foreach ($list as $k => $v) {
  433. if ($v['sczl_ms'] === '0.00'){
  434. $list[$k]['sczl_ms'] = 1;
  435. }
  436. if (strpos($v['Gy0_gxmc'],'切废') !== false){
  437. $list[$k]['sczl_ms'] = 0.2;
  438. }
  439. $data[] = [
  440. '年月' => $param['month'],
  441. 'sczl_gdbh' => $v['sczl_gdbh'],
  442. 'sczl_yjno' => $v['sczl_yjno'],
  443. 'sczl_gxh' => $v['sczl_gxh'],
  444. 'sczl_jtbh' => $v['sczl_jtbh'],
  445. 'sczl_gxmc' => $v['工序名称'],
  446. 'sczl_ms' => $v['sczl_ms'],
  447. 'sczl_dedh' => $v['Gy0_dedh'],
  448. '通电时间' => $v['通电工时'],
  449. 'sczl_cl' => $v['产量'],
  450. '部门' => $v['使用部门'],
  451. 'Sys_ID' => $param['sys_id'],
  452. 'Sys_Rq' => date('Y-m-d H:i:s', time())
  453. ];
  454. }
  455. if (db('成本_各月色度数')->where('年月',$param['month'])->count() !== 0) {
  456. db('成本_各月色度数')->where('年月',$param['month'])->delete();
  457. }
  458. $sql = db('成本_各月色度数')->fetchSql(true)->insertAll($data);
  459. $res = db()->query($sql);
  460. if ($res !== false) {
  461. $this->success('成功');
  462. }else{
  463. $this->error('失败');
  464. }
  465. }
  466. /**
  467. * 各月车间色度数列表
  468. * @return void
  469. * @throws \think\db\exception\DataNotFoundException
  470. * @throws \think\db\exception\ModelNotFoundException
  471. * @throws \think\exception\DbException
  472. */
  473. public function ChromaticityDetailList()
  474. {
  475. if ($this->request->isGet() === false) {
  476. $this->error('请求错误');
  477. }
  478. $param = $this->request->param();
  479. if (empty($param)) {
  480. $this->error('参数错误');
  481. }
  482. // 执行统计查询
  483. $stats = db('成本_各月色度数')
  484. ->field([
  485. 'rtrim(部门) AS workshop',
  486. 'SUM(sczl_cl * IF(sczl_ms=0, 1, sczl_ms)) AS total'
  487. ])
  488. ->where('部门', '<>', '') // 过滤空车间数据
  489. ->where('sczl_cl', '>', 0) // 过滤无效产量
  490. ->where('年月', $param['month'])
  491. ->group('部门')
  492. ->select();
  493. // 构造中文返回结果
  494. $result = [];
  495. foreach ($stats as $item) {
  496. $result[] = [
  497. '年月' => $param['month'],
  498. '车间' => $item['workshop'],
  499. '色度数' => number_format($item['total'], 2)
  500. ];
  501. }
  502. $this->success('成功', $result);
  503. }
  504. /**
  505. * 车间色度数详情列表
  506. * @return void
  507. * @throws \think\db\exception\DataNotFoundException
  508. * @throws \think\db\exception\ModelNotFoundException
  509. * @throws \think\exception\DbException
  510. */
  511. public function MonochromaticDetailList()
  512. {
  513. if ($this->request->isGet() === false) {
  514. $this->error('请求错误');
  515. }
  516. $param = $this->request->param();
  517. if (empty($param)) {
  518. $this->error('参数错误');
  519. }
  520. $list = db('成本_各月色度数')
  521. ->where('年月', $param['month'])
  522. ->where('部门', $param['sist'])
  523. ->order('sczl_gdbh')
  524. ->select();
  525. $this->success('成功', $list);
  526. }
  527. /**
  528. * 车间成本核算汇总
  529. * @return void
  530. * @throws \think\db\exception\DataNotFoundException
  531. * @throws \think\db\exception\ModelNotFoundException
  532. * @throws \think\exception\DbException
  533. */
  534. public function SummaryCostAccountingList()
  535. {
  536. if ($this->request->isGet() === false) {
  537. $this->error('请求错误');
  538. }
  539. $param = $this->request->param();
  540. if (empty($param)) {
  541. $this->error('参数错误');
  542. }
  543. $page = $this->request->param('page', 1);
  544. $pageSize = $this->request->param('limit', 30);
  545. $total = db('成本v23_月度成本明细')
  546. ->where('车间名称', $param['sist'])
  547. ->where('sys_ny', $param['month'])
  548. ->count();
  549. $list = db('成本v23_月度成本明细')
  550. ->where('车间名称', $param['sist'])
  551. ->where('sys_ny', $param['month'])
  552. ->order('sczl_gdbh')
  553. ->page($page, $pageSize)
  554. ->select();
  555. $data = [
  556. 'total' => $total,
  557. 'list' => $list,
  558. ];
  559. if (empty($list)) {
  560. $this->error('未找到数据');
  561. }else{
  562. $this->success('成功', $data);
  563. }
  564. }
  565. /**
  566. * 创建各月水电气分摊
  567. * @return void
  568. * @throws \think\db\exception\BindParamException
  569. * @throws \think\exception\PDOException
  570. */
  571. public function UtilitiesAdd()
  572. {
  573. if ($this->request->isPost() === false) {
  574. $this->error('请求错误');
  575. }
  576. $param = Request::instance()->post();
  577. if (empty($param)) {
  578. $this->error('参数错误');
  579. }
  580. $data = [];
  581. $currentTime = date('Y-m-d H:i:s');
  582. foreach ($param as $item) {
  583. // 验证必要字段是否存在
  584. if (empty($item['sys_ny']) || empty($item['sist']) || empty($item['科目名称'])) {
  585. $this->error('缺少必要参数');
  586. }
  587. // 确保数值字段正确处理为 decimal 类型
  588. $data[] = [
  589. 'Sys_ny' => $item['sys_ny'],
  590. '部门名称' => $item['sist'],
  591. '费用类型' => '分摊',
  592. '科目名称' => $item['科目名称'],
  593. '耗电量' => isset($item['耗电量']) ? (float)$item['耗电量'] : 0.00,
  594. '单位电价' => isset($item['单位电价']) ? (float)$item['单位电价'] : 0.00,
  595. '耗气量' => isset($item['耗气量']) ? (float)$item['耗气量'] : 0.00,
  596. '单位气价' => isset($item['单位气价']) ? (float)$item['单位气价'] : 0.00,
  597. 'Sys_id' => $item['sys_id'] ?? '',
  598. 'Sys_rq' => $currentTime
  599. ];
  600. }
  601. $result = db('成本_各月水电气')->where('Sys_ny', $data[0]['Sys_ny'])->where('费用类型','分摊')->delete();
  602. $sql = db('成本_各月水电气')->fetchSql(true)->insertAll($data);
  603. $res = db()->query($sql);
  604. if ($res !== false) {
  605. $this->success('成功');
  606. }else{
  607. $this->error('失败');
  608. }
  609. }
  610. /**
  611. * 各月水电气分摊费用列表
  612. * @return void
  613. * @throws \think\db\exception\DataNotFoundException
  614. * @throws \think\db\exception\ModelNotFoundException
  615. * @throws \think\exception\DbException
  616. */
  617. public function UtilitiesList()
  618. {
  619. if($this->request->isGet() === false){
  620. $this->error('请求错误');
  621. }
  622. $param = $this->request->param();
  623. if (empty($param)) {
  624. $this->error('参数错误');
  625. }
  626. $list = db('成本_各月水电气')
  627. ->field('rtrim(部门名称) as 部门名称,rtrim(科目名称) as 科目名称,耗电量,单位电价,耗气量,单位气价')
  628. ->where('费用类型', '分摊')
  629. ->where('Sys_ny', $param['month'])
  630. ->group('部门名称,科目名称')
  631. ->select();
  632. if (empty($list)) {
  633. $list = db('成本_各月水电气')
  634. ->field('rtrim(部门名称) as 部门名称,rtrim(科目名称) as 科目名称')
  635. ->where('费用类型', '分摊')
  636. ->group('部门名称,科目名称')
  637. ->select();
  638. }
  639. foreach ($list as $k => $v) {
  640. $list[$k]['年月'] = $param['month'];
  641. }
  642. $this->success('成功', $list);
  643. }
  644. /**
  645. * 成本汇总左侧列表
  646. * @return void
  647. */
  648. public function getSummaryTab()
  649. {
  650. if ($this->request->isGet() === false) {
  651. $this->error('请求错误');
  652. }
  653. $months = db('成本v23_月度成本明细')
  654. ->field('sys_ny AS year_month')
  655. ->group('Sys_ny')
  656. ->order('Sys_ny DESC')
  657. ->column('Sys_ny');
  658. $sist = ['胶印车间','凹丝印车间','印后车间','检验车间'];
  659. $data = [];
  660. foreach ($months as $month) {
  661. $data[$month] = $sist;
  662. }
  663. $this->success('成功', $data);
  664. }
  665. //计算每个车间色度数
  666. private function CountSistChromaticity($month,$sist)
  667. {
  668. $data = db('成本v23_月度成本明细')
  669. ->where('sys_ny', $month)
  670. ->where('车间名称', $sist)
  671. ->group('车间名称')
  672. ->value('班组车头产量*sczl_ms as 色度数');
  673. return $data;
  674. }
  675. //计算每个机台色度数
  676. private function CountMachineChromatic($month,$sist)
  677. {
  678. $data = db('成本v23_月度成本明细')
  679. ->where('sys_ny', $month)
  680. ->where('车间名称', $sist)
  681. ->group('sczl_jtbh')
  682. ->value('班组车头产量*sczl_ms as 色度数');
  683. return $data;
  684. }
  685. //水电气分摊费用下方明细列表
  686. // public function shuidianqiMachineDetailList()
  687. // {
  688. // if ($this->request->isGet() === false) {
  689. // $this->error('请求错误');
  690. // }
  691. // $param = $this->request->param();
  692. // if (empty($param)) {
  693. // $this->error('参数错误');
  694. // }
  695. // $list = db('设备_基本资料')
  696. // ->alias('a')
  697. // ->join('成本_各月分摊系数 b', 'a.设备编号 = b.设备编号', 'LEFT')
  698. // ->field()
  699. //
  700. // }
  701. /**
  702. * 其他待摊费用
  703. * @return void
  704. * @throws \think\db\exception\BindParamException
  705. * @throws \think\exception\PDOException
  706. */
  707. public function PrepaidExpensesListEdit()
  708. {
  709. if ($this->request->isPost() === false) {
  710. $this->error('请求错误');
  711. }
  712. $param = Request::instance()->post();
  713. if (empty($param)) {
  714. $this->error('参数错误');
  715. }
  716. $data = [
  717. 'sys_ny' => $param['month'],
  718. '部门人员工资' => $param['salary1'],
  719. '管理人员工资' => $param['salary2'],
  720. '场地租金' => $param['rental'],
  721. '待摊折旧' => $param['depreciation'],
  722. '工资成本占比' => $param['proportion'],
  723. '其他' => $param['rest'],
  724. '后勤人员工资' => $param['profit'],
  725. 'sys_id' => $param['sys_id'],
  726. ];
  727. $result = db('成本_各月其他费用')->where('sys_ny', $param['month'])->count();
  728. if ($result > 0) {
  729. $data['mod_rq'] = date('Y-m-d H:i:s', time());
  730. $sql = db('成本_各月其他费用')->where('sys_ny', $param['month'])->fetchSql(true)->update($data);
  731. }else{
  732. $data['sys_rq'] = date('Y-m-d H:i:s', time());
  733. $sql = db('成本_各月其他费用')
  734. ->fetchSql(true)
  735. ->insert($data);
  736. }
  737. $res = db()->query($sql);
  738. if ($res !== false) {
  739. $this->success('成功');
  740. }else{
  741. $this->error('失败');
  742. }
  743. }
  744. /**
  745. * 其他待摊费用列表
  746. * @return void
  747. * @throws \think\db\exception\DataNotFoundException
  748. * @throws \think\db\exception\ModelNotFoundException
  749. * @throws \think\exception\DbException
  750. */
  751. public function PrepaidExpensesList()
  752. {
  753. if ($this->request->isGet() === false) {
  754. $this->error('请求错误');
  755. }
  756. $param = $this->request->param();
  757. if (empty($param)) {
  758. $this->error('参数错误');
  759. }
  760. $list = db('成本_各月其他费用')
  761. ->where('sys_ny', $param['month'])
  762. ->field('sys_ny as 年月,部门人员工资,管理人员工资,场地租金,待摊折旧,工资成本占比,其他,后勤人员工资,sys_id as 创建用户,sys_rq as 创建时间,mod_rq as 修改时间,UniqID')
  763. ->find();
  764. if (empty($list)) {
  765. $this->error('未找到数据');
  766. }else{
  767. $this->success('成功', $list);
  768. }
  769. }
  770. /**
  771. * 参考其他费用参考月份
  772. * @return void
  773. * @throws \think\db\exception\BindParamException
  774. * @throws \think\db\exception\DataNotFoundException
  775. * @throws \think\db\exception\ModelNotFoundException
  776. * @throws \think\exception\DbException
  777. * @throws \think\exception\PDOException
  778. */
  779. public function PrepaidExpensesDetailCopy()
  780. {
  781. if ($this->request->isGet() === false) {
  782. $this->error('请求错误');
  783. }
  784. $param = $this->request->param();
  785. if (empty($param)) {
  786. $this->error('参数错误');
  787. }
  788. $formMonth = $param['formMonth'];
  789. $toMonth = $param['toMonth'];
  790. $list = db('成本_各月其他费用')
  791. ->where('sys_ny', $formMonth)
  792. ->field('管理人员工资,场地租金,待摊折旧,工资成本占比,后勤人员工资')
  793. ->find();
  794. $list['sys_ny'] = $toMonth;
  795. $list['sys_id'] = $param['sys_id'];
  796. $list['sys_rq'] = date('Y-m-d H:i:s', time());
  797. $sql = db('成本_各月其他费用')
  798. ->fetchSql(true)
  799. ->insert($list);
  800. $res = db()->query($sql);
  801. if ($res !== false) {
  802. $this->success('成功');
  803. }else{
  804. $this->error('失败');
  805. }
  806. }
  807. /**
  808. * 各月水电气直接费用创建
  809. * @return void
  810. * @throws \think\db\exception\BindParamException
  811. * @throws \think\db\exception\DataNotFoundException
  812. * @throws \think\db\exception\ModelNotFoundException
  813. * @throws \think\exception\DbException
  814. * @throws \think\exception\PDOException
  815. */
  816. public function shuidianqiDetailAdd()
  817. {
  818. if ($this->request->isGet() === false) {
  819. $this->error('请求错误');
  820. }
  821. $param = $this->request->param();
  822. if (empty($param)) {
  823. $this->error('参数错误');
  824. }
  825. $month = substr($param['month'], 0, 4) . '-' . substr($param['month'], 4, 2);
  826. $sist = ['胶印车间','凹丝印车间','印后车间'];
  827. $list = db('设备_产量计酬')
  828. ->alias('a')
  829. ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号')
  830. ->where('a.sczl_rq', 'like', $month . '%')
  831. ->where('b.sys_sbID','<>','')
  832. ->where('b.使用部门','in',$sist)
  833. ->field('a.sczl_jtbh,sum(a.sczl_设备运行工时) as 通电工时,b.使用部门,rtrim(b.设备名称) as 设备名称')
  834. ->order('b.使用部门,a.sczl_jtbh')
  835. ->group('a.sczl_jtbh')
  836. ->select();
  837. $data = [];
  838. foreach ($list as $k => $v) {
  839. $data[] = [
  840. 'Sys_ny' => $param['month'],
  841. '部门名称' => $v['使用部门'],
  842. '费用类型' => '直接',
  843. '设备编号' => $v['sczl_jtbh'],
  844. '科目名称' => $v['设备名称'],
  845. '耗电量' => $v['通电工时'],
  846. '单位电价' => 0.69,
  847. 'Sys_id' => $param['sys_id'],
  848. 'Sys_rq' => date('Y-m-d H:i:s', time()),
  849. ];
  850. }
  851. $sql = db('成本_各月水电气')->fetchSql(true)->insertAll($data);
  852. $res = db()->query($sql);
  853. if ($res !== false) {
  854. $this->success('成功');
  855. }else{
  856. $this->error('失败');
  857. }
  858. }
  859. //计算成本
  860. // public function CostCalculation()
  861. // {
  862. // if ($this->request->isGet() === false) {
  863. // $this->error('请求错误');
  864. // }
  865. // $param = $this->request->param();
  866. // if (empty($param)) {
  867. // $this->error('参数错误');
  868. // }
  869. // //查询工单数据
  870. // $list = db('成本v23_月度成本明细')
  871. // ->field('车间名称,sys_ny as 年月,sczl_gdbh as 工单编号,sczl_yjno as 印件号,sczl_gxh as 工序号,工序名称,sczl_jtbh as jtbh,
  872. // 占用机时,计件产量,sczl_ms as 墨色数,Uniqid,计件产量*sczl_ms as 色度数')
  873. // ->where('sys_ny', $param['month'])
  874. // ->whereNotNull('车间名称')
  875. // ->select();
  876. // //查询整月全车间色度数之和
  877. // $ChromaticityCount = db('成本v23_月度成本明细')
  878. // ->where('sys_ny', $param['month'])
  879. // ->whereNotNull('车间名称')
  880. // ->column('sum(计件产量*sczl_ms)');
  881. // //查询整月各车间色度数
  882. // $MachineChromaticityCount = db('成本v23_月度成本明细')
  883. // ->where('sys_ny', $param['month'])
  884. // ->whereNotNull('车间名称')
  885. // ->group('车间名称')
  886. // ->column('sum(计件产量*sczl_ms)');
  887. // //计算车间水电气
  888. // $res = $this->ApportionmentOne($param['month']);
  889. // halt($res);
  890. //
  891. //
  892. //
  893. // }
  894. // //计算水电气分摊费用
  895. // protected function ApportionmentOne($month)
  896. // {
  897. // $list = db('成本_各月水电气')
  898. // ->where('Sys_ny', $month)
  899. // ->where('费用类型','like','%分摊%')
  900. // ->select();
  901. // foreach ($list as $k => $v) {
  902. // if ($v['科目名称'] == '待分摊总额') {
  903. // $money = $v['耗电量'] * $v['单位电价'];
  904. // $data = $this->MachineTime($v['部门名称'],$month);
  905. // foreach ($data['machine'] as $k1 => $v1) {
  906. // $data['machine'][$k1]['分摊水电'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  907. // }
  908. // }elseif (strpos($v['科目名称'],'废气处理') !== false) {
  909. // $electricityMoney = $v['耗电量'] * $v['单位电价'];
  910. // $gasMoney = $v['耗气量'] * $v['单位气价'];
  911. // $data = $this->MachineTime('03、卷凹机组',$month);
  912. // foreach ($data['machine'] as $k1 => $v1) {
  913. // $data['machine'][$k1]['分摊水电'] = round($electricityMoney*($v1['占用机时']/$data['sist']),2) ;
  914. // $data['machine'][$k1]['废气处理'] = round($gasMoney*($v1['占用机时']/$data['sist']),2) ;
  915. // }
  916. // }elseif (strpos($v['科目名称'],'锅炉') !== false && strpos($v['科目名称'],'热水锅炉') === false) {
  917. // $electricityMoney = $v['耗电量'] * $v['单位电价'];
  918. // $gasMoney = $v['耗气量'] * $v['单位气价'];
  919. // $data = $this->MachineTime('03、卷凹机组',$month);
  920. // foreach ($data['machine'] as $k1 => $v1) {
  921. // $data['machine'][$k1]['分摊水电'] = round($electricityMoney*($v1['占用机时']/$data['sist']),2) ;
  922. // $data['machine'][$k1]['锅炉'] = round($gasMoney*($v1['占用机时']/$data['sist']),2) ;
  923. // }
  924. // }elseif (strpos($v['科目名称'],'空压机A') !== false) {
  925. // $money = $v['耗电量'] * $v['单位电价'];
  926. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  927. // $data = $this->MachineTime($sistList,$month);
  928. // foreach ($data['machine'] as $k1 => $v1) {
  929. // $data['machine'][$k1]['空压机A'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  930. // }
  931. // }elseif (strpos($v['科目名称'],'空压机B') !== false) {
  932. // $money = $v['耗电量'] * $v['单位电价'];
  933. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  934. // $data = $this->MachineTime($sistList,$month);
  935. // foreach ($data['machine'] as $k1 => $v1) {
  936. // $data['machine'][$k1]['空压机B'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  937. // }
  938. // }elseif (strpos($v['科目名称'],'热水锅炉') !== false){
  939. // $money = $v['耗电量'] * $v['单位电价'];
  940. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  941. // $data = $this->MachineTime($sistList,$month);
  942. // foreach ($data['machine'] as $k1 => $v1) {
  943. // $data['machine'][$k1]['热水锅炉'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  944. // }
  945. // }
  946. // }
  947. // }
  948. //
  949. // //查询车间全部机台通电机时数据
  950. // protected function MachineTime($sist,$month)
  951. // {
  952. // $where['a.sys_ny'] = $month;
  953. // $where['b.sys_sbID'] = ['<>',''];
  954. // if (is_array($sist)) {
  955. // $where['a.车间名称'] = ['in',$sist];
  956. // }else{
  957. // if (strpos($sist,'机组') !== false) {
  958. // $where['b.设备编组'] = $sist;
  959. // }elseif (strpos($sist,'车间') !== false) {
  960. // $where['a.车间名称'] = $sist;
  961. // }
  962. // }
  963. // //查询各个工单工艺通电时间
  964. // $machine = db('成本v23_月度成本明细')
  965. // ->alias('a')
  966. // ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号','left')
  967. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,a.sczl_jtbh as 机台编号,a.占用机时,a.Uniqid')
  968. // ->where($where)
  969. // ->select();
  970. // //查询各个车间通电总时长
  971. // $sist = db('成本v23_月度成本明细')
  972. // ->alias('a')
  973. // ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号','left')
  974. // ->where($where)
  975. // ->value('sum(a.占用机时) as 占用机时');
  976. // $data = [
  977. // 'machine' => $machine,
  978. // 'sist' => $sist
  979. // ];
  980. // return $data;
  981. // }
  982. //查询各月工单数据
  983. // public function setMonthWorkOrder()
  984. // {
  985. // if ($this->request->isGet() === false) {
  986. // $this->error('请求错误');
  987. // }
  988. // $param = $this->request->param();
  989. // if (empty($param)) {
  990. // $this->error('参数错误');
  991. // }
  992. // $Printinglist = db('设备_产量计酬')
  993. // ->alias('a')
  994. // ->join('工单_工艺资料 b','a.sczl_gdbh = b.Gy0_gdbh and a.sczl_yjno = b.Gy0_yjno and a.sczl_gxh = b.Gy0_gxh')
  995. // ->join('设备_基本资料 c','a.sczl_jtbh = c.设备编号','LEFT')
  996. // ->join('工单_印件资料 d','a.sczl_gdbh = d.Yj_Gdbh and a.sczl_yjno = d.yj_Yjno')
  997. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,sum(a.sczl_cl) as 班组车头产量,b.Gy0_gxmc as 工序名称,
  998. // a.sczl_ms as 墨色数,rtrim(c.使用部门) as 使用部门,rtrim(b.印刷方式) as 印刷方式,b.版距,b.工价系数,a.sczl_jtbh,d.yj_yjmc as 印件名称,
  999. // sum(a.sczl_设备运行工时) as 占用机时,a.sys_rq as 年月,b.工价系数 as 工序难度系数,b.千件工价')
  1000. // ->where('a.sys_rq','like',$param['month'].'%')
  1001. // ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  1002. // ->select();
  1003. //查询外发加工、拆片工单
  1004. // $disassemblingList = db('db_sczl')
  1005. // ->alias('a')
  1006. // ->join('工单_工艺资料 b','a.sczl_gdbh = b.Gy0_gdbh and a.sczl_yjno = b.Gy0_yjno and a.sczl_gxh = b.Gy0_gxh')
  1007. // ->join('设备_基本资料 c','a.sczl_jtbh = c.设备编号','LEFT')
  1008. // ->join('工单_印件资料 d','a.sczl_gdbh = d.Yj_Gdbh and a.sczl_yjno = d.yj_Yjno')
  1009. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,sum(a.sczl_cl) as 班组车头产量,b.Gy0_gxmc as 工序名称,
  1010. // a.sczl_ms as 墨色数,rtrim(c.使用部门) as 使用部门,rtrim(b.印刷方式) as 印刷方式,b.版距,b.工价系数,a.sczl_jtbh,d.yj_yjmc as 印件名称,
  1011. // sum(a.sczl_设备运行工时) as 占用机时,a.sys_rq as 年月,b.工价系数 as 工序难度系数,b.千件工价')
  1012. // ->where('a.sys_rq','like',$param['month'].'%')
  1013. // ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  1014. // ->select();
  1015. //查询包装工序
  1016. // $field = 'a.sczl_gdbh1,a.sczl_gdbh2,a.sczl_gdbh3,a.sczl_gdbh4,a.sczl_gdbh5,a.sczl_gdbh6,a.sczl_yjGx1,
  1017. // a.sczl_yjGx2,a.sczl_yjGx3,a.sczl_yjGx4,a.sczl_yjGx5,a.sczl_yjGx6,a.sczl_cl1,a.sczl_cl2,a.sczl_cl3,a.sczl_cl4,a.sczl_cl5,
  1018. // a.sczl_cl6,a.sczl_PgCl1,a.sczl_PgCl2,a.sczl_PgCl3,a.sczl_PgCl4,a.sczl_PgCl5,a.sczl_PgCl6';
  1019. // $PackagingList = db('db_包装计件')
  1020. // ->alias('a')
  1021. //
  1022. // ->field($field)
  1023. // ->where('sczl_rq','like',$param['month'].'%')
  1024. // ->select();
  1025. // foreach ($PackagingList as $k => $v) {
  1026. //
  1027. // }
  1028. // halt($PackagingList);
  1029. // $data = [];
  1030. // foreach ($list as $k => $v) {
  1031. // if ($v['版距'] === '0.0'){
  1032. // $list[$k]['版距'] = 1000;
  1033. // }
  1034. // if ($v['墨色数'] === '0.00'){
  1035. // $list[$k]['墨色数'] = 1;
  1036. // }
  1037. // if (strpos($v['工序名称'],'切废')){
  1038. // $list[$k]['墨色数'] = 0.2;
  1039. // }
  1040. // $chanliang = $v['班组车头产量']*$v['工序难度系数'] + $v['班组换算产量'];
  1041. // $data[] = [
  1042. // '车间名称' => $v['使用部门'],
  1043. // 'sys_ny' => $param['month'],
  1044. // 'sczl_gdbh' => $v['工单编号'],
  1045. // '印件名称' => $v['印件名称'],
  1046. // 'sczl_yjno' => $v['印件号'],
  1047. // 'sczl_gxh' => $v['工序号'],
  1048. // '工序名称' => $v['工序名称'],
  1049. // 'sczl_jtbh' => $v['sczl_jtbh'],
  1050. // '卷张换算系数' => $list[$k]['版距']/1000,
  1051. // '占用机时' => $v['占用机时'],
  1052. // '班组车头产量' => $v['班组车头产量'],
  1053. // 'sczl_ms' => $list[$k]['墨色数'],
  1054. // '工序难度系数' => $v['工序难度系数'],
  1055. // '班组换算产量' => $v['班组换算产量'],
  1056. // '千件工价' => $v['千件工价'],
  1057. // '计件产量' => $chanliang,
  1058. // '水电分摊因子' => $v['占用机时'],
  1059. // '材料分摊因子' => $chanliang,
  1060. // '人工分摊因子' => ($chanliang/1000)*$v['千件工价'],
  1061. // 'Sys_id' => $param['sys_id'],
  1062. // 'Sys_rq' => date('Y-m-d H:i:s', time())
  1063. // ];
  1064. // }
  1065. // }
  1066. }