CostAccounting.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  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. $list = db('成本v23_月度成本明细')
  544. ->where('车间名称', $param['sist'])
  545. ->where('sys_ny', $param['month'])
  546. ->order('sczl_gdbh')
  547. ->select();
  548. if (empty($list)) {
  549. $this->error('未找到数据');
  550. }else{
  551. $this->success('成功', $list);
  552. }
  553. }
  554. /**
  555. * 创建各月水电气分摊
  556. * @return void
  557. * @throws \think\db\exception\BindParamException
  558. * @throws \think\exception\PDOException
  559. */
  560. public function UtilitiesAdd()
  561. {
  562. if ($this->request->isPost() === false) {
  563. $this->error('请求错误');
  564. }
  565. $param = Request::instance()->post();
  566. if (empty($param)) {
  567. $this->error('参数错误');
  568. }
  569. $data = [];
  570. $currentTime = date('Y-m-d H:i:s');
  571. foreach ($param as $item) {
  572. // 验证必要字段是否存在
  573. if (empty($item['sys_ny']) || empty($item['sist']) || empty($item['科目名称'])) {
  574. $this->error('缺少必要参数');
  575. }
  576. // 确保数值字段正确处理为 decimal 类型
  577. $data[] = [
  578. 'Sys_ny' => $item['sys_ny'],
  579. '部门名称' => $item['sist'],
  580. '费用类型' => '分摊',
  581. '科目名称' => $item['科目名称'],
  582. '耗电量' => isset($item['耗电量']) ? (float)$item['耗电量'] : 0.00,
  583. '单位电价' => isset($item['单位电价']) ? (float)$item['单位电价'] : 0.00,
  584. '耗气量' => isset($item['耗气量']) ? (float)$item['耗气量'] : 0.00,
  585. '单位气价' => isset($item['单位气价']) ? (float)$item['单位气价'] : 0.00,
  586. 'Sys_id' => $item['sys_id'] ?? '',
  587. 'Sys_rq' => $currentTime
  588. ];
  589. }
  590. $result = db('成本_各月水电气')->where('Sys_ny', $data[0]['Sys_ny'])->where('费用类型','分摊')->delete();
  591. $sql = db('成本_各月水电气')->fetchSql(true)->insertAll($data);
  592. $res = db()->query($sql);
  593. if ($res !== false) {
  594. $this->success('成功');
  595. }else{
  596. $this->error('失败');
  597. }
  598. }
  599. /**
  600. * 各月水电气分摊费用列表
  601. * @return void
  602. * @throws \think\db\exception\DataNotFoundException
  603. * @throws \think\db\exception\ModelNotFoundException
  604. * @throws \think\exception\DbException
  605. */
  606. public function UtilitiesList()
  607. {
  608. if($this->request->isGet() === false){
  609. $this->error('请求错误');
  610. }
  611. $param = $this->request->param();
  612. if (empty($param)) {
  613. $this->error('参数错误');
  614. }
  615. $list = db('成本_各月水电气')
  616. ->field('rtrim(部门名称) as 部门名称,rtrim(科目名称) as 科目名称,耗电量,单位电价,耗气量,单位气价')
  617. ->where('费用类型', '分摊')
  618. ->where('Sys_ny', $param['month'])
  619. ->group('部门名称,科目名称')
  620. ->select();
  621. if (empty($list)) {
  622. $list = db('成本_各月水电气')
  623. ->field('rtrim(部门名称) as 部门名称,rtrim(科目名称) as 科目名称')
  624. ->where('费用类型', '分摊')
  625. ->group('部门名称,科目名称')
  626. ->select();
  627. }
  628. foreach ($list as $k => $v) {
  629. $list[$k]['年月'] = $param['month'];
  630. }
  631. $this->success('成功', $list);
  632. }
  633. /**
  634. * 成本汇总左侧列表
  635. * @return void
  636. */
  637. public function getSummaryTab()
  638. {
  639. if ($this->request->isGet() === false) {
  640. $this->error('请求错误');
  641. }
  642. $months = db('成本v23_月度成本明细')
  643. ->field('sys_ny AS year_month')
  644. ->group('Sys_ny')
  645. ->order('Sys_ny DESC')
  646. ->column('Sys_ny');
  647. $sist = ['胶印车间','凹丝印车间','印后车间','检验车间'];
  648. $data = [];
  649. foreach ($months as $month) {
  650. $data[$month] = $sist;
  651. }
  652. $this->success('成功', $data);
  653. }
  654. //计算每个车间色度数
  655. private function CountSistChromaticity($month,$sist)
  656. {
  657. $data = db('成本v23_月度成本明细')
  658. ->where('sys_ny', $month)
  659. ->where('车间名称', $sist)
  660. ->group('车间名称')
  661. ->value('班组车头产量*sczl_ms as 色度数');
  662. return $data;
  663. }
  664. //计算每个机台色度数
  665. private function CountMachineChromatic($month,$sist)
  666. {
  667. $data = db('成本v23_月度成本明细')
  668. ->where('sys_ny', $month)
  669. ->where('车间名称', $sist)
  670. ->group('sczl_jtbh')
  671. ->value('班组车头产量*sczl_ms as 色度数');
  672. return $data;
  673. }
  674. //水电气分摊费用下方明细列表
  675. // public function shuidianqiMachineDetailList()
  676. // {
  677. // if ($this->request->isGet() === false) {
  678. // $this->error('请求错误');
  679. // }
  680. // $param = $this->request->param();
  681. // if (empty($param)) {
  682. // $this->error('参数错误');
  683. // }
  684. // $list = db('设备_基本资料')
  685. // ->alias('a')
  686. // ->join('成本_各月分摊系数 b', 'a.设备编号 = b.设备编号', 'LEFT')
  687. // ->field()
  688. //
  689. // }
  690. /**
  691. * 其他待摊费用
  692. * @return void
  693. * @throws \think\db\exception\BindParamException
  694. * @throws \think\exception\PDOException
  695. */
  696. public function PrepaidExpensesListEdit()
  697. {
  698. if ($this->request->isPost() === false) {
  699. $this->error('请求错误');
  700. }
  701. $param = Request::instance()->post();
  702. if (empty($param)) {
  703. $this->error('参数错误');
  704. }
  705. $data = [
  706. 'sys_ny' => $param['month'],
  707. '部门人员工资' => $param['salary1'],
  708. '管理人员工资' => $param['salary2'],
  709. '场地租金' => $param['rental'],
  710. '待摊折旧' => $param['depreciation'],
  711. '工资成本占比' => $param['proportion'],
  712. '其他' => $param['rest'],
  713. '后勤人员工资' => $param['profit'],
  714. 'sys_id' => $param['sys_id'],
  715. ];
  716. $result = db('成本_各月其他费用')->where('sys_ny', $param['month'])->count();
  717. if ($result > 0) {
  718. $data['mod_rq'] = date('Y-m-d H:i:s', time());
  719. $sql = db('成本_各月其他费用')->where('sys_ny', $param['month'])->fetchSql(true)->update($data);
  720. }else{
  721. $data['sys_rq'] = date('Y-m-d H:i:s', time());
  722. $sql = db('成本_各月其他费用')
  723. ->fetchSql(true)
  724. ->insert($data);
  725. }
  726. $res = db()->query($sql);
  727. if ($res !== false) {
  728. $this->success('成功');
  729. }else{
  730. $this->error('失败');
  731. }
  732. }
  733. /**
  734. * 其他待摊费用列表
  735. * @return void
  736. * @throws \think\db\exception\DataNotFoundException
  737. * @throws \think\db\exception\ModelNotFoundException
  738. * @throws \think\exception\DbException
  739. */
  740. public function PrepaidExpensesList()
  741. {
  742. if ($this->request->isGet() === false) {
  743. $this->error('请求错误');
  744. }
  745. $param = $this->request->param();
  746. if (empty($param)) {
  747. $this->error('参数错误');
  748. }
  749. $list = db('成本_各月其他费用')
  750. ->where('sys_ny', $param['month'])
  751. ->field('sys_ny as 年月,部门人员工资,管理人员工资,场地租金,待摊折旧,工资成本占比,其他,后勤人员工资,sys_id as 创建用户,sys_rq as 创建时间,mod_rq as 修改时间,UniqID')
  752. ->find();
  753. if (empty($list)) {
  754. $this->error('未找到数据');
  755. }else{
  756. $this->success('成功', $list);
  757. }
  758. }
  759. /**
  760. * 参考其他费用参考月份
  761. * @return void
  762. * @throws \think\db\exception\BindParamException
  763. * @throws \think\db\exception\DataNotFoundException
  764. * @throws \think\db\exception\ModelNotFoundException
  765. * @throws \think\exception\DbException
  766. * @throws \think\exception\PDOException
  767. */
  768. public function PrepaidExpensesDetailCopy()
  769. {
  770. if ($this->request->isGet() === false) {
  771. $this->error('请求错误');
  772. }
  773. $param = $this->request->param();
  774. if (empty($param)) {
  775. $this->error('参数错误');
  776. }
  777. $formMonth = $param['formMonth'];
  778. $toMonth = $param['toMonth'];
  779. $list = db('成本_各月其他费用')
  780. ->where('sys_ny', $formMonth)
  781. ->field('管理人员工资,场地租金,待摊折旧,工资成本占比,后勤人员工资')
  782. ->find();
  783. $list['sys_ny'] = $toMonth;
  784. $list['sys_id'] = $param['sys_id'];
  785. $list['sys_rq'] = date('Y-m-d H:i:s', time());
  786. $sql = db('成本_各月其他费用')
  787. ->fetchSql(true)
  788. ->insert($list);
  789. $res = db()->query($sql);
  790. if ($res !== false) {
  791. $this->success('成功');
  792. }else{
  793. $this->error('失败');
  794. }
  795. }
  796. /**
  797. * 各月水电气直接费用创建
  798. * @return void
  799. * @throws \think\db\exception\BindParamException
  800. * @throws \think\db\exception\DataNotFoundException
  801. * @throws \think\db\exception\ModelNotFoundException
  802. * @throws \think\exception\DbException
  803. * @throws \think\exception\PDOException
  804. */
  805. public function shuidianqiDetailAdd()
  806. {
  807. if ($this->request->isGet() === false) {
  808. $this->error('请求错误');
  809. }
  810. $param = $this->request->param();
  811. if (empty($param)) {
  812. $this->error('参数错误');
  813. }
  814. $month = substr($param['month'], 0, 4) . '-' . substr($param['month'], 4, 2);
  815. $sist = ['胶印车间','凹丝印车间','印后车间'];
  816. $list = db('设备_产量计酬')
  817. ->alias('a')
  818. ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号')
  819. ->where('a.sczl_rq', 'like', $month . '%')
  820. ->where('b.sys_sbID','<>','')
  821. ->where('b.使用部门','in',$sist)
  822. ->field('a.sczl_jtbh,sum(a.sczl_设备运行工时) as 通电工时,b.使用部门,rtrim(b.设备名称) as 设备名称')
  823. ->order('b.使用部门,a.sczl_jtbh')
  824. ->group('a.sczl_jtbh')
  825. ->select();
  826. $data = [];
  827. foreach ($list as $k => $v) {
  828. $data[] = [
  829. 'Sys_ny' => $param['month'],
  830. '部门名称' => $v['使用部门'],
  831. '费用类型' => '直接',
  832. '设备编号' => $v['sczl_jtbh'],
  833. '科目名称' => $v['设备名称'],
  834. '耗电量' => $v['通电工时'],
  835. '单位电价' => 0.69,
  836. 'Sys_id' => $param['sys_id'],
  837. 'Sys_rq' => date('Y-m-d H:i:s', time()),
  838. ];
  839. }
  840. $sql = db('成本_各月水电气')->fetchSql(true)->insertAll($data);
  841. $res = db()->query($sql);
  842. if ($res !== false) {
  843. $this->success('成功');
  844. }else{
  845. $this->error('失败');
  846. }
  847. }
  848. //计算成本
  849. // public function CostCalculation()
  850. // {
  851. // if ($this->request->isGet() === false) {
  852. // $this->error('请求错误');
  853. // }
  854. // $param = $this->request->param();
  855. // if (empty($param)) {
  856. // $this->error('参数错误');
  857. // }
  858. // //查询工单数据
  859. // $list = db('成本v23_月度成本明细')
  860. // ->field('车间名称,sys_ny as 年月,sczl_gdbh as 工单编号,sczl_yjno as 印件号,sczl_gxh as 工序号,工序名称,sczl_jtbh as jtbh,
  861. // 占用机时,计件产量,sczl_ms as 墨色数,Uniqid,计件产量*sczl_ms as 色度数')
  862. // ->where('sys_ny', $param['month'])
  863. // ->whereNotNull('车间名称')
  864. // ->select();
  865. // //查询整月全车间色度数之和
  866. // $ChromaticityCount = db('成本v23_月度成本明细')
  867. // ->where('sys_ny', $param['month'])
  868. // ->whereNotNull('车间名称')
  869. // ->column('sum(计件产量*sczl_ms)');
  870. // //查询整月各车间色度数
  871. // $MachineChromaticityCount = db('成本v23_月度成本明细')
  872. // ->where('sys_ny', $param['month'])
  873. // ->whereNotNull('车间名称')
  874. // ->group('车间名称')
  875. // ->column('sum(计件产量*sczl_ms)');
  876. // //计算车间水电气
  877. // $res = $this->ApportionmentOne($param['month']);
  878. // halt($res);
  879. //
  880. //
  881. //
  882. // }
  883. // //计算水电气分摊费用
  884. // protected function ApportionmentOne($month)
  885. // {
  886. // $list = db('成本_各月水电气')
  887. // ->where('Sys_ny', $month)
  888. // ->where('费用类型','like','%分摊%')
  889. // ->select();
  890. // foreach ($list as $k => $v) {
  891. // if ($v['科目名称'] == '待分摊总额') {
  892. // $money = $v['耗电量'] * $v['单位电价'];
  893. // $data = $this->MachineTime($v['部门名称'],$month);
  894. // foreach ($data['machine'] as $k1 => $v1) {
  895. // $data['machine'][$k1]['分摊水电'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  896. // }
  897. // }elseif (strpos($v['科目名称'],'废气处理') !== false) {
  898. // $electricityMoney = $v['耗电量'] * $v['单位电价'];
  899. // $gasMoney = $v['耗气量'] * $v['单位气价'];
  900. // $data = $this->MachineTime('03、卷凹机组',$month);
  901. // foreach ($data['machine'] as $k1 => $v1) {
  902. // $data['machine'][$k1]['分摊水电'] = round($electricityMoney*($v1['占用机时']/$data['sist']),2) ;
  903. // $data['machine'][$k1]['废气处理'] = round($gasMoney*($v1['占用机时']/$data['sist']),2) ;
  904. // }
  905. // }elseif (strpos($v['科目名称'],'锅炉') !== false && strpos($v['科目名称'],'热水锅炉') === false) {
  906. // $electricityMoney = $v['耗电量'] * $v['单位电价'];
  907. // $gasMoney = $v['耗气量'] * $v['单位气价'];
  908. // $data = $this->MachineTime('03、卷凹机组',$month);
  909. // foreach ($data['machine'] as $k1 => $v1) {
  910. // $data['machine'][$k1]['分摊水电'] = round($electricityMoney*($v1['占用机时']/$data['sist']),2) ;
  911. // $data['machine'][$k1]['锅炉'] = round($gasMoney*($v1['占用机时']/$data['sist']),2) ;
  912. // }
  913. // }elseif (strpos($v['科目名称'],'空压机A') !== false) {
  914. // $money = $v['耗电量'] * $v['单位电价'];
  915. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  916. // $data = $this->MachineTime($sistList,$month);
  917. // foreach ($data['machine'] as $k1 => $v1) {
  918. // $data['machine'][$k1]['空压机A'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  919. // }
  920. // }elseif (strpos($v['科目名称'],'空压机B') !== false) {
  921. // $money = $v['耗电量'] * $v['单位电价'];
  922. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  923. // $data = $this->MachineTime($sistList,$month);
  924. // foreach ($data['machine'] as $k1 => $v1) {
  925. // $data['machine'][$k1]['空压机B'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  926. // }
  927. // }elseif (strpos($v['科目名称'],'热水锅炉') !== false){
  928. // $money = $v['耗电量'] * $v['单位电价'];
  929. // $sistList = ['凹丝印车间','胶印车间','印后车间','检验车间'];
  930. // $data = $this->MachineTime($sistList,$month);
  931. // foreach ($data['machine'] as $k1 => $v1) {
  932. // $data['machine'][$k1]['热水锅炉'] = round($money*($v1['占用机时']/$data['sist']),2) ;
  933. // }
  934. // }
  935. // }
  936. // }
  937. //
  938. // //查询车间全部机台通电机时数据
  939. // protected function MachineTime($sist,$month)
  940. // {
  941. // $where['a.sys_ny'] = $month;
  942. // $where['b.sys_sbID'] = ['<>',''];
  943. // if (is_array($sist)) {
  944. // $where['a.车间名称'] = ['in',$sist];
  945. // }else{
  946. // if (strpos($sist,'机组') !== false) {
  947. // $where['b.设备编组'] = $sist;
  948. // }elseif (strpos($sist,'车间') !== false) {
  949. // $where['a.车间名称'] = $sist;
  950. // }
  951. // }
  952. // //查询各个工单工艺通电时间
  953. // $machine = db('成本v23_月度成本明细')
  954. // ->alias('a')
  955. // ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号','left')
  956. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,a.sczl_jtbh as 机台编号,a.占用机时,a.Uniqid')
  957. // ->where($where)
  958. // ->select();
  959. // //查询各个车间通电总时长
  960. // $sist = db('成本v23_月度成本明细')
  961. // ->alias('a')
  962. // ->join('设备_基本资料 b', 'a.sczl_jtbh = b.设备编号','left')
  963. // ->where($where)
  964. // ->value('sum(a.占用机时) as 占用机时');
  965. // $data = [
  966. // 'machine' => $machine,
  967. // 'sist' => $sist
  968. // ];
  969. // return $data;
  970. // }
  971. //查询各月工单数据
  972. // public function setMonthWorkOrder()
  973. // {
  974. // if ($this->request->isGet() === false) {
  975. // $this->error('请求错误');
  976. // }
  977. // $param = $this->request->param();
  978. // if (empty($param)) {
  979. // $this->error('参数错误');
  980. // }
  981. // $Printinglist = db('设备_产量计酬')
  982. // ->alias('a')
  983. // ->join('工单_工艺资料 b','a.sczl_gdbh = b.Gy0_gdbh and a.sczl_yjno = b.Gy0_yjno and a.sczl_gxh = b.Gy0_gxh')
  984. // ->join('设备_基本资料 c','a.sczl_jtbh = c.设备编号','LEFT')
  985. // ->join('工单_印件资料 d','a.sczl_gdbh = d.Yj_Gdbh and a.sczl_yjno = d.yj_Yjno')
  986. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,sum(a.sczl_cl) as 班组车头产量,b.Gy0_gxmc as 工序名称,
  987. // a.sczl_ms as 墨色数,rtrim(c.使用部门) as 使用部门,rtrim(b.印刷方式) as 印刷方式,b.版距,b.工价系数,a.sczl_jtbh,d.yj_yjmc as 印件名称,
  988. // sum(a.sczl_设备运行工时) as 占用机时,a.sys_rq as 年月,b.工价系数 as 工序难度系数,b.千件工价')
  989. // ->where('a.sys_rq','like',$param['month'].'%')
  990. // ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  991. // ->select();
  992. //查询外发加工、拆片工单
  993. // $disassemblingList = db('db_sczl')
  994. // ->alias('a')
  995. // ->join('工单_工艺资料 b','a.sczl_gdbh = b.Gy0_gdbh and a.sczl_yjno = b.Gy0_yjno and a.sczl_gxh = b.Gy0_gxh')
  996. // ->join('设备_基本资料 c','a.sczl_jtbh = c.设备编号','LEFT')
  997. // ->join('工单_印件资料 d','a.sczl_gdbh = d.Yj_Gdbh and a.sczl_yjno = d.yj_Yjno')
  998. // ->field('a.sczl_gdbh as 工单编号,a.sczl_yjno as 印件号,a.sczl_gxh as 工序号,sum(a.sczl_cl) as 班组车头产量,b.Gy0_gxmc as 工序名称,
  999. // a.sczl_ms as 墨色数,rtrim(c.使用部门) as 使用部门,rtrim(b.印刷方式) as 印刷方式,b.版距,b.工价系数,a.sczl_jtbh,d.yj_yjmc as 印件名称,
  1000. // sum(a.sczl_设备运行工时) as 占用机时,a.sys_rq as 年月,b.工价系数 as 工序难度系数,b.千件工价')
  1001. // ->where('a.sys_rq','like',$param['month'].'%')
  1002. // ->group('a.sczl_gdbh,a.sczl_yjno,a.sczl_gxh,a.sczl_jtbh')
  1003. // ->select();
  1004. //查询包装工序
  1005. // $field = 'a.sczl_gdbh1,a.sczl_gdbh2,a.sczl_gdbh3,a.sczl_gdbh4,a.sczl_gdbh5,a.sczl_gdbh6,a.sczl_yjGx1,
  1006. // 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,
  1007. // a.sczl_cl6,a.sczl_PgCl1,a.sczl_PgCl2,a.sczl_PgCl3,a.sczl_PgCl4,a.sczl_PgCl5,a.sczl_PgCl6';
  1008. // $PackagingList = db('db_包装计件')
  1009. // ->alias('a')
  1010. //
  1011. // ->field($field)
  1012. // ->where('sczl_rq','like',$param['month'].'%')
  1013. // ->select();
  1014. // foreach ($PackagingList as $k => $v) {
  1015. //
  1016. // }
  1017. // halt($PackagingList);
  1018. // $data = [];
  1019. // foreach ($list as $k => $v) {
  1020. // if ($v['版距'] === '0.0'){
  1021. // $list[$k]['版距'] = 1000;
  1022. // }
  1023. // if ($v['墨色数'] === '0.00'){
  1024. // $list[$k]['墨色数'] = 1;
  1025. // }
  1026. // if (strpos($v['工序名称'],'切废')){
  1027. // $list[$k]['墨色数'] = 0.2;
  1028. // }
  1029. // $chanliang = $v['班组车头产量']*$v['工序难度系数'] + $v['班组换算产量'];
  1030. // $data[] = [
  1031. // '车间名称' => $v['使用部门'],
  1032. // 'sys_ny' => $param['month'],
  1033. // 'sczl_gdbh' => $v['工单编号'],
  1034. // '印件名称' => $v['印件名称'],
  1035. // 'sczl_yjno' => $v['印件号'],
  1036. // 'sczl_gxh' => $v['工序号'],
  1037. // '工序名称' => $v['工序名称'],
  1038. // 'sczl_jtbh' => $v['sczl_jtbh'],
  1039. // '卷张换算系数' => $list[$k]['版距']/1000,
  1040. // '占用机时' => $v['占用机时'],
  1041. // '班组车头产量' => $v['班组车头产量'],
  1042. // 'sczl_ms' => $list[$k]['墨色数'],
  1043. // '工序难度系数' => $v['工序难度系数'],
  1044. // '班组换算产量' => $v['班组换算产量'],
  1045. // '千件工价' => $v['千件工价'],
  1046. // '计件产量' => $chanliang,
  1047. // '水电分摊因子' => $v['占用机时'],
  1048. // '材料分摊因子' => $chanliang,
  1049. // '人工分摊因子' => ($chanliang/1000)*$v['千件工价'],
  1050. // 'Sys_id' => $param['sys_id'],
  1051. // 'Sys_rq' => date('Y-m-d H:i:s', time())
  1052. // ];
  1053. // }
  1054. // }
  1055. }