OrderMg.cshtml 60 KB

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