sysGoodsWarehousingEdit.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <%--
  2. time:2017-06-07 17:57:50
  3. desc:edit the 物品入库
  4. --%>
  5. <%@page language="java" pageEncoding="UTF-8"%>
  6. <%@include file="/commons/include/html_doctype.html"%>
  7. <html>
  8. <head>
  9. <title>编辑 物品入库</title>
  10. <%@include file="/commons/include/form.jsp" %>
  11. <script type="text/javascript" src="${ctx}/js/hotent/CustomValid.js"></script>
  12. <script type="text/javascript" src="${ctx}/js/hotent/formdata.js"></script>
  13. <script type="text/javascript" src="${ctx}/js/hotent/subform.js"></script>
  14. <script type="text/javascript">
  15. $(function() {
  16. $("a.add").click(function() {
  17. var flag = '${sysGoodsWarehousing.flag}';
  18. if(flag == 2){
  19. $('#sysGoodsWarehousingRelaTable a').css('display','');
  20. $('#sysGoodsWarehousingRelaTable input:text').not('input[name="quantity"]').prop('readonly',true);
  21. }
  22. });
  23. });
  24. $(function() {
  25. $("a.save").click(function() {
  26. var productcode = $("input[name='productcode']").val();
  27. if(!productcode) {
  28. $.ligerDialog.warn("请添加至少一件物品","消息提示");
  29. return;
  30. }
  31. $("#sysGoodsWarehousingForm").attr("action","save.ht");
  32. $("#saveData").val(1);
  33. submitForm();
  34. });
  35. });
  36. //提交表单
  37. function submitForm(){
  38. var options={};
  39. if(showResponse){
  40. options.success=showResponse;
  41. }
  42. var frm=$('#sysGoodsWarehousingForm').form();
  43. frm.ajaxForm(options);
  44. if(frm.valid()){
  45. frm.sortList();
  46. frm.submit();
  47. }
  48. }
  49. function showResponse(responseText) {
  50. var obj = new com.hotent.form.ResultMessage(responseText);
  51. if(!obj.isSuccess()){
  52. $.ligerDialog.err("提示信息"," 物品入库保存失败!",obj.getMessage());
  53. return;
  54. }
  55. $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  56. if(rtn){
  57. window.location.href = window.location.href;
  58. }else{
  59. window.location.href = "${ctx}/platform/system/sysGoodsWarehousing/list.ht?flag=${sysGoodsWarehousing.flag}";
  60. }
  61. });
  62. }
  63. /*选择物品*/
  64. function selectGoods(flag){goodsDialog(flag,{callback:function (data){
  65. var temddata = data[0].value.split("#");
  66. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="productid"]').val(temddata[0]);
  67. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="productcode"]').val(temddata[1]);
  68. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="productname"]').val(temddata[2]);
  69. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="brand"]').val(temddata[3]);
  70. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="specification"]').val(temddata[4]);
  71. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="price"]').val(temddata[5]);
  72. }});
  73. }
  74. /*物品对话框*/
  75. function goodsDialog(flag,conf){
  76. if(!conf) conf={};
  77. var url=__ctx + "/platform/system/sysGoodsApplication/selector.ht?flag=" + flag;
  78. var dialog = null;
  79. dialog = DialogUtil.open({
  80. passConf : {dialog:dialog},
  81. url:url,
  82. title : "物品列表",
  83. width : 600,
  84. height : 400,
  85. modal : true,
  86. resizable : true,
  87. buttons:[{
  88. text:'确定',
  89. onclick:function(){
  90. var arrysysgoods = dialog.jiframe.contents().find("input[name='sysgoodsdata'][checked]");
  91. if(conf.callback){
  92. conf.callback(arrysysgoods);
  93. dialog.close();
  94. }else{
  95. dialog.close();
  96. }
  97. }
  98. },{
  99. text:'取消',
  100. onclick: function (item,dialog) { dialog.close(); }
  101. }]
  102. });
  103. }
  104. function calculateP(obj) {
  105. if($("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="quantity"]').val() != 0) {
  106. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="totalprice"]').val(($("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="quantity"]').val()*(obj.val()*100).toFixed(2))/100);
  107. }
  108. }
  109. function calculateQ(obj) {
  110. if($("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="price"]').val() != 0) {
  111. $("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="totalprice"]').val((($("#sysGoodsWarehousingRelaForm tr,th,td").find('input[name="price"]').val()*100).toFixed(2)*obj.val())/100);
  112. }
  113. }
  114. </script>
  115. </head>
  116. <body>
  117. <div class="panel">
  118. <div class="panel-top">
  119. <div class="tbar-title">
  120. <c:choose>
  121. <c:when test="${sysGoodsWarehousing.id !=null}">
  122. <span class="tbar-label"><span></span>编辑物品入库</span>
  123. </c:when>
  124. <c:otherwise>
  125. <span class="tbar-label"><span></span>添加物品入库</span>
  126. </c:otherwise>
  127. </c:choose>
  128. </div>
  129. <div class="panel-toolbar">
  130. <div class="toolBar">
  131. <div class="group"><a class="link save" id="dataFormSave" href="#"><span></span>入库</a></div>
  132. <div class="l-bar-separator"></div>
  133. <div class="group"><a class="link back" href="list.ht?flag=${sysGoodsWarehousing.flag}"><span></span>返回</a></div>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="panel-body">
  138. <form id="sysGoodsWarehousingForm" method="post" action="save.ht">
  139. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
  140. <tr>
  141. <th width="20%">入库部门: </th>
  142. <td><input type="text" id="department" name="department" value="${sysGoodsWarehousing.department}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
  143. </tr>
  144. <tr>
  145. <th width="20%">入库人员: </th>
  146. <td><input type="text" id="personnel" name="personnel" value="${sysGoodsWarehousing.personnel}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
  147. </tr>
  148. <tr>
  149. <th width="20%">入库时间: </th>
  150. <td><input type="text" id="warehousingtime" name="warehousingtime" value="<fmt:formatDate value='${sysGoodsWarehousing.warehousingtime}' pattern='yyyy-MM-dd HH:mm:ss'/>" class="inputText" style="width:150px" validate="{date:true}" readonly /></td>
  151. </tr>
  152. </table>
  153. <table class="table-grid table-list" cellpadding="1" cellspacing="1" id="sysGoodsWarehousingRela" formtype="form" type="subtable">
  154. <tr>
  155. <td colspan="8">
  156. <div class="group" align="left">
  157. <a id="btnAdd" class="link add">添加</a>
  158. </div>
  159. <div align="center">
  160. 入库物品
  161. </div>
  162. </td>
  163. </tr>
  164. <tr>
  165. <th>物品编号</th>
  166. <th>物品名称</th>
  167. <th>品牌</th>
  168. <th>规格</th>
  169. <th>价格</th>
  170. <th>数量</th>
  171. <th>总价</th>
  172. </tr>
  173. <c:forEach items="${sysGoodsWarehousingRelaList}" var="sysGoodsWarehousingRelaItem" varStatus="status">
  174. <tr type="subdata">
  175. <td style="text-align: center" name="productcode">${sysGoodsWarehousingRelaItem.productcode}</td>
  176. <td style="text-align: center" name="productname">${sysGoodsWarehousingRelaItem.productname}</td>
  177. <td style="text-align: center" name="brand">${sysGoodsApplicationRelaItem.brand}</td>
  178. <td style="text-align: center" name="specification">${sysGoodsWarehousingRelaItem.specification}</td>
  179. <td style="text-align: center" name="price">${sysGoodsWarehousingRelaItem.price}</td>
  180. <td style="text-align: center" name="quantity">${sysGoodsWarehousingRelaItem.quantity}</td>
  181. <td style="text-align: center" name="totalprice">${sysGoodsWarehousingRelaItem.totalprice}</td>
  182. <input type="hidden" name="productid" value="${sysGoodsWarehousingRelaItem.productid}"/>
  183. <input type="hidden" name="productcode" value="${sysGoodsWarehousingRelaItem.productcode}"/>
  184. <input type="hidden" name="productname" value="${sysGoodsWarehousingRelaItem.productname}"/>
  185. <input type="hidden" name="brand" value="${sysGoodsApplicationRelaItem.brand}"/>
  186. <input type="hidden" name="specification" value="${sysGoodsWarehousingRelaItem.specification}"/>
  187. <input type="hidden" name="price" value="${sysGoodsWarehousingRelaItem.price}"/>
  188. <input type="hidden" name="quantity" value="${sysGoodsWarehousingRelaItem.quantity}"/>
  189. <input type="hidden" name="totalprice" value="${sysGoodsWarehousingRelaItem.totalprice}"/>
  190. </tr>
  191. </c:forEach>
  192. <tr type="append">
  193. <td style="text-align: center" name="productcode"></td>
  194. <td style="text-align: center" name="productname"></td>
  195. <td style="text-align: center" name="brand"></td>
  196. <td style="text-align: center" name="specification"></td>
  197. <td style="text-align: center" name="price"></td>
  198. <td style="text-align: center" name="quantity"></td>
  199. <td style="text-align: center" name="totalprice"></td>
  200. <input type="hidden" name="productid" value=""/>
  201. <input type="hidden" name="productcode" value=""/>
  202. <input type="hidden" name="productname" value=""/>
  203. <input type="hidden" name="brand" value=""/>
  204. <input type="hidden" name="specification" value=""/>
  205. <input type="hidden" name="price" value=""/>
  206. <input type="hidden" name="quantity" value=""/>
  207. <input type="hidden" name="totalprice" value=""/>
  208. </tr>
  209. </table>
  210. <input type="hidden" name="id" value="${sysGoodsWarehousing.id}" />
  211. <input type="hidden" name="flag" value="${sysGoodsWarehousing.flag}" />
  212. <input type="hidden" name="saveData" id="saveData" />
  213. <input type="hidden" name="executeType" value="start" />
  214. </form>
  215. </div>
  216. <form id="sysGoodsWarehousingRelaForm" style="display:none" title="入库物品">
  217. <table class="table-detail" id="sysGoodsWarehousingRelaTable" cellpadding="0" cellspacing="0" border="0">
  218. <tr>
  219. <th width="20%">物品编号: <span class="required red">*</span></th>
  220. <td>
  221. <input type="text" name="productcode" value="" class="inputText" validate="{required:true,number:true }"/>
  222. <a class="button" style="display:none" onclick="selectGoods('${sysGoodsWarehousing.flag}');"><span>选择</span></a>
  223. </td>
  224. </tr>
  225. <tr>
  226. <th width="20%">物品名称: <span class="required red">*</span></th>
  227. <td><input type="text" name="productname" value="" class="inputText" validate="{required:true,maxlength:128}"/></td>
  228. </tr>
  229. <tr>
  230. <th width="20%">品牌: <span class="required red">*</span></th>
  231. <td><input type="text" name="brand" value="" class="inputText" validate="{required:true,maxlength:32}"/></td>
  232. </tr>
  233. <tr>
  234. <th width="20%">规格: <span class="required red">*</span></th>
  235. <td><input type="text" name="specification" value="" class="inputText" validate="{required:true}"/></td>
  236. </tr>
  237. <tr>
  238. <th width="20%">价格: <span class="required red">*</span></th>
  239. <td><input type="text" name="price" value="" class="inputText" onchange="calculateP($(this))" validate="{required:true,number:true,maxDecimalLen:2,maxIntLen:18 }"/></td>
  240. </tr>
  241. <tr>
  242. <th width="20%">数量: <span class="required red">*</span></th>
  243. <td><input type="text" name="quantity" value="" class="inputText" onchange="calculateQ($(this))" validate="{required:true,number:true }"/></td>
  244. </tr>
  245. <tr>
  246. <th width="20%">总价: <span class="required red">*</span></th>
  247. <td><input type="text" name="totalprice" value="" class="inputText" validate="{required:true,number:true,maxDecimalLen:2,maxIntLen:18 }" readonly/></td>
  248. </tr>
  249. </table>
  250. <input type="hidden" name="productid" value=""/>
  251. </form>
  252. </div>
  253. </body>
  254. </html>