materialDelivery-update.jsp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  2. <%@include file="/context/mytags.jsp" %>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>物料出货编辑页面</title>
  7. <style>
  8. .ui-button {
  9. display: inline-block;
  10. padding: 2px 2px;
  11. margin-bottom: 0;
  12. font-size: 8px;
  13. font-weight: normal;
  14. line-height: 1.42857143;
  15. text-align: center;
  16. white-space: nowrap;
  17. vertical-align: middle;
  18. -ms-touch-action: manipulation;
  19. touch-action: manipulation;
  20. cursor: pointer;
  21. -webkit-user-select: none;
  22. -moz-user-select: none;
  23. -ms-user-select: none;
  24. user-select: none;
  25. background-image: none;
  26. border: 1px solid transparent;
  27. border-radius: 4px;
  28. }
  29. .formtable tr:nth-child(1) {
  30. background: #CCCCCC;
  31. height: 2rem;
  32. }
  33. .inputxt {
  34. border: none !important;
  35. }
  36. .readInput {
  37. box-shadow: 0 0 1px 1px #CCC;
  38. height: 2rem;
  39. }
  40. .readInput:hover {
  41. border-color: #409EFF;
  42. }
  43. .inputActive {
  44. box-shadow: 0 0 2px 1px #409EFF;
  45. }
  46. .inputError {
  47. color: #F56C6C;
  48. }
  49. #receiverCarId {
  50. border: none;
  51. width: 100%;
  52. }
  53. .updateInfoBox {
  54. position: absolute;
  55. bottom: 10px;
  56. width: calc(100vw - 40px);
  57. height: auto;
  58. }
  59. .updateInfo {
  60. display: flex;
  61. }
  62. textarea {
  63. max-height: 100px;
  64. width: calc(100% - 50px);
  65. }
  66. formtable, td {
  67. border: 1px solid #CCCCCC;
  68. }
  69. /*禁用按钮样式*/
  70. .openReceiverCarBtu-S {
  71. background: linear-gradient(
  72. 90deg, #909399 0%, #90939964 150%);
  73. cursor: not-allowed;
  74. }
  75. /*按钮样式*/
  76. .openReceiverCarBtu-T {
  77. cursor: pointer;
  78. background: linear-gradient(
  79. 90deg, #67C23A 0%, #67C23A64 150%);
  80. }
  81. /*正常按钮的样式*/
  82. .openReceiverCarBtu {
  83. padding: 3px 5px;
  84. border-radius: 3px;
  85. color: #FFF;
  86. box-shadow: 1px 1px 3px 1px #999999;
  87. }
  88. .openReceiverCarBtu:hover {
  89. box-shadow: none;
  90. }
  91. .td_boxs {
  92. width: 100%;
  93. display: flex;
  94. align-items: center;
  95. align-content: center;
  96. justify-content: space-between;
  97. }
  98. .hiddenBox {
  99. display: none;
  100. }
  101. td {
  102. border: none !important;
  103. }
  104. .displayFlex {
  105. display: flex;
  106. justify-content: center;
  107. align-items: center;
  108. height: 30px;
  109. }
  110. .checkbox {
  111. transition: all 0.3s;
  112. color: #409EFF;
  113. cursor: pointer;
  114. padding: 5px;
  115. }
  116. .tab-wrapper-main * div {
  117. border: none;
  118. }
  119. </style>
  120. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  121. <script type="text/javascript">
  122. $(document).ready(function () {
  123. //计量单位禁止修改
  124. $("select").attr("disabled", "disabled");
  125. //下拉框禁止选择(主要针对货品的基本单位)
  126. if (${viewFlag == 1}) {
  127. $("input[name='outNum'],input[name='materialInfoRemarks']").focus(function () {
  128. $(this).addClass("inputActive");
  129. });
  130. $("input[name='outNum'],input[name='materialInfoRemarks']").blur(function () {
  131. $(this).removeClass("inputActive");
  132. });
  133. } else {
  134. $("#btu_span").hide();
  135. $("#btu_span2").hide();
  136. $(".jeecgDetail").hide();
  137. $("#sub_tr").addClass("hiddenBox");
  138. $("#TBMaterialStockOnHandListUpdate").find(":input").attr("disabled", "disabled");
  139. }
  140. });
  141. // 修改本次出货数量
  142. function changeoutNum(obj, trIndex) {
  143. var materialInfoNoNum = $("#stockOnHand" + trIndex).val();
  144. var $this = $(obj), value = obj.value;
  145. if (parseInt(value) >= 0) {
  146. if (materialInfoNoNum < parseInt(value)) {
  147. tip("本次出货数量不能大于现存量量,请重新输入!")
  148. if (!$this.hasClass("inputError")) {
  149. $this.addClass("inputError");
  150. }
  151. $this.val(0);
  152. } else {
  153. if ($this.hasClass("inputError")) {
  154. $this.removeClass("inputError");
  155. }
  156. $this.val(parseInt(value));
  157. }
  158. } else {
  159. tip("请输入正确的本次出货数量(整数类型)")
  160. $this.addClass("inputError");
  161. $this.val(0);
  162. }
  163. }
  164. //表单验证
  165. function beforeSubmit() {
  166. if (${viewFlag == 1}) {
  167. //出货时间
  168. var outTime = $('input[name=outTime]').val()
  169. if (outTime == null || outTime === "") {
  170. tip('请选择出库时间')
  171. return false
  172. }else{
  173. var $tbody = $("#tbMaterialDelivery");
  174. var submitStatus = true;
  175. $tbody.find('tr', this).each(function (i) {
  176. $(':input', this).each(function () {
  177. var $this = $(this), name = $this.attr('name'), id = $this.attr('id'), val = $this.val();
  178. if (name != null) {
  179. if (name.indexOf("receiverCarId") >= 0) {
  180. console.log(name,val);
  181. if(val == null || val === ""){
  182. submitStatus = false;
  183. tip('请选择领料车')
  184. }
  185. }
  186. if(name.indexOf("outNum") >= 0){
  187. if (val == null || val === "" || val == "0") {
  188. submitStatus = false;
  189. tip('请输入出货量')
  190. }
  191. }
  192. }
  193. });
  194. });
  195. return submitStatus
  196. }
  197. } else {
  198. tip('查看模式禁止提交')
  199. return false
  200. }
  201. }
  202. //打开弹窗选择领料车
  203. function openReceiverCarWindow(trIndex) {
  204. if (${viewFlag == 1}) {
  205. $.dialog({
  206. title: "选择领料车",
  207. content: "url:carController.do?nlist&viewFlag=1&materialDaptId=${materialDaptId}",
  208. zIndex: getzIndex(),
  209. lock: true, width: '80vw', height: '80vh',
  210. cache: false,
  211. button: [
  212. {
  213. name: '<t:mutiLang langKey="common.confirm"/>',
  214. callback: function () {
  215. var iframe = this.iframe.contentWindow;
  216. var selectRows = JSON.parse(iframe.getReason());
  217. var one = selectRows[0];
  218. changeReceiverCar(one, trIndex);
  219. },
  220. focus: true
  221. },
  222. {
  223. name: '<t:mutiLang langKey="common.cancel"/>',
  224. callback: function () {
  225. }
  226. }
  227. ]
  228. });
  229. } else {
  230. tip('查看模式禁止编辑')
  231. return false
  232. }
  233. }
  234. function changeReceiverCar(rowData, trIndex) {
  235. $('#receiverCarId' + trIndex).val(rowData.strId)
  236. $('#receiverCarName' + trIndex).val(rowData.strPlate)
  237. }
  238. function btn_ok() {
  239. $("#update_btnsub").click();
  240. }
  241. var checkIndex = []
  242. function clickCheck(index) {
  243. if (checkIndex.indexOf(index) >= 0) {
  244. // 已经存在的话,删除
  245. checkIndex.splice(checkIndex.indexOf(index));
  246. $("#checkbox" + index).removeClass("fa-check-square");
  247. $("#checkbox" + index).addClass("fa-square-o");
  248. } else {
  249. // 不存在的话就新增
  250. checkIndex.push(index);
  251. $("#checkbox" + index).removeClass("fa-square-o");
  252. $("#checkbox" + index).addClass("fa-check-square");
  253. }
  254. }
  255. function getUuid() {
  256. var s = []
  257. var hexDigits = '0123456789abcdef'
  258. for (var i = 0; i < 36; i++) {
  259. s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
  260. }
  261. s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
  262. s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
  263. s[8] = s[13] = s[18] = s[23] = '-'
  264. var uuid = s.join('')
  265. return uuid
  266. }
  267. //删除按钮
  268. function deleteByIndex() {
  269. if (checkIndex.length > 0) {
  270. checkIndex.forEach(item => {
  271. $("#trTag" + item).remove();
  272. })
  273. } else {
  274. tip("请先选中要删除的货品!")
  275. }
  276. resetTrNum()
  277. }
  278. function resetTrNum() {
  279. var $tbody = $("#tbMaterialDelivery");
  280. $tbody.find('tr', this).each(function (i) {
  281. var $trItemDom = $(this);
  282. var trIndex = $trItemDom.attr("id");
  283. if (trIndex != undefined && trIndex.indexOf("#index#") != -1) {
  284. $trItemDom.attr("id", trIndex.replace('#index#', i));
  285. }
  286. $(':input, select, i', this).each(function () {
  287. var $this = $(this), name = $this.attr('name'), id = $this.attr('id'), val = $this.val();
  288. if (id != null) {
  289. if (id.indexOf("#index#") >= 0) {
  290. $this.attr("id", id.replace('#index#', i));
  291. if (id.indexOf("checkbox") != -1) {
  292. $this.attr("onclick", "clickCheck(" + i + ")");
  293. } else if (id.indexOf("receiverCarName") != -1) {
  294. $this.attr("onclick", "openReceiverCarWindow(" + i + ")");
  295. } else if (id.indexOf("receiverCarNameBtu") != -1) {
  296. $this.attr("onclick", "openReceiverCarWindow(" + i + ")");
  297. } else if (id.indexOf("goodsName") != -1) {
  298. $this.attr("onclick", "openMaterialWindow(" + i + ")");
  299. } else if (id.indexOf("outNum") != -1) {
  300. $this.attr("onchange", "changeoutNum(this," + i + ")");
  301. }
  302. }
  303. }
  304. if (name != null) {
  305. if (name.indexOf("#index#") >= 0) {
  306. $this.attr("name", name.replace('#index#', i));
  307. if (name.indexOf("materialInfoGoodsname") != -1) {
  308. $this.attr("onclick", "showgoods(" + i + ")");
  309. }
  310. }
  311. }
  312. });
  313. $(this).find('input[name=\'xh\']').val(i);
  314. });
  315. }
  316. function goodsIdIsNotEmpty(goodsId) {
  317. var status = true;
  318. var $tbody = $("#tbMaterialDelivery");
  319. $tbody.find('tr', this).each(function (i) {
  320. $(':input', this).each(function () {
  321. var $this = $(this), id = $this.attr('id'), val = $this.val();
  322. if (id != null) {
  323. if (id.indexOf("goodsId") != -1 && val === goodsId) {
  324. tip('物料已存在,请选择别的现存物料!')
  325. status = false;
  326. return status;
  327. }
  328. }
  329. })
  330. })
  331. return status;
  332. }
  333. //添加按钮
  334. function addTr() {
  335. var trStr = `<tr id="trTag#index#">
  336. <input id="infoId#index#" name="infoId" type="hidden" value=""/>
  337. <input id="goodsId#index#" name="goodsId" type="hidden" value=""/>
  338. <c:if test="${viewFlag == 1}">
  339. <td class="displayFlex">
  340. <i class="fa fa-square-o checkbox" id="checkbox#index#" style="font-size: 16px;" onclick="clickCheck()"></i>
  341. </td>
  342. </c:if>
  343. <td>
  344. <input type="text" class="inputxt" readonly style="width:100%;" name="xh"
  345. value=""/>
  346. </td>
  347. <td>
  348. <input id="goodsName#index#" name="goodsName" readonly type="text" class="inputxt" style="width:100%;cursor: pointer;" placeholder="点击选择现存货品" onclick="openMaterialWindow()"
  349. value=""/>
  350. </td>
  351. <td>
  352. <t:dictSelect field="baseUnit" type="list"
  353. id="baseUnit#index#"
  354. typeGroupCode="metering_calcu_unit"
  355. defaultVal="" hasLabel="false"
  356. readonly="readonly"
  357. datatype="*" title="计量单位"></t:dictSelect>
  358. </td>
  359. <td>
  360. <input id="stockOnHand#index#" name="stockOnHand" type="text" readonly class="inputxt" style="width:100%;"
  361. value="0"/>
  362. </td>
  363. <td>
  364. <input id="outNum#index#" name="outNum" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  365. style="width:100%;"
  366. onchange="changeoutNum(this)"
  367. value=""/>
  368. </td>
  369. <td>
  370. <div class="td_boxs">
  371. <input id="receiverCarId#index#" name="receiverCarId" type="hidden" readonly
  372. class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  373. value=""/>
  374. <input id="receiverCarName#index#" name="receiverCarName" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  375. style="width:calc(100% - 100px);"
  376. readonly openReceiverCarWindow()
  377. value=""/><span id="receiverCarNameBtu#index#"
  378. class="openReceiverCarBtu ${viewFlag == 2 ? 'openReceiverCarBtu-S' : 'openReceiverCarBtu-T'}"><i class="fa fa-send-o" style="padding-right:5px" openReceiverCarWindow()></i>选择领料车</span>
  379. </div>
  380. </td>
  381. <td>
  382. <input name="materialInfoRemarks" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  383. style="width:100%;"
  384. value=""/>
  385. </td>
  386. </tr>`;
  387. $("#tbMaterialDelivery").append(trStr);
  388. resetTrNum();
  389. }
  390. function openMaterialWindow(trIndex) {
  391. $.dialog({
  392. title: "录入:选择现存物料",
  393. content: "url:tBMaterialController.do?goAddDelivery&viewFlag=1",
  394. zIndex: getzIndex(),
  395. lock: true, width: '60vw', height: '60vh',
  396. cache: false,
  397. button: [
  398. {
  399. name: '<t:mutiLang langKey="common.confirm"/>',
  400. callback: function () {
  401. var iframe = this.iframe.contentWindow;
  402. var selectRows = JSON.parse(iframe.getSelectRowsOnAdd());
  403. var one = selectRows[0];
  404. //首先判断选中的货品是否已经存在于form表单
  405. var status = goodsIdIsNotEmpty(one.goodsId);
  406. //将选中的货品信息写入到form表单
  407. if(status){
  408. //货品id
  409. $("#goodsId" + trIndex).val(one.goodsId);
  410. //货品名称
  411. $("#goodsName" + trIndex).val(one.goodsName);
  412. //货品基本单位
  413. $("#baseUnit" + trIndex).val(one.baseUnit);
  414. //货品现存量
  415. $("#stockOnHand" + trIndex).val(one.stockOnHand);
  416. }
  417. },
  418. focus: true
  419. },
  420. {
  421. name: '<t:mutiLang langKey="common.cancel"/>',
  422. callback: function () {
  423. }
  424. }
  425. ]
  426. });
  427. }
  428. </script>
  429. </head>
  430. <body style="overflow-x: hidden;">
  431. <t:formvalid formid="TBMaterialStockOnHandListUpdate" dialog="true" usePlugin="password" layout="false" tiptype="1"
  432. action="tBMaterialController.do?doUpdateDelivery" beforeSubmit="beforeSubmit">
  433. <div style="display:none"><input type="submit" id="update_btnsub" value=""/></div>
  434. <span id="btu_span" type="button" class="btu_element btu_success_def" style="cursor: pointer;" onclick="addTr()"><i
  435. class="fa fa-plus"></i>添加</span><span id="btu_span2" type="button" class="btu_element btu_danger"
  436. style="cursor: pointer;margin-left: 15px;"
  437. onclick="deleteByIndex()"><i
  438. class="fa fa-trash-o"></i>删除</span>
  439. <table id="tbMaterialDelivery" cellpadding="0" cellspacing="1" class="formtable" style="width: calc(100vw - 10px);">
  440. <tr>
  441. <c:if test="${viewFlag == 1}">
  442. <th>选择</th>
  443. </c:if>
  444. <th>序号</th>
  445. <th>货品名称</th>
  446. <th>计量单位</th>
  447. <th>现存量</th>
  448. <th>出货数量</th>
  449. <th>领料车号</th>
  450. <th>备注</th>
  451. </tr>
  452. <c:if test="${TBMaterialStockOnHandList != null && TBMaterialStockOnHandList.size() > 0}">
  453. <c:forEach items="${TBMaterialStockOnHandList}" var="item" varStatus="itemStatus">
  454. <tr id="trTag${itemStatus.index}">
  455. <input id="infoId${itemStatus.index}" name="infoId" type="hidden"
  456. value="${item.id != null ? item.id : ''}"/>
  457. <input id="goodsId${itemStatus.index}" name="goodsId" type="hidden" value="${item.goodsId}"/>
  458. <c:if test="${viewFlag == 1}">
  459. <td class="displayFlex">
  460. <i class="fa fa-square-o checkbox" id="checkbox${itemStatus.index}" style="font-size: 16px;"
  461. onclick="clickCheck(${itemStatus.index})"></i>
  462. </td>
  463. </c:if>
  464. <td>
  465. <input type="text" class="inputxt" readonly style="width:100%;" name="xh"
  466. value="${itemStatus.index + 1 }"/>
  467. </td>
  468. <td>
  469. <input name="goodsName" readonly type="text" class="inputxt" style="width:100%;cursor: pointer;"
  470. placeholder="点击选择现存货品" onclick="openMaterialWindow(${itemStatus.index})"
  471. value="${item.goodsName}"/>
  472. </td>
  473. <td>
  474. <t:dictSelect field="baseUnit" type="list"
  475. id="baseUnit${itemStatus.index}"
  476. typeGroupCode="metering_calcu_unit"
  477. defaultVal="${item.baseUnit != null ? item.baseUnit : ''}" hasLabel="false"
  478. datatype="*" title="计量单位"></t:dictSelect>
  479. </td>
  480. <td>
  481. <input id="stockOnHand${itemStatus.index}" name="stockOnHand" type="text" readonly
  482. class="inputxt" style="width:100%;"
  483. value="${item.stockOnHand != null ? item.stockOnHand : '0' }"/>
  484. </td>
  485. <td>
  486. <input id="outNum${itemStatus.index}" name="outNum" type="text"
  487. class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  488. style="width:100%;"
  489. onchange="changeoutNum(this,${itemStatus.index})"
  490. value="${item.outNum != null ? item.outNum : '0' }"/>
  491. </td>
  492. <td>
  493. <div class="td_boxs">
  494. <input id="receiverCarId${itemStatus.index}" name="receiverCarId" type="hidden" readonly
  495. class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  496. value="${item.receiverCarId != null ? item.receiverCarId : '' }"/>
  497. <input id="receiverCarName${itemStatus.index}" name="receiverCarName" type="text"
  498. class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  499. style="width:calc(100% - 100px);"
  500. readonly onclick="openReceiverCarWindow(${itemStatus.index})"
  501. value="${item.receiverCarName != null ? item.receiverCarName : '' }"/><span
  502. class="openReceiverCarBtu ${viewFlag == 2 ? 'openReceiverCarBtu-S' : 'openReceiverCarBtu-T'}"
  503. onclick="openReceiverCarWindow(${itemStatus.index})"><i class="fa fa-send-o"
  504. style="padding-right:5px"></i>选择领料车</span>
  505. </div>
  506. </td>
  507. <td>
  508. <input name="materialInfoRemarks" type="text" class="${viewFlag == 2 ? 'inputxt' : 'readInput'}"
  509. style="width:100%;"
  510. value="${item.materialInfoRemarks != null ? item.materialInfoRemarks : '' }"/>
  511. </td>
  512. </tr>
  513. </c:forEach>
  514. </c:if>
  515. </table>
  516. <div class="updateInfoBox tab-wrapper-main">
  517. <%--出货详情id--%>
  518. <input name="id" type="hidden" readonly value="${id}">
  519. <%--入库时间--%>
  520. <input name="putTime" readonly type="hidden" value="${putTime}">
  521. <%--请购科室id--%>
  522. <input name="materialDaptId" readonly type="hidden" value="${materialDaptId}">
  523. <div class="updateInfo">
  524. <div style="width: 50%;">仓库:<span style="color: #909399;font-weight: bold;"><input
  525. name="materialWarehouseId" type="hidden" readonly value="${materialWarehouseId}" class="inputxt"
  526. style="width:200px"/>${materialWarehouseName}
  527. </div>
  528. <div style="width: 50%;">
  529. <span style="color: #F56C6C;" class="requiredIcon">*</span>出库时间:
  530. <input id="outTime" name="outTime" type="text" class="form-control"
  531. style="width: 200px;cursor: pointer;"
  532. placeholder="点击选择时间" autocomplete="off" value="${empty outTime ? '' : outTime.substring(0,10)}"
  533. onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" ignore="ignore">
  534. <span class="Validform_checktip" style="float:left;height:0px;"></span>
  535. </div>
  536. </div>
  537. <div style="display: flex;padding-top: 10px;"><div>备注:</div><textarea name="remake" type="text" cols="100"
  538. rows="10">${remake != null ? remake : ''}</textarea></div>
  539. </div>
  540. </t:formvalid>
  541. </body>