viewPlanList.php 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>查看库存盘点</title>
  6. <link href="/css/ims/base.css" rel="stylesheet">
  7. <link href="/css/ims/ims.css" rel="stylesheet">
  8. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css" />
  9. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css" />
  10. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css" />
  11. <style>
  12. .ims-box {
  13. margin: 20px;
  14. }
  15. .screen {
  16. padding-left: 20px;
  17. height: 44px;
  18. line-height: 44px;
  19. background-color: #eff4fa;
  20. }
  21. .screen li {
  22. float: left;
  23. margin-right: 65px;
  24. }
  25. .bg-d9bf6e {
  26. margin-left: 5px;
  27. padding: 0 20px;
  28. color: #fff;
  29. background-color: #d9bf6e;
  30. }
  31. .list {
  32. padding: 0 40px;
  33. /*margin-top: 40px;*/
  34. overflow: hidden;
  35. }
  36. .list h2 {
  37. line-height: 30px;
  38. font-size: 14px;
  39. }
  40. .list .student-list_box {
  41. width: 300px;
  42. }
  43. .list .student-list_box>ul {
  44. height: 260px;
  45. overflow: auto;
  46. padding: 20px;
  47. background-color: #eef3ff;
  48. }
  49. .list .student-list_box li {
  50. line-height: 30px;
  51. cursor: pointer;
  52. }
  53. .list .student-selected_box {
  54. margin-left: 60px;
  55. }
  56. .list .student-list {
  57. display: none;
  58. margin-left: 20px;
  59. }
  60. .list .student-list li.active .btn-select_all {
  61. display: inline-block;
  62. }
  63. .list .student-list span {
  64. cursor: pointer;
  65. }
  66. .list .btn-select_all {
  67. margin-left: 84px;
  68. color: #2977ff;
  69. }
  70. .student-name_box li {
  71. position: relative;
  72. margin-left: 28px;
  73. line-height: 30px;
  74. }
  75. .student-name_box input {
  76. position: absolute;
  77. left: 155px;
  78. top: 8px;
  79. }
  80. .btn-select_all,
  81. .student-name_box {
  82. display: none;
  83. }
  84. .student-selected {
  85. width: 320px;
  86. height: 300px;
  87. overflow: auto;
  88. }
  89. .student-selected li {
  90. float: left;
  91. margin-right: 24px;
  92. margin-bottom: 12px;
  93. width: 280px;
  94. height: 26px;
  95. line-height: 26px;
  96. text-indent: 20px;
  97. background-color: #f2f2f2;
  98. }
  99. .student-selected .btn-delete {
  100. float: right;
  101. margin-right: 20px;
  102. color: red;
  103. cursor: pointer;
  104. }
  105. .btn-confirm_purchase {
  106. display: block;
  107. margin: 0 auto;
  108. margin-top: 100px;
  109. margin-bottom: 50px;
  110. width: 430px;
  111. line-height: 54px;
  112. color: #fff;
  113. font-family: PingFangSC-Regular, "PingFang SC";
  114. font-weight: 400;
  115. font-style: normal;
  116. font-size: 20px;
  117. text-align: center;
  118. background-color: #2977ff;
  119. cursor: pointer;
  120. }
  121. .sale-table input {
  122. border: 1px solid #ccc;
  123. border-radius: 4px;
  124. }
  125. #imgPreview {
  126. display: inline-block;
  127. margin-top: 12px;
  128. }
  129. #imgPreview > img {
  130. max-width: 100px;
  131. max-height: 100px;
  132. margin-right: 5px;
  133. }
  134. .layui-layer-btn .layui-layer-btn0 {
  135. border-color: #2977ff !important;
  136. background-color: #2977ff !important;
  137. color: #fff;
  138. }
  139. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  140. line-height: 140px;
  141. text-align: center;
  142. }
  143. .blue{
  144. color:blue;
  145. cursor: pointer;
  146. }
  147. .bg-green{
  148. background-color: #2977ff;
  149. }
  150. .bg-red{
  151. background-color: red;
  152. }
  153. .bg-yellow{
  154. background-color: #DAA520;
  155. }
  156. .title{
  157. padding: 0 10px;
  158. font-size: 16px;
  159. font-weight: 600;
  160. line-height: 28px;
  161. }
  162. .product{
  163. margin-top: 10px;
  164. padding: 0 10px;
  165. }
  166. .table-product{
  167. width: 100%;
  168. text-align: center;
  169. line-height: 30px;
  170. }
  171. .table-product tr:nth-child(odd) {
  172. background-color: #fafafa;
  173. }
  174. .product .table-product th,.product .table-product td{
  175. width: 15%;
  176. }
  177. .product .table-product th{
  178. text-align: center;
  179. }
  180. .product .plan-count-wrap-po{
  181. display: inline-block;
  182. height: 24px;
  183. font-size: 0;
  184. }
  185. .product .reduce-count,.product .add-count{
  186. display: inline-block;
  187. width: 24px;
  188. line-height: 24px;
  189. height: 24px;
  190. font-size: 14px;
  191. text-align: center;
  192. color: #fff;
  193. background-color: #666;
  194. cursor: pointer;
  195. }
  196. .product .product-contrast{
  197. text-align: left;
  198. padding-left: 6%;
  199. }
  200. .product .plan-count{
  201. width: 80px;
  202. height: 24px;
  203. line-height: 24px;
  204. font-size: 14px;
  205. text-align: center;
  206. box-sizing: border-box;
  207. }
  208. .tag-table-product{
  209. display: inline-block;
  210. margin-right: 10px;
  211. width: 24px;
  212. height: 24px;
  213. line-height: 24px;
  214. color: #fff;
  215. text-align: center;
  216. }
  217. .assets{
  218. width: 100%;
  219. margin-top: 10px;
  220. padding: 0 10px;
  221. }
  222. .assets .table-assets{
  223. width: 100%;
  224. text-align: center;
  225. line-height: 30px;
  226. }
  227. .table-assets tr:nth-child(odd) {
  228. background-color: #fafafa;
  229. }
  230. .assets .table-assets th{
  231. text-align: center;
  232. }
  233. .show-layer-assets-number{
  234. color: #169BD5;
  235. cursor: pointer;
  236. }
  237. /*弹窗开始*/
  238. .dialog-layer-assets-number{
  239. display: none;
  240. width: 360px;
  241. padding: 10px 20px;
  242. color: #666;
  243. }
  244. .dialog-layer-assets-number .pan-title{
  245. line-height: 32px;
  246. color: #333;
  247. font-weight: 600;
  248. }
  249. .assets-number-list{
  250. height: 60px;
  251. overflow: auto;
  252. }
  253. .assets-number-list label{
  254. display: inline-block;
  255. width: 150px;
  256. line-height: 30px;
  257. font-size: 13px;
  258. }
  259. .dialog-layer-assets-number .new-assets-number-box{
  260. line-height: 30px;
  261. }
  262. .dialog-layer-assets-number .input-new-assets-number{
  263. width: 120px;
  264. line-height: 24px;
  265. box-sizing: border-box;
  266. }
  267. .dialog-layer-assets-number .new-add-plan{
  268. line-height: 24px;
  269. margin-left: 14px;
  270. border-radius: 3px;
  271. padding: 0 4px;
  272. font-size: 12px;
  273. color: #fff;
  274. background-color: #2977ff;
  275. cursor: pointer;
  276. border: none;
  277. outline: none;
  278. }
  279. body .input-layer-new-assets-number{
  280. width: 137px;
  281. border: none;
  282. outline: none;
  283. background: #fff !important;
  284. }
  285. .dialog-btn-box{
  286. margin-top: 20px;
  287. text-align: center;
  288. }
  289. .dialog-btn-box button{
  290. width: 60px;
  291. height: 24px;
  292. line-height: 24px;
  293. text-align: center;
  294. cursor: pointer;
  295. border: none;
  296. outline: none;
  297. }
  298. .dialog-btn-box .btn-dialog-colse{
  299. color: #2977ff;
  300. background-color: #fff;
  301. border: 1px solid #2977ff;
  302. box-sizing: border-box;
  303. }
  304. .dialog-btn-box .btn-dialog-save{
  305. margin-left: 20px;
  306. color: #fff;
  307. background-color: #2977ff;
  308. }
  309. /*在谷歌下移除input[number]的上下箭头*/
  310. .new-assets-number-box input[type='number']::-webkit-outer-spin-button,
  311. .new-assets-number-box input[type='number']::-webkit-inner-spin-button{
  312. -webkit-appearance: none !important;
  313. margin: 0;
  314. }
  315. /*在firefox下移除input[number]的上下箭头*/
  316. .new-assets-number-box input[type="number"]{-moz-appearance:textfield;}
  317. .new-add-plan{
  318. display: none;
  319. }
  320. .urge-layer-box {
  321. margin-top: 30px;
  322. margin-left: 30px;
  323. }
  324. .urge-layer-box textarea {
  325. margin-left: 15px;
  326. vertical-align: top;
  327. }
  328. #urgeText{
  329. width: 450px;
  330. display: inline-block;
  331. vertical-align: text-top;
  332. resize:none
  333. }
  334. .now-hidden{display:none}
  335. .show-tr{
  336. color:#2977ff;
  337. cursor: pointer;
  338. }
  339. </style>
  340. </head>
  341. <body>
  342. <h3 class="sale-title">库存盘点单</h3>
  343. <input type="hidden" name="itemName">
  344. <input type="hidden" name="itemSpec">
  345. <input type="hidden" name="itemCode">
  346. <input type="hidden" name="unitId">
  347. <div class="sale-table">
  348. <table width="100%">
  349. <tr>
  350. <th><em class="red">*</em>标题</th>
  351. <td colspan="3">
  352. <input type="text" style="width:50%;" name="stockTitle" value="<?php echo $list['stockTitle'];?>" readonly="readonly">
  353. </td>
  354. </tr>
  355. <tr>
  356. <th><em class="red">*</em>盘点日期</th>
  357. <td colspan="3">
  358. <input class="stocktakingDate" type="text" name="stocktakingDate" style="width:50%;" readonly value="<?php echo $list['stocktakingDate'];?>" active="false">
  359. </td>
  360. </tr>
  361. <tr>
  362. <th><em class="red">*</em>盘点凭证</th>
  363. <td colspan="3">
  364. <span class="img-title" style="display:none">
  365. <label class="add-img">
  366. <span>+</span>
  367. <input type="file" id="fileImg" accept="image/*" style="display: none;" />
  368. </label>
  369. <span> 请上传货品盘点的照片</span>
  370. </span>
  371. <div id="imgPreview" active="false">
  372. <?php if(isset($list['images']) && $list['images']):?>
  373. <?php foreach($list['images'] as $k=>$v):?>
  374. <img src="<?php echo $v;?>" />
  375. <?php endforeach;?>
  376. <?php endif;?>
  377. </div>
  378. </td>
  379. </tr>
  380. <tr>
  381. <!-- more less same-->
  382. <td colspan="4" class="sale-num get-status">
  383. </td>
  384. </tr>
  385. <tr>
  386. <th>盘点说明</th>
  387. <td colspan="3">
  388. <textarea name="remark" id="remark" rows="6" cols="60" readonly="readonly"><?php echo $list['remark'];?></textarea>
  389. </td>
  390. </tr>
  391. </table>
  392. </div>
  393. <?php if(isset($list) && $list):?>
  394. <?php if(isset($list['finishRes']) && $list['finishRes']):?>
  395. <?php $tr_show = "";?>
  396. <?php $tr_hide = "";?>
  397. <h4 class="title">产成品</h4>
  398. <div class="product">
  399. <table class="table-product" border="1px">
  400. <tr>
  401. <th>品目名称</th>
  402. <th class="now-hidden">理论数量</th>
  403. <th>总库存盘点</th>
  404. <th>不合格品盘点</th>
  405. <th>单位</th>
  406. <th>总库存盘点情况</th>
  407. <th>不合格品盘点情况</th>
  408. </tr>
  409. <?php foreach($list['finishRes'] as $kk=>$vv):?>
  410. <?php
  411. if($vv['stockNo'] == $vv['theoreticalNo']){
  412. $profit = '<span class="tag-table-product bg-yellow">平</span>';
  413. }elseif($vv['stockNo'] < $vv['theoreticalNo']){
  414. $profit = '<span class="tag-table-product bg-red">亏</span>-'.($vv['theoreticalNo']-$vv['stockNo']);
  415. }elseif($vv['stockNo'] > $vv['theoreticalNo']){
  416. $profit = '<span class="tag-table-product bg-green">盈</span>+'.($vv['stockNo']-$vv['theoreticalNo']);
  417. }
  418. if($vv['scrapLoss'] == 0 ){
  419. $scrap = '<span class="tag-table-product bg-yellow">平</span>';
  420. }else if($vv['scrapLoss'] > 0){
  421. $scrap = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapLoss'];
  422. }else{
  423. $scrap = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapLoss'];
  424. }
  425. ?>
  426. <?php
  427. if($vv['theoreticalNo'] > 0){
  428. $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  429. }else{
  430. $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  431. }
  432. ?>
  433. <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['theoreticalNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['stockNo'];?>"><span class="add-count" active="false">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['scrapNo'];?>"><span class="add-count" active="false">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrap;?></td></tr>-->
  434. <?php endforeach;?>
  435. <?php echo $tr_show;?>
  436. <?php if($tr_hide):?>
  437. <?php echo $tr_hide;?>
  438. <?php endif;?>
  439. </table>
  440. <?php if($tr_hide):?>
  441. <div class="show-tr fr">展示更多</div>
  442. <?php endif;?>
  443. </div>
  444. <?php endif;?>
  445. <?php if(isset($list['fixedRes']) && $list['fixedRes']):?>
  446. <?php $tr_show = "";?>
  447. <?php $tr_hide = "";?>
  448. <h4 class="title">固定资产</h4>
  449. <div class="assets">
  450. <table class="table-assets" border="1">
  451. <tr>
  452. <th>品目名称</th>
  453. <th class="now-hidden">理论数量</th>
  454. <th>盘点数量</th>
  455. <th>单位</th>
  456. <th>盘点情况</th>
  457. </tr>
  458. <?php foreach($list['fixedRes'] as $kk=>$vv):?>
  459. <?php
  460. if($vv['stockNo'] == $vv['theoreticalNo']){
  461. $profit = '<span class="tag-table-product bg-yellow">平</span>';
  462. }elseif($vv['stockNo'] < $vv['theoreticalNo']){
  463. $profit = '<span class="tag-table-product bg-red">亏</span>-'.($vv['theoreticalNo']-$vv['stockNo']);
  464. }elseif($vv['stockNo'] > $vv['theoreticalNo']){
  465. $profit = '<span class="tag-table-product bg-green">盈</span>+'.($vv['stockNo']-$vv['theoreticalNo']);
  466. }
  467. ?>
  468. <?php
  469. if($vv['theoreticalNo'] > 0){
  470. $tr_show .= '<tr class="fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td class="blue choose-pro" planId="'.$vv['itemId'].'" originIds="'.implode(',', $vv['invFixedCodes']).'" selectIds="'.implode(',', $vv['fixedCodes']).'" active="false">'.$vv['stockNo'].'</td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td></tr>';
  471. }else{
  472. $tr_hide .= '<tr class="fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td class="blue choose-pro" planId="'.$vv['itemId'].'" originIds="'.implode(',', $vv['invFixedCodes']).'" selectIds="'.implode(',', $vv['fixedCodes']).'" active="false">'.$vv['stockNo'].'</td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td></tr>';
  473. }
  474. ?>
  475. <!--<tr class="fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['theoreticalNo'];?></td><td class="blue choose-pro" planId="<?php echo $vv['itemId'];?>" originIds="<?php echo implode(',', $vv['invFixedCodes']);?>" selectIds="<?php echo implode(',', $vv['fixedCodes']);?>" active="false"><?php echo $vv['stockNo'];?></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td></tr>-->
  476. <?php endforeach;?>
  477. <?php echo $tr_show;?>
  478. <?php if($tr_hide):?>
  479. <?php echo $tr_hide;?>
  480. <?php endif;?>
  481. </table>
  482. <?php if($tr_hide):?>
  483. <div class="show-tr fr">展示更多</div>
  484. <?php endif;?>
  485. </div>
  486. <?php endif;?>
  487. <?php if(isset($list['lowRes']) && $list['lowRes']):?>
  488. <?php $tr_show = "";?>
  489. <?php $tr_hide = "";?>
  490. <h4 class="title">低值易耗品</h4>
  491. <div class="product">
  492. <table class="table-product" border="1px">
  493. <tr>
  494. <th>品目名称</th>
  495. <th class="now-hidden">理论数量</th>
  496. <th>总库存盘点</th>
  497. <th>不合格品盘点</th>
  498. <th>单位</th>
  499. <th>总库存盘点情况</th>
  500. <th>不合格品盘点情况</th>
  501. </tr>
  502. <?php foreach($list['lowRes'] as $kk=>$vv):?>
  503. <?php
  504. if($vv['stockNo'] == $vv['theoreticalNo']){
  505. $profit = '<span class="tag-table-product bg-yellow">平</span>';
  506. }elseif($vv['stockNo'] < $vv['theoreticalNo']){
  507. $profit = '<span class="tag-table-product bg-red">亏</span>-'.($vv['theoreticalNo']-$vv['stockNo']);
  508. }elseif($vv['stockNo'] > $vv['theoreticalNo']){
  509. $profit = '<span class="tag-table-product bg-green">盈</span>+'.($vv['stockNo']-$vv['theoreticalNo']);
  510. }
  511. if($vv['scrapLoss'] == 0 ){
  512. $scrap = '<span class="tag-table-product bg-yellow">平</span>';
  513. }else if($vv['scrapLoss'] > 0){
  514. $scrap = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapLoss'];
  515. }else{
  516. $scrap = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapLoss'];
  517. }
  518. ?>
  519. <?php
  520. if($vv['theoreticalNo'] > 0){
  521. $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  522. }else{
  523. $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  524. }
  525. ?>
  526. <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['theoreticalNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['stockNo'];?>"><span class="add-count" active="false">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['scrapNo'];?>"><span class="add-count" active="false">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrap;?></td></tr>-->
  527. <?php endforeach;?>
  528. <?php echo $tr_show;?>
  529. <?php if($tr_hide):?>
  530. <?php echo $tr_hide;?>
  531. <?php endif;?>
  532. </table>
  533. <?php if($tr_hide):?>
  534. <div class="show-tr fr">展示更多</div>
  535. <?php endif;?>
  536. </div>
  537. <?php endif;?>
  538. <?php if(isset($list['rawRes']) && $list['rawRes']):?>
  539. <?php $tr_show = "";?>
  540. <?php $tr_hide = "";?>
  541. <h4 class="title">原材料</h4>
  542. <div class="product">
  543. <table class="table-product" border="1px">
  544. <tr>
  545. <th>品目名称</th>
  546. <th class="now-hidden">理论数量</th>
  547. <th>总库存盘点</th>
  548. <th>不合格品盘点</th>
  549. <th>单位</th>
  550. <th>总库存盘点情况</th>
  551. <th>不合格品盘点情况</th>
  552. </tr>
  553. <?php foreach($list['rawRes'] as $kk=>$vv):?>
  554. <?php
  555. if($vv['stockNo'] == $vv['theoreticalNo']){
  556. $profit = '<span class="tag-table-product bg-yellow">平</span>';
  557. }elseif($vv['stockNo'] < $vv['theoreticalNo']){
  558. $profit = '<span class="tag-table-product bg-red">亏</span>-'.($vv['theoreticalNo']-$vv['stockNo']);
  559. }elseif($vv['stockNo'] > $vv['theoreticalNo']){
  560. $profit = '<span class="tag-table-product bg-green">盈</span>+'.($vv['stockNo']-$vv['theoreticalNo']);
  561. }
  562. if($vv['scrapLoss'] == 0 ){
  563. $scrap = '<span class="tag-table-product bg-yellow">平</span>';
  564. }else if($vv['scrapLoss'] > 0){
  565. $scrap = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapLoss'];
  566. }else{
  567. $scrap = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapLoss'];
  568. }
  569. ?>
  570. <?php
  571. if($vv['theoreticalNo'] > 0){
  572. $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  573. }else{
  574. $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['theoreticalNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['stockNo'].'"><span class="add-count" active="false">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')" readonly="readonly" value="'.$vv['scrapNo'].'"><span class="add-count" active="false">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrap.'</td></tr>';
  575. }
  576. ?>
  577. <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['theoreticalNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['stockNo'];?>"><span class="add-count" active="false">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count" active="false">-</span><input type="text" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly" value="<?php echo $vv['scrapNo'];?>"><span class="add-count" active="false">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrap;?></td></tr>-->
  578. <?php endforeach;?>
  579. <?php echo $tr_show;?>
  580. <?php if($tr_hide):?>
  581. <?php echo $tr_hide;?>
  582. <?php endif;?>
  583. </table>
  584. <?php if($tr_hide):?>
  585. <div class="show-tr fr">展示更多</div>
  586. <?php endif;?>
  587. </div>
  588. <?php endif;?>
  589. <?php endif;?>
  590. <div class="sale-submit" style="margin-top: 25px;">
  591. <button type="button" class="" onclick="javascript:history.back(-1);">返回</button>
  592. <?php if($statusId == 2 || $statusId == 3):?>
  593. <button type="button" class=" label-primary-s bth-s editPlan">编辑</button>
  594. <?php endif;?>
  595. <?php if($list['processInfo']['showUrge']):?>
  596. <button type="button" class=" label-primary-s bth-s" id="pressPlan">催办</button>
  597. <?php endif;?>
  598. <?php if($list['processInfo']['showStop']):?>
  599. <button type="button" class=" label-primary-s bth-s" id="stopPlan">中止</button>
  600. <?php endif;?>
  601. <?php if($list['processInfo']['showDelete']):?>
  602. <button type="button" class=" label-primary-s bth-s" id="delPlan">删除</button>
  603. <?php endif;?>
  604. <?php if($statusId == 2):?>
  605. <button type="button" class=" label-primary-s bth-s" id="watchPlan">查看理由</button>
  606. <?php endif;?>
  607. <button type="button" class="label-primary-s bth-s" id="viewLog" >日志</button>
  608. </div>
  609. <div class="dialog-layer-assets-number">
  610. <div class='pan-title'>盘点数量(<span class='pan-count'>0</span>)</div>
  611. <div class='assets-number-list-parent'>
  612. </div>
  613. <div class='new-assets-number-box-parent'>
  614. </div>
  615. <div class='dialog-btn-box'>
  616. <button type="button" class="back-plan btn-dialog-colse">返回</button>
  617. <button type="button" class="btn-dialog-save" id="add-plan-identifier" style="display:none">提交</button>
  618. </div>
  619. </div>
  620. <script src="/js/jquery-2.2.2.min.js" ></script>
  621. <script src="/js/jquery.datetimepicker.js"></script>
  622. <script src="/js/layer/layer.js"></script>
  623. <script src="/js/xsgl.js"></script>
  624. <!--日志弹层-->
  625. <link rel="stylesheet" href="/css/cylet.css" />
  626. <style>
  627. .class-modal-body-1{overflow: auto;height:400px;}
  628. .class-modal-body-1 td{font-size:14px;line-height:200%}
  629. </style>
  630. <div class="confirmbox-mask" style="display: none" id="classModal">
  631. <div class="class-modal">
  632. </div>
  633. </div>
  634. <div class="confirmbox-mask" style="display: none" id="classModal-1">
  635. <form name="table_set">
  636. <div class="class-modal-1">
  637. <i class="icon icon-close-1"></i><div class="class-modal-head-1">日志</div>
  638. <div class="class-modal-body-1">
  639. <table cellspacing="0" cellpadding="0" border="0">
  640. <?php
  641. if($logList){
  642. foreach ($logList as $val){
  643. echo '<tr>';
  644. echo '<td><img src="/images/right_head.png"></td>';
  645. echo '<td width="40%">'.$val['createTime'].'</td>';
  646. echo '<td width="50%">【'.$val['userName'].'】'.$val['info'].'</td>';
  647. echo '</tr>';
  648. }
  649. }
  650. ?>
  651. </table>
  652. </div>
  653. </div>
  654. </form>
  655. </div>
  656. </body>
  657. <script>
  658. $('.icon-close-1').click(function(){
  659. $('#classModal-1').hide();
  660. });
  661. $('#viewLog').click(function(){
  662. $('#classModal-1').show();
  663. });
  664. </script>
  665. <script>
  666. $(function(){
  667. window.status = 0;//查看
  668. })
  669. </script>
  670. <?php // include_once '_stock.php'?>
  671. <script>
  672. //////////状态事件
  673. //查看理由
  674. $('body').delegate('#watchPlan','click', function(){
  675. <?php if(isset($list['resDTOList']) && $list['resDTOList']):?>
  676. <?php $noticeArr = end($list['resDTOList']);$notice = $noticeArr['info'];?>
  677. layer.alert("<?php echo $notice;?>", {icon: 7});
  678. <?php endif;?>
  679. });
  680. //催办
  681. $('body').delegate('#pressPlan','click', function(){
  682. // var data = {
  683. // 'smeDesc': '催办',
  684. // 'businessKey': '<?php // echo $list['processInfo']['businessKey'];?>'
  685. // };
  686. // $.ajax({
  687. // type: 'post',
  688. // url: "<?php // echo Yii::app()->createUrl('imsSale/urge');?>",
  689. // data: data,
  690. // dataType: 'json',
  691. // success: function (data) {
  692. // if (data.status) {
  693. // layer.closeAll();
  694. // window.location.href = "<?php // echo $this->createUrl('imsStore/newStock');?>";
  695. // } else {
  696. // flag = true;
  697. // $('.alert-msg').html(data.msg).fadeIn();
  698. // }
  699. // },
  700. // error: function () {
  701. // flag = true;
  702. // $('.alert-msg').html("异常错误").fadeIn();
  703. // }
  704. // });
  705. layer.open({
  706. type: 1,
  707. title: '催办',
  708. btn: ['确定', '取消'],
  709. area: ['600px', '400px'], //宽高
  710. btnAlign: 'c',
  711. content: '<p style="color: red;display: none;" class="alert-msg"></p><div class="urge-layer-box"><span>内容:</span><textarea rows="10" cols="60" id="urgeText" /></div>',
  712. yes: function (index, layero) {
  713. //提交
  714. var text = $('#urgeText').val();
  715. var data = {
  716. 'smeDesc': text,
  717. 'businessKey': '<?php echo $list['processInfo']['businessKey'];?>'
  718. };
  719. if ($.trim(text)) {
  720. // if (flag) {
  721. // flag = false;
  722. $.ajax({
  723. type: 'post',
  724. url: "<?php echo Yii::app()->createUrl('imsSale/urge');?>",
  725. data: data,
  726. dataType: 'json',
  727. success: function (data) {
  728. if (data.status) {
  729. layer.closeAll();
  730. window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
  731. // location.reload();
  732. } else {
  733. flag = true;
  734. $('.alert-msg').html(data.msg).fadeIn();
  735. }
  736. },
  737. error: function () {
  738. flag = true;
  739. $('.alert-msg').html("异常错误").fadeIn();
  740. }
  741. });
  742. // }
  743. } else {
  744. $('.alert-msg').html("请填写内容").fadeIn();
  745. }
  746. },
  747. btn2: function (index, layero) {
  748. //取消按钮
  749. console.log(111)
  750. //return false 开启该代码可禁止点击该按钮关闭
  751. }
  752. });
  753. });
  754. //中止
  755. $('body').delegate('#stopPlan','click', function(){
  756. var businessKey = '<?php echo $list['processInfo']['businessKey'];?>';
  757. var doType = 'stop';
  758. $.ajax({
  759. type: 'get',
  760. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxOutDelStop');?>",
  761. data: {'businessKey': businessKey,doType:doType},
  762. dataType: 'json',
  763. success: function (data) {
  764. if (data.status) {
  765. layer.alert("提交成功", {icon: 1,closeBtn:0},function (index) {
  766. window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
  767. layer.closeAll();
  768. });
  769. } else {
  770. layer.alert(data.msg, {icon: 7});
  771. return false;
  772. }
  773. },
  774. error: function () {
  775. layer.msg("网络异常");
  776. return false;
  777. }
  778. })
  779. });
  780. //删除
  781. $('body').delegate('#delPlan','click', function(){
  782. var businessKey = '<?php echo $list['processInfo']['businessKey'];?>';
  783. var doType = 'del';
  784. $.ajax({
  785. type: 'get',
  786. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxOutDelStop');?>",
  787. data: {'businessKey': businessKey,doType:doType},
  788. dataType: 'json',
  789. success: function (data) {
  790. if (data.status) {
  791. layer.alert("提交成功", {icon: 1,closeBtn:0},function (index) {
  792. window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
  793. layer.closeAll();
  794. });
  795. } else {
  796. layer.alert(data.msg, {icon: 7});
  797. return false;
  798. }
  799. },
  800. error: function () {
  801. layer.msg("网络异常");
  802. return false;
  803. }
  804. })
  805. });
  806. //编辑
  807. $('body').delegate('.editPlan','click', function(){
  808. window.status = 1;
  809. $('.stocktakingDate').attr("active","true").attr("id",'stocktakingDate');
  810. $('.stocktakingDate').datetimepicker({
  811. format: "Y-m-d", //格式化日期
  812. timepicker: false //关闭时间选项
  813. });
  814. $('#imgPreview').attr("active","true");
  815. $('.img-title').css("display","inline-block");
  816. $('#remark').prop("readonly",false);
  817. $('.choose-pro,.reduce-count,.add-count').attr("active","true");
  818. $('input[name="plan-count"]').attr("readonly",false);
  819. $('#add-plan-identifier').css("display","inline-block");
  820. $(this).html("提交");
  821. $(this).removeClass("editPlan").addClass("edit-plan-identifier");
  822. $('#watchPlan,#delPlan').css("display","none");
  823. });
  824. ///////
  825. $('body').delegate('.choose-pro','click', function(){
  826. if(status == 1){
  827. var cssStr = "display:inline-block";
  828. }else{
  829. var cssStr = "display:none";
  830. }
  831. var planId = $(this).attr("planId");
  832. var originIds = $(this).attr("originIds");
  833. var selectIds = $(this).attr("selectIds");
  834. var active = $(this).attr("active");
  835. if(selectIds){
  836. var selectIdsArr = selectIds.split(",");
  837. }else{
  838. var selectIdsArr = [];
  839. }
  840. if(active == "false"){
  841. var disabledStr = "disabled='disabled'";
  842. }else{
  843. var disabledStr = '';
  844. }
  845. // if(planId){
  846. // $.ajax({
  847. // url: "<?php // echo Yii::app()->createUrl('imsStore/ajaxGetIdentifier')?>",
  848. // type: "post",
  849. // data: {'planId':planId},
  850. // dataType: 'json',
  851. // success: function (res) {
  852. // console.log(res);
  853. var html = "";
  854. // html += "<div class='pan-title'>盘点数量(<span class='pan-count'>0</span>)</div>";
  855. if(originIds){
  856. originIdsArr = originIds.split(",");
  857. html += "<div class='assets-number-list'>";
  858. for(var a = 0;a<originIdsArr.length;a++){
  859. if($.inArray(originIdsArr[a],selectIdsArr) > -1){
  860. html += "<label><input type='checkbox' name='need-plan' value='' checked='checked' "+disabledStr+"><input type='text' value='"+originIdsArr[a]+"' name='need-plan-name' class='input-layer-new-assets-number' readonly='readonly'></label>";
  861. }else{
  862. html += "<label><input type='checkbox' name='need-plan' value='' "+disabledStr+"><input type='text' value='"+originIdsArr[a]+"' name='need-plan-name' class='input-layer-new-assets-number' readonly='readonly'></label>";
  863. }
  864. }
  865. html += "</div>";
  866. }else{
  867. originIdsArr = [];
  868. }
  869. var html3 = "";
  870. if(selectIds){
  871. selectIdsArr = selectIds.split(",");
  872. var selectId = 1;
  873. var isSelect = 0;
  874. for(var b = 0;b<selectIdsArr.length;b++){
  875. if($.inArray(selectIdsArr[b],originIdsArr) < 0){
  876. isSelect = 1;
  877. if(selectId == 1){
  878. html3 += "<div class='new-assets-number-box'>";
  879. html3 += " <input type='checkbox' name='need-plan' value='' checked='checked' "+disabledStr+"><input type='text' value='"+selectIdsArr[b]+"' name='need-plan-name' class='input-new-assets-number' "+disabledStr+">";
  880. html3 += " <button type='button' class='new-add-plan' style='"+cssStr+"'>新盘点编号</button>";
  881. html3 += "</div>";
  882. selectId = 0;
  883. }else{
  884. html3 += "<div class='new-assets-number-box'><input type='checkbox' name='need-plan' value='' checked='checked' "+disabledStr+"><input type='text' value='"+selectIdsArr[b]+"' name='need-plan-name' class='input-new-assets-number' "+disabledStr+"></div>";
  885. }
  886. }
  887. }
  888. if(isSelect == 0){
  889. html3 += "<div class='new-assets-number-box'>";
  890. html3 += " <input type='checkbox' name='need-plan' value='' "+disabledStr+"><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号' "+disabledStr+">";
  891. html3 += " <button type='button' class='new-add-plan' style='"+cssStr+"'>新盘点编号</button>";
  892. html3 += "</div>";
  893. }
  894. }else{
  895. html3 += "<div class='new-assets-number-box'>";
  896. html3 += " <input type='checkbox' name='need-plan' value='' "+disabledStr+"><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号' "+disabledStr+">";
  897. html3 += " <button type='button' class='new-add-plan' style='"+cssStr+"'>新盘点编号</button>";
  898. html3 += "</div>";
  899. }
  900. $('.new-assets-number-box-parent').html(html3);
  901. // html += "<div class='new-assets-number-box'>";
  902. // html += " <input type='checkbox' name='need-plan' value=''><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号'>";
  903. // html += " <button type='button' class='new-add-plan'>新盘点编号</button>";
  904. // html += "</div>";
  905. // html += "<div class='dialog-btn-box'>";
  906. // html += ' <button type="button" class="back-plan btn-dialog-colse">返回</button>';
  907. // html +=' <button type="button" class="btn-dialog-save" id="add-plan-identifier" planId='+planId+'>提交</button>';
  908. // html += "</div>";
  909. $('.assets-number-list-parent').html(html);
  910. $('#add-plan-identifier').attr("planId",planId);
  911. var length = $('.dialog-layer-assets-number input:checked').length;
  912. $('.pan-count').html(length);
  913. layer.open({
  914. title: false,
  915. closeBtn: 0,
  916. type: 1,
  917. area: ['360px', '200px'],
  918. content: $(".dialog-layer-assets-number")
  919. });
  920. // }
  921. // })
  922. // }
  923. });
  924. $('body').delegate('.dialog-layer-assets-number input[type="checkbox"]','click', function(){
  925. var length = $('.dialog-layer-assets-number input:checked').length;
  926. $('.pan-count').html(length);
  927. });
  928. $('body').delegate('.btn-dialog-colse','click', function(){
  929. layer.close(layer.index);
  930. });
  931. $('body').delegate('.new-add-plan','click', function(){
  932. var html = "<div class='new-assets-number-box'><input type='checkbox' name='need-plan' value=''><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号'></div>";
  933. $(this).parent().after(html);
  934. });
  935. $('body').delegate('#add-plan-identifier','click', function(){
  936. var selectIdentifierIds = [];
  937. var originIdentifierIds = [];
  938. var planId = $(this).attr("planId");
  939. $('input[name="need-plan"]:checked').each(function(){
  940. if($(this).next().val()){
  941. selectIdentifierIds.push($(this).next().val());
  942. }
  943. });
  944. $('.assets-number-list input[name="need-plan-name"]').each(function(){
  945. originIdentifierIds.push($(this).val());
  946. })
  947. // if(selectIdentifierIds.length>0){
  948. $('.choose-pro[planId='+planId+']').html(selectIdentifierIds.length);
  949. // }
  950. $('.choose-pro[planId='+planId+']').attr("selectIds",selectIdentifierIds.join(","));
  951. $('.choose-pro[planId='+planId+']').attr("originIds",originIdentifierIds.join(","));
  952. layer.close(layer.index);
  953. console.log(selectIdentifierIds);
  954. })
  955. $('body').delegate('.add-count[active="true"]','click', function(){
  956. var count = parseInt($(this).prev().val());
  957. count += 1;
  958. $(this).prev().val(count);
  959. if($(this).parent().hasClass("inv-count")){
  960. var type = 6;
  961. }else{
  962. var type = 7;
  963. }
  964. var oldCount = parseInt($(this).parent().parent().prev().text());
  965. if(oldCount == count){
  966. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
  967. }else if(oldCount > count){
  968. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
  969. }else if(oldCount < count){
  970. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
  971. }
  972. });
  973. $('body').delegate('.reduce-count[active="true"]','click', function(){
  974. var count = parseInt($(this).next().val());
  975. if($(this).parent().hasClass("inv-count")){
  976. var type = 6;
  977. }else{
  978. var type = 7;
  979. }
  980. if(count >= 1){
  981. count -= 1;
  982. $(this).next().val(count);
  983. var oldCount = parseInt($(this).parent().parent().prev().text());
  984. if(oldCount == count){
  985. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
  986. }else if(oldCount > count){
  987. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
  988. }else if(oldCount < count){
  989. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
  990. }
  991. }
  992. });
  993. $('.plan-count').on('input propertychange', function() {
  994. var count = parseInt($(this).val());
  995. var oldCount = parseInt($(this).parent().parent().prev().text());
  996. if($(this).parent().hasClass("inv-count")){
  997. var type = 6;
  998. }else{
  999. var type = 7;
  1000. }
  1001. if(oldCount == count){
  1002. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
  1003. }else if(oldCount > count){
  1004. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
  1005. }else if(oldCount < count){
  1006. $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
  1007. }
  1008. });
  1009. $('.asd[active="true"]').on('click',function(){
  1010. console.log(6666)
  1011. });
  1012. //添加图片
  1013. $("#fileImg").on("change", function () {
  1014. //限制图片数量
  1015. var imgObj = $('#imgPreview img');
  1016. if(imgObj.length>=10){
  1017. layer.msg("最多可上传10张图片");
  1018. return false;
  1019. }
  1020. var formData = new FormData();
  1021. formData.append('uploadFile', document.getElementById('fileImg').files[0]);
  1022. if(document.getElementById('fileImg').files[0]==undefined){
  1023. return false;
  1024. }
  1025. var basic = "<?php echo $basic;?>";
  1026. $.ajax({
  1027. url: "<?php echo $uploadUrl;?>",
  1028. type: "post",
  1029. data: formData,
  1030. processData: false,
  1031. contentType: false,
  1032. beforeSend: function (req) {
  1033. req.setRequestHeader("Authorization", basic);
  1034. },
  1035. success: function (data) {
  1036. console.log(data);
  1037. if (data.errCode == '00') {
  1038. var html = "<img src='" + data.data.url + "'>";
  1039. $('#imgPreview').append(html);
  1040. $('#uploadImg').val('');
  1041. } else {
  1042. layer.msg(data.errMsg);
  1043. }
  1044. },
  1045. error:function(data){
  1046. console.log(data);
  1047. }
  1048. });
  1049. });
  1050. $("body").on("click", "#imgPreview[active='true'] img", function () {
  1051. var obj = $(this);
  1052. var imgUrl = $(this).attr('src');
  1053. layer.confirm('您确定删除此图片吗?', {
  1054. btn: ['确定', '取消'] //按钮
  1055. }, function () {
  1056. obj.remove();
  1057. layer.closeAll();
  1058. });
  1059. });
  1060. //提交
  1061. $('body').delegate('.edit-plan-identifier','click', function(){
  1062. var flag = true;
  1063. if (flag){
  1064. flag = false;
  1065. var stockTitle = $.trim($("input[name='stockTitle']").val());
  1066. var stocktakingDate = $("input[name='stocktakingDate']").val();
  1067. var remark = $('#remark').val();
  1068. var details = [];
  1069. var isZero = 0;
  1070. var no = 0;
  1071. if (stockTitle == '') {
  1072. layer.msg('标题名称不能为空!');
  1073. return false;
  1074. } else if (stockTitle.length > 49) {
  1075. showMsg('标题名称不能超过50个字符!');
  1076. return false;
  1077. }
  1078. if (!stocktakingDate) {
  1079. layer.msg('时间不能为空!');
  1080. return false;
  1081. }
  1082. var imgArr = [];
  1083. $('#imgPreview img').each(function () {
  1084. imgArr.push($(this).attr('src'));
  1085. });
  1086. if (imgArr.length < 1) {
  1087. layer.msg('请上传图片!');
  1088. return false;
  1089. }
  1090. //其他
  1091. $('.no-fixed').each(function(){
  1092. details[no] = {};
  1093. details[no].fixedCodes = [];
  1094. details[no].invFixedCodes = [];
  1095. details[no].itemId = $(this).attr("itemId");
  1096. details[no].stockNo = parseFloat($(this).find("td:eq(2)").find("input").val());
  1097. details[no].theoreticalNo = parseFloat($(this).find("td:eq(1)").text());
  1098. details[no].lossNo = accSub(parseFloat($(this).find("td:eq(2)").find("input").val()),parseFloat($(this).find("td:eq(1)").text()));
  1099. details[no].scrapOld = parseFloat($(this).find("td:eq(3)").text());
  1100. details[no].scrapNo = parseFloat($(this).find("td:eq(4)").find("input").val());
  1101. details[no].scrapLoss = accSub(parseFloat($(this).find("td:eq(4)").find("input").val()),parseFloat($(this).find("td:eq(3)").text()));
  1102. if(details[no].lossNo == 0){
  1103. details[no].lossType = 2;
  1104. }else if(details[no].lossNo > 0){
  1105. details[no].lossType = 1;
  1106. }else if(details[no].lossNo < 0){
  1107. details[no].lossType = 0;
  1108. }
  1109. if(details[no].stockNo == 0){
  1110. isZero = 1;
  1111. }
  1112. no++;
  1113. });
  1114. $('.fixed').each(function(){
  1115. details[no] = {};
  1116. if($(this).find("td:eq(2)").attr("selectIds")){
  1117. details[no].fixedCodes = $(this).find("td:eq(2)").attr("selectIds").split(",");
  1118. }else{
  1119. details[no].fixedCodes = [];
  1120. }
  1121. if($(this).find("td:eq(2)").attr("originIds")){
  1122. details[no].invFixedCodes = $(this).find("td:eq(2)").attr("originIds").split(",");
  1123. }else{
  1124. details[no].invFixedCodes = [];
  1125. }
  1126. details[no].itemId = $(this).attr("itemId");
  1127. details[no].stockNo = parseFloat($(this).find("td:eq(2)").text());
  1128. details[no].theoreticalNo = $(this).find("td:eq(1)").text();
  1129. details[no].lossNo = accSub(parseFloat($(this).find("td:eq(2)").text()),$(this).find("td:eq(1)").text());
  1130. if(details[no].lossNo == 0){
  1131. details[no].lossType = 2;
  1132. }else if(details[no].lossNo > 0){
  1133. details[no].lossType = 1;
  1134. }else if(details[no].lossNo < 0){
  1135. details[no].lossType = 0;
  1136. }
  1137. if(details[no].stockNo == 0){
  1138. isZero = 1;
  1139. }
  1140. no++;
  1141. });
  1142. //固定资产
  1143. // var fixedCodesArr = [];
  1144. // var inFixedCodesArr = [];
  1145. // if (itemType.val()==0){
  1146. // var fixedObj = $('input[name="fixedCodes"]:checked');
  1147. // fixedObj.each(function () {
  1148. // fixedCodesArr.push($(this).val());
  1149. // });
  1150. // var infixedObj = $('input[name="fixedCodes"]');
  1151. // infixedObj.each(function () {
  1152. // inFixedCodesArr.push($(this).val());
  1153. // });
  1154. // }
  1155. var processInfo = '<?php echo json_encode($list['processInfo']);?>';
  1156. var data = {
  1157. stockTitle: stockTitle,
  1158. stocktakingDate: stocktakingDate,
  1159. imgArr: imgArr,
  1160. remark:remark,
  1161. details:details,
  1162. processInfo:JSON.parse(processInfo),
  1163. stockId:'<?php echo $list['stockId'];?>',
  1164. pId:'<?php echo $_GET['planId']?>'
  1165. };
  1166. console.log(data);
  1167. if(isZero == 1){
  1168. layer.confirm('盘点数量有0值项,确定提交吗?', {
  1169. btn: ['提交', '返回'] //按钮
  1170. }, function () {
  1171. $.ajax({
  1172. type: 'POST',
  1173. url: "<?php echo $this->createUrl('imsStore/ajaxNewStockEdit');?>",
  1174. data: data,
  1175. async: false,
  1176. dataType: 'json',
  1177. success: function (result) {
  1178. if (result.status == 1) {
  1179. layer.alert(result.msg, {icon: 1,closeBtn:0}, function () {
  1180. window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
  1181. })
  1182. } else {
  1183. flag = true;
  1184. layer.alert(result.msg,{icon:2});
  1185. }
  1186. },
  1187. error: function (jqXHR, textStatus, errorThrown) {
  1188. /*错误信息处理*/
  1189. flag = true;
  1190. layer.msg('提交失败');
  1191. }
  1192. });
  1193. },function(){
  1194. layer.closeAll();
  1195. });
  1196. }else{
  1197. layer.confirm('确认提交盘点单吗?', {
  1198. btn: ['提交', '返回'] //按钮
  1199. }, function () {
  1200. $.ajax({
  1201. type: 'POST',
  1202. url: "<?php echo $this->createUrl('imsStore/ajaxNewStockEdit');?>",
  1203. data: data,
  1204. async: false,
  1205. dataType: 'json',
  1206. success: function (result) {
  1207. if (result.status == 1) {
  1208. layer.alert(result.msg, {icon: 1,closeBtn:0}, function () {
  1209. window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
  1210. })
  1211. } else {
  1212. flag = true;
  1213. layer.alert(result.msg,{icon:2});
  1214. }
  1215. },
  1216. error: function (jqXHR, textStatus, errorThrown) {
  1217. /*错误信息处理*/
  1218. flag = true;
  1219. layer.msg('提交失败');
  1220. }
  1221. });
  1222. },function(){
  1223. layer.closeAll();
  1224. });
  1225. }
  1226. } else {
  1227. layer.msg("稍安勿躁,正在处理中...");
  1228. }
  1229. });
  1230. //展示更多或收起
  1231. $("body").on("click",".show-tr", function(){
  1232. if($(this).hasClass("hide-tr")){
  1233. $(this).prev().find("tr.need-hide").addClass("hide");
  1234. $(this).html("展开更多");
  1235. $(this).removeClass("hide-tr");
  1236. }else{
  1237. $(this).html("收起");
  1238. $(this).addClass("hide-tr");
  1239. $(this).prev().find("tr.need-hide").removeClass("hide");
  1240. }
  1241. });
  1242. var accSub = function(num1, num2) {
  1243. num1 = Number(num1);
  1244. num2 = Number(num2);
  1245. var dec1, dec2, times;
  1246. try { dec1 = countDecimals(num1)+1; } catch (e) { dec1 = 0; }
  1247. try { dec2 = countDecimals(num2)+1; } catch (e) { dec2 = 0; }
  1248. times = Math.pow(10, Math.max(dec1, dec2));
  1249. // var result = Number(((num1 * times - num2 * times) / times);
  1250. var result = Number((accMul(num1, times) - accMul(num2, times)) / times);
  1251. return getCorrectResult("sub", num1, num2, result);
  1252. // return result;
  1253. };
  1254. function accMul(arg1,arg2)
  1255. {
  1256. var m=0,s1=arg1.toString(),s2=arg2.toString();
  1257. try{m+=s1.split(".")[1].length}catch(e){}
  1258. try{m+=s2.split(".")[1].length}catch(e){}
  1259. return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
  1260. }
  1261. var countDecimals = function(num) {
  1262. var len = 0;
  1263. try {
  1264. num = Number(num);
  1265. var str = num.toString().toUpperCase();
  1266. if (str.split('E').length === 2) { // scientific notation
  1267. var isDecimal = false;
  1268. if (str.split('.').length === 2) {
  1269. str = str.split('.')[1];
  1270. if (parseInt(str.split('E')[0]) !== 0) {
  1271. isDecimal = true;
  1272. }
  1273. }
  1274. let x = str.split('E');
  1275. if (isDecimal) {
  1276. len = x[0].length;
  1277. }
  1278. len -= parseInt(x[1]);
  1279. } else if (str.split('.').length === 2) { // decimal
  1280. if (parseInt(str.split('.')[1]) !== 0) {
  1281. len = str.split('.')[1].length;
  1282. }
  1283. }
  1284. } catch(e) {
  1285. throw e;
  1286. } finally {
  1287. if (isNaN(len) || len < 0) {
  1288. len = 0;
  1289. }
  1290. return len;
  1291. }
  1292. };
  1293. var convertToInt = function(num) {
  1294. num = Number(num);
  1295. var newNum = num;
  1296. var times = countDecimals(num);
  1297. var temp_num = num.toString().toUpperCase();
  1298. if (temp_num.split('E').length === 2) {
  1299. newNum = Math.round(num * Math.pow(10, times));
  1300. } else {
  1301. newNum = Number(temp_num.replace(".", ""));
  1302. }
  1303. return newNum;
  1304. };
  1305. var getCorrectResult = function(type, num1, num2, result) {
  1306. var temp_result = 0;
  1307. switch (type) {
  1308. case "add":
  1309. temp_result = num1 + num2;
  1310. break;
  1311. case "sub":
  1312. temp_result = num1 - num2;
  1313. break;
  1314. case "div":
  1315. temp_result = num1 / num2;
  1316. break;
  1317. case "mul":
  1318. temp_result = num1 * num2;
  1319. break;
  1320. }
  1321. if (Math.abs(result - temp_result) > 1) {
  1322. return temp_result;
  1323. }
  1324. return result;
  1325. };
  1326. </script>
  1327. </body>
  1328. </html>