OrderMg.cshtml 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173
  1. @using System.Web.UI.HtmlControls
  2. @using Abp.Authorization
  3. @using IwbZero.Session
  4. @using ShwasherSys
  5. @using ShwasherSys.Authorization.Permissions
  6. @using ShwasherSys.BasicInfo
  7. @using ShwasherSys.Models.Layout
  8. @using ShwasherSys.Models.Modal
  9. @using ShwasherSys.Views.Shared.New.Table
  10. @{
  11. /**/
  12. ViewBag.ActiveMenu = PermissionNames.PagesOrderInfoOrderMg; //The menu item will be active for this page.
  13. ViewBag.Title = "订单维护";
  14. bool isCanViewPrice = IsGranted(PermissionNames.PagesOrderInfoOrderMgQueryOrderPrice);
  15. List<SelectListItem> OrderStatusList = ViewBag.OrderStatus;
  16. List<SelectListItem> OrderItemStatusList = ViewBag.OrderItemStatus;
  17. List<Currency> loCurrencies = ViewBag.FromCurrenyId;
  18. List<CurrencyExchangeRate> loToCNYCurrenyRate = ViewBag.ToCNYCurreny;
  19. List<SelectListItem> emergencyLevelList = ViewBag.EmergencyLevel;
  20. List<SelectListItem> productionOrderStatus = ViewBag.ProductionOrderStatus;
  21. string strCurrencies = "";
  22. if (loCurrencies != null)
  23. {
  24. foreach (var loCurrency in loCurrencies)
  25. {
  26. if (loCurrency.Id == "CNY")
  27. {
  28. strCurrencies += "<option value=\"" + loCurrency.Id + "\" selected=\"selected\">" + loCurrency.CurrencyName + "</option>";
  29. }
  30. else
  31. {
  32. strCurrencies += "<option value=\"" + loCurrency.Id + "\">" + loCurrency.CurrencyName + "</option>";
  33. }
  34. }
  35. }
  36. List<SelectListItem> OrderSaleTypeList = ViewBag.OrderSaleType;
  37. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  38. {
  39. new SearchItem("id", "流水号"),
  40. new SearchItem("orderDate", "订单日期",FiledType.D,ExpType.Greater),
  41. new SearchItem("orderDate", "到",FiledType.D,ExpType.LessOrEqual),
  42. new SearchItem("customerId", "客户编号").SetSearchIcon("query_customer_modal"),
  43. new SearchItem("stockNo", "客户订单号"),
  44. new SearchItem("orderStatusId", "状态",FiledType.I,ExpType.Equal).SetSearchItem(OrderStatusList),
  45. new SearchItem("saleMan", "业务员",showField:"saleManName").SetSearchIcon("query_employee_modal","SearchForm") ,
  46. }, false);
  47. }
  48. @section css{
  49. <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  50. <link href="~/Views/OrderInfo/css/OrderMg.css" rel="stylesheet" />
  51. <style>
  52. .store-query > strong {
  53. width: 70px;
  54. text-align: right;
  55. }
  56. #storeQuantity, #orderQuantity {
  57. padding: 0 5px;
  58. color: red;
  59. }
  60. .store_box {
  61. position: absolute;
  62. z-index: 10001;
  63. width: 400px;
  64. background: rgba(209,220,249,.9);
  65. display: none;
  66. font-size: 1rem;
  67. padding: 5px;
  68. font-family: "iconfont" !important;
  69. }
  70. .store_box:before {
  71. content: "\e616";
  72. position: absolute;
  73. top: -12px;
  74. left: 3px;
  75. color: rgba(209, 220, 249, .9);
  76. }
  77. .store_box .close {
  78. position: absolute;
  79. width: 20px;
  80. height: 20px;
  81. right: -8px;
  82. top: -8px;
  83. color: #000;
  84. border-radius: 50%;
  85. border: 2px solid #000;
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. }
  90. .tool-rc-group {
  91. border: 0px solid #ba63d3;
  92. float: left;
  93. margin: 0 5px;
  94. padding-right: 5px;
  95. border-radius: 5px;
  96. }
  97. </style>
  98. }
  99. <div class="table-box mr-4 iwb-bootstrap-table">
  100. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  101. <table id="table"
  102. data-url="/api/services/app/OrderHeaders/GetAll"
  103. data-striped="true" data-id-field="id" data-unique-id="id"
  104. data-method="post"
  105. data-side-pagination="server"
  106. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  107. data-cache="false"
  108. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  109. data-query-params="QueryParams"
  110. data-response-handler="ResponseHandler"
  111. data-click-to-select="true"
  112. data-single-select="true"
  113. data-show-jumpto="true">
  114. <thead>
  115. <tr class="row" id="header">
  116. <th data-field="state" data-checkbox="true"></th>
  117. <th data-align="center" data-field="id">流水号</th>
  118. <th data-align="center" data-field="orderStatusName">订单状态</th>
  119. <th data-align="center" data-field="isLock" data-formatter="IsLockFormatter">是否删除</th>
  120. <th data-align="center" data-field="customerId">客户编号</th>
  121. <th data-align="center" data-field="orderDate" data-formatter="DateFormatter">订单日期</th>
  122. <th data-align="center" data-field="linkName">联系人</th>
  123. <th data-align="center" data-field="telephone">电话</th>
  124. <th data-align="center" data-field="saleManName">业务员</th>
  125. <th data-align="center" data-field="saleTypeName">外销/内销</th>
  126. @*<th data-align="center" data-formatter="ActionsFormatter"></th>*@
  127. </tr>
  128. </thead>
  129. </table>
  130. </div>
  131. <div class="table-box mr-4 iwb-bootstrap-table" id="orderItemInfo" style="display: none;">
  132. <div class="btn-toolbar row" role="toolbar" aria-label="Toolbar with button groups">
  133. <div class="col-sm-12 col-lg-12 pull-left" style="padding: 0">
  134. <div class="btn-group btn-group-sm" id="Tool1" role="group" aria-label="First group">
  135. @if (PermissionChecker.IsGranted(PermissionNames.PagesOrderInfoOrderMgCreateOrderItem))
  136. {
  137. <button type="button" class="btn btn-default btnOrderTool" data-type="_btnCreate" data-url="/api/services/app/OrderItems/Create" onclick="CreateItem()">
  138. <i class="iconfont icon-add">添加订单明细</i>
  139. </button>
  140. }
  141. @if (PermissionChecker.IsGranted(PermissionNames.PagesOrderInfoOrderMgUpdateOrderItem))
  142. {
  143. <button type="button" class="btn btn-default btnOrderTool" data-type="btnUpdate" data-url="/api/services/app/OrderItems/Update" onclick="UpdateItem()">
  144. <i class="iconfont icon-edit">修改订单明细</i>
  145. </button>
  146. }
  147. @if (PermissionChecker.IsGranted(PermissionNames.PagesOrderInfoOrderMgDeleteOrderItem))
  148. {
  149. <button type="button" class="btn btn-default btnOrderTool" data-type="btnDelete" data-url="/api/services/app/OrderItems/Delete" onclick="DeleteItem()">
  150. <i class="iconfont icon-delete">删除订单明细</i>
  151. </button>
  152. }
  153. </div>
  154. </div>
  155. </div>
  156. <table id="tableOrderItem"
  157. data-url="/api/services/app/OrderItems/GetAll"
  158. data-id-field="id" data-unique-id="id"
  159. data-striped="true" data-click-to-select="true" data-single-select="true"
  160. data-method="post" data-side-pagination="server" data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  161. data-cache="false" data-pagination="true" data-page-size="10" data-page-number="1" data-page-list="[10,30,50,100]"
  162. data-pagination-h-align="left" data-pagination-detail-h-align="right"
  163. data-query-params="QueryItemParams" data-response-handler="ResponseHandler" data-show-jumpto="true">
  164. <thead>
  165. <tr class="row">
  166. <th data-field="state" data-checkbox="true"></th>
  167. <th data-align="center" data-field="id">明细流水号</th>
  168. <th data-align="center" data-field="productNo">产品编号</th>
  169. <th data-align="center" data-field="emergencyLevel" data-formatter="EmergencyLevelFormatter">紧急程度</th>
  170. <th data-align="center" data-field="isLock" data-formatter="IsLockFormatter">是否删除</th>
  171. <th data-align="center" data-field="quantity">数量</th>
  172. @if (isCanViewPrice)
  173. {
  174. <th data-align="center" data-field="price">含税价格</th>
  175. <th data-align="center" data-field="afterTaxPrice">不含税价格</th>
  176. <th data-align="center" data-field="currencyId">货币</th>
  177. <th data-align="center" data-field="logisticsFee">运费</th>
  178. <th data-align="center" data-field="moldFee">模具费</th>
  179. @*<th data-align="center" data-field="currencyPrice">货币价格(含税)</th>*@
  180. }
  181. <th data-align="center" data-field="sendDate" data-formatter="DateFormatter">送货时间</th>
  182. </tr>
  183. </thead>
  184. </table>
  185. </div>
  186. @section modal{
  187. <section>
  188. <!--Main Modal-->
  189. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  190. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  191. <div class="modal-content">
  192. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("订单"))
  193. @{
  194. var inputs = new List<InputViewModel>
  195. {
  196. new InputViewModel("customerId",hide:true),
  197. new InputViewModel("saleMan",hide:true),
  198. new InputViewModel("saleManId",hide:true),
  199. new InputViewModel("id",displayName:"流水号"),
  200. new InputViewModel("stockNo",displayName:"客户订单号"),
  201. new InputViewModel("orderStatusId",InputTypes.List, displayName:"订单状态").SetSelectOptions(OrderStatusList),
  202. new InputViewModel("orderDate", displayName:"订单日期").SetNotRequired(),
  203. new InputViewModel("customerName",displayName:"客户名称").SetSearchIcon("query_customer_modal","modal"),
  204. new InputViewModel("saleType",InputTypes.List, displayName: "外销/内销").SetSelectOptions(OrderSaleTypeList),
  205. new InputViewModel("customerSendId",InputTypes.List, displayName: "送货地址名称").SetEvents("onchange=ChangeCustomerSend()"),
  206. new InputViewModel("linkName", displayName: "联系人"),
  207. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  208. new InputViewModel("telephone", displayName: "电话").SetNotRequired(),
  209. new InputViewModel("sendAdress",displayName:"送货地址"),
  210. new InputViewModel("saleManName",displayName:"销售人员").SetSearchIcon("query_employee_modal")
  211. };
  212. //var specials = new List<SpecialInputModel>();
  213. }
  214. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  215. @Html.Partial("Modals/_ModalFooter", "0")
  216. </div>
  217. </div>
  218. </div>
  219. </section>
  220. <section>
  221. @*@Html.Hidden("isForSearch", "0");*@
  222. @Html.Partial("Modals/Query/_Customer", "customerId|KeyWords-4")
  223. @Html.Partial("Modals/Query/_Employee", "saleMan|KeyWords-7,saleManName|KeyWords-saleManName-7,saleManId")
  224. </section>
  225. <section>
  226. <!--Main Modal-->
  227. <div class="modal fade" id="modal_OrderItemEdit" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  228. <div class="modal-dialog modal-dialog-centered" role="document">
  229. <div class="modal-content" style="width: 680px;">
  230. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("订单明细"))
  231. <div class="modal-body container-fluid" style="padding: 0; padding-top: 15px;">
  232. <form class="pr-3 pl-3 form-horizontal" style="padding: 0 10px" id="formItem">
  233. <input type="hidden" name="id" />
  234. <input type="hidden" id="orderNo" name="orderNo" />
  235. <input type="hidden" id="orderItemStatusId" name="orderItemStatusId" />
  236. <input type="hidden" id="orderUnitId" name="orderUnitId" />
  237. <div class="form-group-sm row">
  238. <label class="iwb-label col-md-2 control-label iwb-label-required" for="productNo">产品编号</label>
  239. <div class="col-md-5">
  240. <div class="input-group">
  241. <select class="form-control" Required id="productNo" name="productNo" placeholder="请输入..." value="" style="width: 100%;" type="text" onchange="RefreshProductInfo()">
  242. @*@Html.Raw(ViewBag.CustomerDefaultProducts)*@
  243. </select>
  244. <div class="input-group-addon" onclick="ShowModal('query_Product_modal');">
  245. <i class="iconfont icon-search"></i>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="col-md-1" style="padding: 0 0">
  250. <button type="button" class="btn btn-info btn-flat" style="height: 30px; width: 40px;" onclick="showSelectProductDialog()"><i class="iconfont icon-search"></i></button>
  251. </div>
  252. <div class="col-md-4" style="padding: 0 5px;margin-top: -6px;">
  253. <span class="store-query"> <strong>库存量:</strong><span id="storeQuantity">0</span><span>千件</span></span>
  254. <br>
  255. <span class="store-query"><strong>被定量:</strong><span id="orderQuantity">0</span><span>千件</span></span>
  256. <br>
  257. </div>
  258. </div>
  259. <div class="form-group-sm row">
  260. <label class="iwb-label col-md-2 control-label" for="sendDate">送货时间</label>
  261. <div class="col-md-4">
  262. <input class="form-control" id="sendDate" name="sendDate" placeholder="请输入..." value="" style="" type="text">
  263. </div>
  264. <label class="iwb-label col-md-2 control-label" for="IsStandard">标准件</label>
  265. <div class="col-md-4">
  266. <input class="form-control" style="width: 100%" id="IsStandard" disabled="disabled" name="IsStandard" placeholder="请输入..." value="" type="text">
  267. </div>
  268. </div>
  269. <div class="form-group-sm row">
  270. <label class="iwb-label col-md-2 control-label iwb-label-required" for="price">货币类型</label>
  271. <div class="col-md-4">
  272. <select class="form-control" style="width: 100%" id="currencyId" name="currencyId" placeholder="请输入..." value="" onchange="RefreshCurrency()" type="text">
  273. @Html.Raw(@strCurrencies);
  274. </select>
  275. </div>
  276. <label class="iwb-label col-md-2 control-label iwb-label-required" for="toCnyRate">当前汇率</label>
  277. <div class="col-md-4">
  278. <input class="form-control required number" Required style="width: 100%" id="toCnyRate" name="toCnyRate" placeholder="请输入..." min="0" value="" type="text">
  279. </div>
  280. </div>
  281. <div class="form-group-sm row">
  282. <label class="iwb-label col-md-2 control-label iwb-label-required" for="price">含税价格</label>
  283. <div class="col-md-4">
  284. <input class="form-control required number" Required style="width: 100%" id="price" name="price" placeholder="请输入..." value="" min="0" type="text">
  285. </div>
  286. <label class="iwb-label col-md-2 control-label iwb-label-required" for="quantity">数量</label>
  287. <div class="col-md-4">
  288. <input class="form-control required number" Required style="width: 100%" id="quantity" name="quantity" placeholder="请输入..." min="0" value="" type="text">
  289. </div>
  290. </div>
  291. <div class="form-group-sm row" id="noTaxDiv">
  292. <label class="iwb-label col-md-2 control-label iwb-label-required" for="price">不含税价格</label>
  293. <div class="col-md-4">
  294. <input class="form-control required number" Required style="width: 100%" id="afterTaxPrice" name="afterTaxPrice" placeholder="请输入..." value="" min="0" type="text">
  295. </div>
  296. <div class="col-md-4" style="padding: 6px 25px;">
  297. <span class="store-query"> <strong>当前税率:</strong><span id="currentTaxRate">@ViewBag.TagRate</span><span>%</span></span>
  298. <br>
  299. </div>
  300. </div>
  301. <div class="form-group-sm row">
  302. <label class="iwb-label col-md-2 control-label" for="logisticsFee">运费(含税)</label>
  303. <div class="col-md-4">
  304. <input class="form-control number" id="logisticsFee" name="logisticsFee" placeholder="请输入..." value="0" min="0" style="" type="number">
  305. </div>
  306. <label class="iwb-label col-md-2 control-label " for="moldFee">模具费(含税)</label>
  307. <div class="col-md-4">
  308. <input class="form-control number" id="moldFee" name="moldFee" placeholder="请输入..." value="0" style="" min="0" type="number">
  309. </div>
  310. </div>
  311. <div class="form-group-sm row">
  312. <label class="iwb-label col-md-2 control-label" for="logisticsFee">运费(不含税)</label>
  313. <div class="col-md-4">
  314. <input class="form-control number" id="logisticsFeeAfterTax" name="logisticsFeeAfterTax" placeholder="请输入..." value="0" min="0" style="" type="number">
  315. </div>
  316. <label class="iwb-label col-md-2 control-label " for="moldFee">模具费(不含税)</label>
  317. <div class="col-md-4">
  318. <input class="form-control number" id="moldFeeAfterTax" name="moldFeeAfterTax" placeholder="请输入..." value="0" style="" min="0" type="number">
  319. </div>
  320. </div>
  321. <div class="form-group-sm row">
  322. <label class="iwb-label col-md-2 control-label" for="isReport">检验报告</label>
  323. <div class="col-md-4">
  324. <select class="form-control" style="width: 100%" id="isReport" name="isReport" placeholder="请输入..." value="" style="" type="text">
  325. <option value="Y" selected="selected">是</option>
  326. <option value="N">否</option>
  327. </select>
  328. </div>
  329. <label class="iwb-label col-md-2 control-label" for="isPartSend">部分送货</label>
  330. <div class="col-md-4">
  331. <select class="form-control" style="width: 100%" id="isPartSend" name="isPartSend" placeholder="请输入..." value="" style="" type="text">
  332. <option value="Y" selected="selected">是</option>
  333. <option value="N">否</option>
  334. </select>
  335. </div>
  336. </div>
  337. <div class="form-group-sm row">
  338. <label class="iwb-label col-md-2 control-label" for="Material">材质</label>
  339. <div class="col-md-4">
  340. <input class="form-control" id="Material" name="Material" placeholder="请输入..." value="" style="" type="text">
  341. </div>
  342. <label class="iwb-label col-md-2 control-label" for="Model">规格</label>
  343. <div class="col-md-4">
  344. <input class="form-control" id="Model" name="Model" placeholder="请输入..." value="" style="" type="text">
  345. </div>
  346. </div>
  347. <div class="form-group-sm row">
  348. <label class="iwb-label col-md-2 control-label" for="SurfaceColor">表色</label>
  349. <div class="col-md-4">
  350. <input class="form-control" id="SurfaceColor" name="surfaceColor" placeholder="请输入..." value="" style="" type="text">
  351. </div>
  352. <label class="iwb-label col-md-2 control-label" for="Rigidity">硬度</label>
  353. <div class="col-md-4">
  354. <input class="form-control" id="Rigidity" name="Rigidity" placeholder="请输入..." value="" style="" type="text">
  355. </div>
  356. </div>
  357. <div class="form-group-sm row">
  358. <label class="iwb-label col-md-2 control-label" for="ProductName">产品名称</label>
  359. <div class="col-md-4">
  360. <input class="form-control" id="ProductName" name="ProductName" placeholder="请输入..." value="" style="" type="text">
  361. </div>
  362. <label class="iwb-label col-md-2 control-label" for="partNo">零件号</label>
  363. <div class="col-md-4">
  364. <div class="input-group">
  365. <input class="form-control" id="partNo" name="partNo" placeholder="请输入..." value="" style="" type="text">
  366. <div class="input-group-addon" onclick="f_QueryProductByPartNo();" title="通过零件号查询对应的产品">
  367. <i class="iconfont icon-search"></i>
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. <div class="form-group-sm row">
  373. <label class="iwb-label col-md-2 control-label" for="wareHouse">送货仓库</label>
  374. <div class="col-md-4">
  375. <input class="form-control" id="wareHouse" name="wareHouse" placeholder="请输入..." value="" style="" type="text">
  376. </div>
  377. <label class="iwb-label col-md-2 control-label iwb-label-required" for="emergencyLevel">紧急程度</label>
  378. <div class="col-md-4">
  379. @*<input class="form-control" id="emergencyLevel" name="emergencyLevel" placeholder="请输入..." value="" style="" type="text">*@
  380. @Html.DropDownList("emergencyLevel", emergencyLevelList, htmlAttributes: new { @class = "form-control Required", placeholder = "请选择", style = "width: 100%" })
  381. </div>
  382. </div>
  383. <div class="form-group-sm row">
  384. <label class="iwb-label col-md-2 control-label" for="wareHouse">客户标准名称</label>
  385. <div class="col-md-4">
  386. <input class="form-control" id="standardName" name="standardName" placeholder="请输入..." value="" style="" type="text">
  387. </div>
  388. <label class="iwb-label col-md-2 control-label " for="orderItemDesc">描述</label>
  389. <div class="col-md-4">
  390. <input class="form-control" id="orderItemDesc" name="orderItemDesc" placeholder="请输入..." value="" style="" type="text">
  391. </div>
  392. </div>
  393. @*<div class="form-group-sm row">
  394. <label class="iwb-label col-md-2 control-label " for="orderItemDesc">描述</label>
  395. <div class="col-md-10">
  396. <textarea class="form-control" id="orderItemDesc" name="orderItemDesc" placeholder="请输入..." value="" style=""></textarea>
  397. </div>
  398. </div>*@
  399. </form>
  400. </div>
  401. @Html.Partial("Modals/_ModalFooter", "0")
  402. </div>
  403. </div>
  404. </div>
  405. @Html.Partial("Modals/Query/_Product01", "productNo")
  406. @Html.Partial("_searchInfoByProductNo")
  407. </section>
  408. <div class="store_box">
  409. <div class="close" onclick="f_closeStore_box(this)"><i class="iconfont icon-close"></i></div>
  410. <table class="table table-striped">
  411. <tbody>
  412. <tr>
  413. <th style="width: 150px">批次号</th>
  414. <th style="width: 150px">库位</th>
  415. <th style="width: 150px">库存(千件)</th>
  416. <th style="width: 150px">可用数量(千件)</th>
  417. </tr>
  418. </tbody>
  419. </table>
  420. </div>
  421. }
  422. @section scripts
  423. {
  424. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  425. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  426. @*<script src="~/Views/OrderInfo/js/OrderMg.js"></script>*@
  427. <script type="text/javascript">
  428. //cId cStockNo cOrderStatusId cCustomerId cStartDate cEndDate
  429. var loToCNYCurrenyRate = [];
  430. var datePickerOpt = {
  431. language: 'zh-CN',
  432. format: "yyyy-mm-dd",
  433. todayBtn: true,
  434. autoclose: true,
  435. startView: 2,
  436. minView: 2,
  437. maxView: 4
  438. //showSecond: true,
  439. //showHours: true,
  440. //minuteStep: 10
  441. };
  442. var itemTable = $("#tableOrderItem");
  443. $(function() {
  444. @{
  445. // List<CurrencyExchangeRate> loToCNYCurrenyRate
  446. foreach (var currency in loToCNYCurrenyRate ?? new List<CurrencyExchangeRate>())
  447. {
  448. <text>
  449. loToCNYCurrenyRate.push({
  450. FromCurrencyId: "@currency.FromCurrencyId",
  451. ExchangeRate: "@currency.ExchangeRate"
  452. });
  453. </text>
  454. }
  455. }
  456. //show完毕前执行
  457. //$("#orderDate").datetimepicker(datePickerOpt).on('show', function (event) {
  458. // event.preventDefault();
  459. // event.stopPropagation();
  460. //}).on('hide',
  461. // function (event) {
  462. // event.preventDefault();
  463. // event.stopPropagation();
  464. // });
  465. $("#sendDate").datetimepicker(datePickerOpt).on('show',
  466. function(event) {
  467. event.preventDefault();
  468. event.stopPropagation();
  469. }).on('hide',
  470. function(event) {
  471. event.preventDefault();
  472. event.stopPropagation();
  473. });
  474. $("#KeyWords-2").datetimepicker(datePickerOpt);
  475. $("#KeyWords-3").datetimepicker(datePickerOpt);
  476. LoadTable({
  477. onCheck: ShowOrderItem,
  478. onUncheck: UnShowOrderItem,
  479. onLoadSuccess: OnLoadSuccessOrder,
  480. });
  481. //LoadQueryCustomerTable();
  482. var funs = window.funs || { none: function() { console.log("No type"); } };
  483. funs["btnUpdate"] = function() {
  484. BtnUpdate({ readonly: "standardName,saleManName", disabled: "saleType" });
  485. };
  486. funs["btnCreate"] = function() {
  487. abp.ajax({
  488. url: window.appUrl + 'OrderHeaders/GetNewOrderNo',
  489. async: true,
  490. type: "Post",
  491. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  492. isValidate: false,
  493. dataType: "json",
  494. success: function(res) {
  495. BtnCreate({
  496. readonly: "id,sendAdress,customerName,saleManName,orderDate ",
  497. disabled: "orderStatusId,saleType",
  498. data: { orderStatusId: "2", id: res, orderDate: GetNowFormatDate() }
  499. });
  500. //$("#OrderStatusId").val("2").select2();
  501. }
  502. });
  503. }
  504. funs["btnDelete"] = function(url) {
  505. var rows = $("#table").bootstrapTable("getSelections");
  506. if (rows.length === 1) {
  507. //if (rows[0].orderStatusId === 2) {
  508. // abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"),
  509. // abp.localization.localize("DeleteConfirmTitle"),
  510. // function() {
  511. // SaveAjax({ url: url, data: { Id: rows[0].id }, isValidate: false, table: $("#table") });
  512. // });
  513. //} else {
  514. // abp.message.warn("非新建的订单不可删除!");
  515. //}
  516. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"),
  517. abp.localization.localize("DeleteConfirmTitle"),
  518. function() {
  519. SaveAjax({ url: url, data: { Id: rows[0].id }, isValidate: false, table: $("#table") });
  520. });
  521. } else
  522. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  523. }
  524. funs["btnShow"] = function(url) {
  525. BtnShow(url);
  526. }
  527. //$("#currencyPrice").off("blur").on("blur",
  528. // function() {
  529. // RefreshCurrency();
  530. // });
  531. $("#price").off("blur").on("blur",
  532. function() {
  533. //var p = $(this).val();
  534. //var rate = $("#currentTaxRate").text();
  535. //SaveAjax({
  536. // url: window.appUrl + `Query/CalcTaxPrice?type=${1}&input=${p}&rate=${rate}`,
  537. // isValidate: false,
  538. // isAlert: false,
  539. // async: false,
  540. // success: function(res) {
  541. // $("#afterTaxPrice").val(res);
  542. // }
  543. //});
  544. tranTax(1, $("#price"), $("#afterTaxPrice"));
  545. });
  546. $("#afterTaxPrice").off("blur").on("blur",
  547. function() {
  548. //var p = $(this).val();
  549. //var rate = $("#currentTaxRate").text();
  550. ////var r = (Number(p) * (1 + Number(rate) / 100)).toFixed(3);
  551. ////$("#price").val(r);
  552. //SaveAjax({
  553. // url: window.appUrl + `Query/CalcTaxPrice?type=${2}&input=${p}&rate=${rate}`,
  554. // isValidate: false,
  555. // isAlert: false,
  556. // async: false,
  557. // success: function(res) {
  558. // $("#price").val(res);
  559. // }
  560. //});
  561. tranTax(2, $("#afterTaxPrice"), $("#price"));
  562. });
  563. $("#logisticsFee").off("blur").on("blur",
  564. function() {
  565. tranTax(1, $("#logisticsFee"), $("#logisticsFeeAfterTax"));
  566. });
  567. $("#logisticsFeeAfterTax").off("blur").on("blur",
  568. function () {
  569. tranTax(2, $("#logisticsFeeAfterTax"), $("#logisticsFee"));
  570. });
  571. $("#moldFee").off("blur").on("blur",
  572. function () {
  573. tranTax(1, $("#moldFee"), $("#moldFeeAfterTax"));
  574. });
  575. $("#moldFeeAfterTax").off("blur").on("blur",
  576. function () {
  577. tranTax(2, $("#moldFeeAfterTax"), $("#moldFee"));
  578. });
  579. });
  580. function tranTax(type,sourceDom,targetDom) {
  581. var p = $(sourceDom).val();
  582. var rate = $("#currentTaxRate").text();
  583. if (p && rate) {
  584. SaveAjax({
  585. url: window.appUrl + `Query/CalcTaxPrice?type=${type}&input=${p}&rate=${rate}`,
  586. isValidate: false,
  587. isAlert: false,
  588. async: false,
  589. success: function(res) {
  590. $(targetDom).val(res);
  591. }
  592. });
  593. } else {
  594. abp.message.warn('价格不能为空!');
  595. }
  596. }
  597. function RefreshCurrency() {
  598. var currency = $("#currencyId").val();
  599. if (!currency) {
  600. return;
  601. }
  602. loToCNYCurrenyRate.forEach(function(v, i) {
  603. if (currency === v.FromCurrencyId) {
  604. //var p = $("#currencyPrice").val();
  605. var rate = v.ExchangeRate;
  606. //var r = Number(p) * Number(rate);
  607. $("#toCnyRate").val(rate);
  608. }
  609. if (currency !== "CNY") {
  610. $("#noTaxDiv").hide();
  611. } else {
  612. $("#noTaxDiv").show();
  613. }
  614. });
  615. }
  616. function BtnShow(url) {
  617. var rows = config.table.bootstrapTable("getSelections");
  618. if (rows.length === 1) {
  619. window.open("@Url.Action("OrderDetail")/" + rows[0].id, "_blank");
  620. } else
  621. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  622. }
  623. function ActionsFormatter(v, r) {
  624. var str = '<span class="table-action" onclick="OrderItemDetail(\'' +
  625. r.id +
  626. '\')"><i class="iconfont icon-right"></i>订单明细</span>';
  627. return str;
  628. }
  629. function OrderItemDetail(id) {
  630. window.location.href = "OrderItemDetail/" + id;
  631. }
  632. function Submit_query_customer_modal(row) {
  633. var $modal = $("#query_customer_modal");
  634. row = row || $modal.find("table").bootstrapTable("getSelections")[0];
  635. if (targetDom !== "#modal") {
  636. $("#KeyWords-4").val(row.id);
  637. $modal.modal("hide");
  638. return;
  639. }
  640. if (row) {
  641. $("#customerId").val(row.id);
  642. $("#customerName").val(row.customerName);
  643. abp.ajax({
  644. url: window.appUrl + "CustomerSends/GetCustomerSendDtoByCustomerId",
  645. async: true,
  646. type: "Post",
  647. data: { customerId: row.id },
  648. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  649. isValidate: false,
  650. dataType: "json",
  651. success: function(res) {
  652. if (res && res.length > 0) {
  653. $("#customerSendId").empty();
  654. var options = "";
  655. $("#saleType").val(row.saleType).select2();
  656. res.forEach(function(value, index) {
  657. console.log(value, index);
  658. if (index === 0) {
  659. options += '<option value=\"' +
  660. value.id +
  661. '\" selected=\"selected\">' +
  662. value.customerSendName +
  663. '</option>';
  664. } else {
  665. options += '<option value=\"' +
  666. value.id +
  667. '\">' +
  668. value.customerSendName +
  669. '</option>';
  670. }
  671. });
  672. $("#customerSendId").html(options);
  673. $("#customerSendId").trigger("change");
  674. }
  675. }
  676. });
  677. $modal.modal("hide");
  678. } else
  679. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  680. }
  681. function ChangeCustomerSend() {
  682. var customerSendId = $("#customerSendId").val();
  683. if (!customerSendId) {
  684. customerSendId = 0;
  685. }
  686. abp.ajax({
  687. url: window.appUrl + "Query/GetCustomerSendInfo",
  688. async: false,
  689. type: "Post",
  690. data: { Id: customerSendId },
  691. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  692. isValidate: false,
  693. dataType: "json",
  694. success: function(res) {
  695. if (res) {
  696. $("#linkName").val(res.linkMan);
  697. $("#fax").val(res.fax);
  698. $("#telephone").val(res.telephone);
  699. $("#sendAdress").val(res.sendAdress);
  700. }
  701. }
  702. });
  703. }
  704. function OnAllItem(eName, eData, table) {
  705. //console.log(eName, eData);
  706. var $table = config.table;
  707. if (table) {
  708. if (typeof (table) === "string") {
  709. $table = $("#" + table);
  710. } else {
  711. $table = $(table);
  712. }
  713. }
  714. $table.closest(".table-box").find("#Tool1 .btn[data-type^='btn']")
  715. .prop('disabled', $table.bootstrapTable('getSelections').length !== 1);
  716. }
  717. function OnLoadSuccessOrder(data, table) {
  718. var $table = config.table;
  719. if (table) {
  720. if (typeof (table) === "string") {
  721. $table = $("#" + table);
  722. } else {
  723. $table = $(table);
  724. }
  725. }
  726. $table.find(".bs-checkbox").find("input").addClass("filled-in").after("<label></label");
  727. _isSearching = false;
  728. abp.ui.clearBusy();
  729. setTimeout(function() {
  730. var alldata = $("#table").bootstrapTable('getData');
  731. if (alldata.length > 0) {
  732. $("#table").bootstrapTable('check', 0);
  733. } else {
  734. $("#orderItemInfo").css("display", "none");
  735. }
  736. },
  737. 500);
  738. }
  739. var checkedOrderNo = "";
  740. var orderSaleType = 1;
  741. function ShowOrderItem(row, $element) {
  742. $("#table").bootstrapTable('resetView', { height: 500 });
  743. $("#orderItemInfo").css("display", "block");
  744. checkedOrderNo = row.id;
  745. orderSaleType = row.saleType;
  746. itemTable.bootstrapTable("destroy");
  747. LoadTable({
  748. table: itemTable,
  749. queryParams: QueryItemParams,
  750. onAll: function(eName, eData) {
  751. OnAllItem(eName, eData, "tableOrderItem");
  752. },
  753. onLoadSuccess: function(data) {
  754. OnLoadSuccess(data, "tableOrderItem");
  755. },
  756. onPostBody: function(data) {
  757. OnPostBody(data, "tableOrderItem");
  758. }
  759. });
  760. /*if (row.orderStatusId !== 2) {
  761. $("#orderItemInfo .btnOrderTool").prop('disabled', true);
  762. } else {
  763. $("#orderItemInfo .btnOrderTool").prop('disabled', false);
  764. }*/
  765. itemTable.bootstrapTable('resetView');
  766. if (orderSaleType === 2) {
  767. itemTable.bootstrapTable('hideColumn', "afterTaxPrice");
  768. }
  769. initCurrentProduct();
  770. }
  771. function UnShowOrderItem(row, $element) {
  772. $("#orderItemInfo").css("display", "none");
  773. itemTable.bootstrapTable("destroy");
  774. $("#table").bootstrapTable('resetView', { height: 800 });
  775. }
  776. function QueryItemParams(params) {
  777. return {
  778. MaxResultCount: params.limit,
  779. SkipCount: params.offset,
  780. sort: params.sort,
  781. sortOrder: params.order,
  782. SearchList: [{ KeyWords: checkedOrderNo, KeyField: "OrderNo", FieldType: "0", ExpType: "0" }]
  783. };
  784. }
  785. function Submit_query_Product_modal(row) {
  786. row = row || $("#query_Product_modal").find("table").bootstrapTable("getSelections")[0];
  787. if (row) {
  788. var productNo = row.id;
  789. //RefreshProductInfo(productNo);
  790. $("#productNo").append('<option value=\"' + productNo + '\">' + productNo + '</option>');
  791. $("#productNo").val(productNo);
  792. $("#productNo").trigger("change");
  793. $("#query_Product_modal").modal("hide");
  794. } else {
  795. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  796. }
  797. }
  798. function RefreshProductInfo() {
  799. var productNo = $("#productNo").val();
  800. if (!productNo) {
  801. return;
  802. }
  803. //abp.ajax({
  804. // url: window.appUrl + 'Query/GetProductById',
  805. // data: { Id: productNo },
  806. // async: true,
  807. // type: "Post",
  808. // contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  809. // isValidate: false,
  810. // dataType: "json",
  811. // success: function (res) {
  812. // if (res) {
  813. // $("#ProductName").val(res.productName);
  814. // $("#Model").val(res.model);
  815. // $("#Material").val(res.material);
  816. // $("#SurfaceColor").val(res.surfaceColor);
  817. // $("#Rigidity").val(res.rigidity);
  818. // $("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  819. // }
  820. // }
  821. //});
  822. SaveAjax({
  823. url: window.appUrl + 'Common/GetNewProductInfo?productNo=' + productNo,
  824. isValidate: false,
  825. isAlert: false,
  826. async: false,
  827. success: function(res) {
  828. if (res) {
  829. let pNo = res.id;
  830. let reg = new RegExp(/^s.{13}/g);
  831. if (productNo !== pNo && reg.test(pNo)) {
  832. $("#productNo").append('<option value=\"' + pNo + '\">' + pNo + '</option>');
  833. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  834. }
  835. $("#productNo").val(pNo);
  836. $('#select2-productNo-container').prop('title', pNo);
  837. $('#select2-productNo-container').html(pNo);
  838. $("#ProductName").val(res.productName);
  839. $("#Model").val(res.model);
  840. $("#Material").val(res.material);
  841. $("#SurfaceColor").val(res.surfaceColor);
  842. $("#Rigidity").val(res.rigidity);
  843. $("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  844. RefreshDefaultPartNo(res.partNo);
  845. }
  846. }
  847. });
  848. RefreshCurrentStore();
  849. // RefreshDefaultPartNo();
  850. }
  851. function RefreshDefaultPartNo(partNo) {
  852. var productNo = $("#productNo").val();
  853. $("#partNo").val(partNo);
  854. SaveAjax({
  855. url: window.appUrl +
  856. "OrderItems/GetDefaultPartNoByOrderNo?orderNo=" +
  857. checkedOrderNo +
  858. "&productNo=" +
  859. productNo,
  860. isValidate: false,
  861. isAlert: false,
  862. dataType: "json",
  863. success: function(res) {
  864. //console.log(res);
  865. if (res && res.partNo) {
  866. $("#partNo").val(res.partNo);
  867. }
  868. }
  869. });
  870. }
  871. function RefreshCurrentStore() {
  872. var productNo = $("#productNo").val();
  873. if (!productNo) {
  874. return;
  875. }
  876. SaveAjax({
  877. url: window.appUrl + "OrderItems/QueryCurrentProductNum",
  878. data: { Id: productNo },
  879. isAlert: false,
  880. isValidate: false,
  881. success: function(res) {
  882. if (res) {
  883. $("#storeQuantity").text(res.canUserQuantity ? Number(res.canUserQuantity) : 0);
  884. $("#orderQuantity").text(res.bookedQuantity ? Number(res.bookedQuantity) : 0);
  885. }
  886. }
  887. });
  888. }
  889. function initCurrentProduct() {
  890. SaveAjax({
  891. url: window.appUrl + "Query/GetDefualtProductByOrderNo?orderNo=" + checkedOrderNo,
  892. isValidate: false,
  893. isAlert: false,
  894. dataType: "json",
  895. success: function(res) {
  896. //console.log(res);
  897. if (res) {
  898. $("#productNo").html(res);
  899. }
  900. }
  901. });
  902. }
  903. function f_QueryProductByPartNo() {
  904. let partNo = $("#partNo").val();
  905. if (partNo) {
  906. SaveAjax({
  907. url: window.appUrl + `Query/GetDefaultProductByPartNo?partNo=${partNo}&orderNo=${checkedOrderNo}`,
  908. isValidate: false,
  909. isAlert: false,
  910. dataType: "json",
  911. success: function(res) {
  912. //console.log(res);
  913. if (res) {
  914. $("#productNo").val(res).select2();
  915. RefreshProductInfo();
  916. }
  917. }
  918. });
  919. }
  920. }
  921. function CreateItem() {
  922. var firstProductNo = $("#productNo").find("option").first().attr("value");
  923. //console.log('firstProductNo' + firstProductNo);
  924. var currencyId = "CNY";
  925. if (orderSaleType === 2) {
  926. currencyId = "USD";
  927. }
  928. BtnCreate({
  929. modal: $("#modal_OrderItemEdit"),
  930. url: "/api/services/app/OrderItems/Create",
  931. readonly: "IsStandard,ProductName,SurfaceColor,Rigidity,Material,Model",
  932. data: {
  933. orderNo: checkedOrderNo,
  934. productNo: firstProductNo,
  935. orderUnitId: "4",
  936. currencyId: currencyId,
  937. emergencyLevel: '@OrderItemEmergencyLevel.Normal',
  938. logisticsFee: "0",
  939. moldFee: "0",
  940. logisticsFeeAfterTax: "0",
  941. moldFeeAfterTax: "0"
  942. },
  943. disabled: "",
  944. table: itemTable
  945. });
  946. $("#isReport").val("Y").select2();
  947. $("#isPartSend").val("Y").select2();
  948. }
  949. function UpdateItem() {
  950. var rows = itemTable.bootstrapTable("getSelections");
  951. console.error('---------------------------------------');
  952. if (rows.length === 1) {
  953. console.table(rows[0]);
  954. var defaultOption = {
  955. modal: $("#modal_OrderItemEdit"),
  956. modalContent: "",
  957. modaltitle: window.opUpdate,
  958. data: rows[0],
  959. savebtn: null,
  960. form: null,
  961. disabled:
  962. "IsStandard,ProductName,SurfaceColor,Rigidity,Material,Model,SendDate,currencyId,toCnyRate,price,afterTaxPrice,quantity",
  963. url: "/api/services/app/OrderItems/Update",
  964. select2: true,
  965. select2tree: false,
  966. save: null,
  967. table: itemTable
  968. };
  969. OpenModal(defaultOption);
  970. $("#productNo").trigger("change");
  971. } else {
  972. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  973. }
  974. }
  975. function DeleteItem() {
  976. var rows = itemTable.bootstrapTable("getSelections");
  977. if (rows.length === 1) {
  978. abp.message.confirm(abp.localization.localize("DeleteConfirmMsg"),
  979. abp.localization.localize("DeleteConfirmTitle"),
  980. function() {
  981. /*SaveAjax({ url: "/api/services/app/OrderItems/Delete", data: { Id: rows[0].id }, isValidate: false});*/
  982. abp.services.app.orderItems.delete({ Id: rows[0].id },
  983. {
  984. async: false,
  985. timeout: 30000
  986. }).done(function() {
  987. RefreshTable("tableOrderItem");
  988. });
  989. });
  990. } else
  991. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  992. }
  993. function DateFormatter(v, r) {
  994. var sendDate = new Date(v);
  995. return '<span style="text-decoration:underline;" >' + sendDate.Format('yyyy-MM-dd') + '</span>';
  996. }
  997. function EmergencyLevelFormatter(v, r) {
  998. var name = $('#hid-emergencyLevel option[value="' + v + '"]').text();
  999. if (v === '1') {
  1000. return '<span class="label label-success">' + name + '</span>';
  1001. } else {
  1002. return '<span class="label label-danger">' + name + '</span>';
  1003. }
  1004. }
  1005. function IsLockFormatter(v, r) {
  1006. if (v === 'Y') {
  1007. return '<span class="label label-danger">已删除</span>';
  1008. } else {
  1009. return '<span class="label label-success">-</span>';
  1010. }
  1011. }
  1012. function ProductNameFormatter(v, r) {
  1013. return `<span class="label label-default">${v}<a href="#" onclick="f_ShowStoreInfo('${r.id}',this)">(库存)</a></span>`;
  1014. }
  1015. function f_ShowStoreInfo(pno,dom) {
  1016. var $tbody = $(".store_box .table.table-striped > tbody");
  1017. $tbody.find("tr:not(:first)").remove();
  1018. var formatterShowStore = function (res) {
  1019. $(".store_box ").show();
  1020. $(".store_box").off('mouseleave').on('mouseleave',
  1021. function(e) {
  1022. $(".store_box ").hide(1000);
  1023. });
  1024. $(".store_box ").offset({
  1025. left: $(dom).offset().left,
  1026. top: $(dom).offset().top+25
  1027. });
  1028. res.forEach(function(r) {
  1029. var sTr = '<tr>';
  1030. sTr += '<td class="productionOrderNo">' + r.productionOrderNo + '</td>';
  1031. sTr += '<td class="storeLocationNo">' + r.storeLocationNo + '</td>';
  1032. sTr += '<td >' + r.quantity + '</td>';
  1033. var isCanUser = formatNum(Number(r.quantity), Number(r.freezeQuantity), 3);
  1034. sTr += '<td>' + isCanUser + '</td>';
  1035. sTr += '</tr>';
  1036. $tbody.append(sTr);
  1037. });
  1038. }
  1039. SaveAjax({
  1040. url: window.appUrl + `Common/GetProductStoreInfoByProductNo?productNo=${pno}`,
  1041. isValidate: false,
  1042. isAlert: false,
  1043. dataType: "json",
  1044. success: function (res) {
  1045. //console.log(res);
  1046. if (res && res.length > 0) {
  1047. formatterShowStore(res);
  1048. } else {
  1049. $(".store_box ").hide();
  1050. abp.message.warn("未查询到库存或库存为空!");
  1051. }
  1052. }
  1053. });
  1054. }
  1055. function f_closeStore_box(dom) {
  1056. $(".store_box ").hide();
  1057. }
  1058. var formatNum = function(f1, f2, digit) {
  1059. //var m = Math.pow(10, digit);
  1060. //return parseInt(f1*m-f2*m, 10) / m;
  1061. var z = f1 - f2;
  1062. return z.toFixed(digit);
  1063. }
  1064. function CanUserQuantityFormatte(v, r) {
  1065. var count = r.actualQuantity - r.freezeQuantity;
  1066. var str = '<span class="label label-warning">' + count + '</span>';
  1067. if (count > 0) {
  1068. str = '<span class="label label-info">' + count + '</span>';
  1069. } else if (count < 0) {
  1070. str = '<span class="label label-danger">' + count + '</span>';
  1071. }
  1072. return str;
  1073. }
  1074. </script>
  1075. }
  1076. <section style="display: none">
  1077. <select id="hid-type">
  1078. <option value=""></option>
  1079. </select>
  1080. @Html.DropDownList("hid-emergencyLevel", emergencyLevelList);
  1081. @Html.DropDownList("hide-ProductionOrderStatus", productionOrderStatus)
  1082. </section>