OrderStatusMg.cshtml 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682
  1. @using System.Net.Mime
  2. @using System.Web.UI.HtmlControls
  3. @using Abp.Authorization
  4. @using IwbZero.Session
  5. @using ShwasherSys
  6. @using ShwasherSys.Authorization.Permissions
  7. @using ShwasherSys.Models.Layout
  8. @using ShwasherSys.Models.Modal
  9. @using ShwasherSys.Views.Shared.New.Table
  10. @{
  11. /**/
  12. ViewBag.ActiveMenu = PermissionNames.PagesOrderInfoOrderStatusMg; //The menu item will be active for this page.
  13. ViewBag.Title = "订单状态维护";
  14. List<SelectListItem> OrderStatusList = ViewBag.OrderStatus;
  15. List<SelectListItem> OrderItemStatusList = ViewBag.OrderItemStatus;
  16. List<SelectListItem> emergencyLevelList = ViewBag.EmergencyLevel;
  17. Boolean isCanChangeOrderItemStatus = IsGranted(PermissionNames.PagesOrderInfoOrderStatusMgChangeStatus);
  18. Boolean isCanViewPrice = IsGranted(PermissionNames.PagesOrderInfoOrderStatusMgQueryOrderPrice);
  19. string startDate = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-dd");
  20. string endDate = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd");
  21. List<SelectListItem> OrderSaleTypeList = ViewBag.OrderSaleType;
  22. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  23. {
  24. new SearchItem("id", "流水号"),
  25. new SearchItem("orderDate", "订单日期",FiledType.D,ExpType.GreaterOrEqual,value:startDate),
  26. new SearchItem("orderDate", "到",FiledType.D,ExpType.LessOrEqual,value:endDate),
  27. new SearchItem("customerId", "客户编号").SetSearchIcon("query_customer_modal"),
  28. new SearchItem("stockNo", "客户订单号"),
  29. new SearchItem("orderStatusId", "状态",FiledType.I,ExpType.Equal).SetSearchItem(OrderStatusList),
  30. new SearchItem("saleMan", "业务员",showField:"saleManName").SetSearchIcon("query_employee_modal","SearchForm") ,
  31. new SearchItem("saleType", "销售类型",FiledType.Inull,ExpType.Equal).SetSearchItem(OrderSaleTypeList),
  32. }, false);
  33. }
  34. @section css{
  35. <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  36. <link href="~/Content/Plugins/bootstrap-table-fixd-columns/bootstrap-table-fixed-columns.css" rel="stylesheet" />
  37. <link href="~/Views/OrderInfo/css/OrderStatusMg.css" rel="stylesheet" />
  38. <style>
  39. .form-panel {
  40. margin-bottom: 5px;
  41. }
  42. .form-panel-header {
  43. padding: 3px 10px;
  44. }
  45. .query-label {
  46. margin-bottom: 1px;
  47. }
  48. .query-form-control {
  49. padding: 1px 12px;
  50. height: 25px;
  51. }
  52. .query-form-group {
  53. margin-bottom: 5px;
  54. }
  55. .item-tool-col {
  56. padding: 10px;
  57. color: azure
  58. }
  59. .sendQuantity {
  60. }
  61. .box {
  62. border: 2px solid #938f9a;
  63. border-radius: 10px;
  64. padding: 0px 0px;
  65. }
  66. .box .box-header {
  67. height: 50px;
  68. background: #938f9a;
  69. }
  70. .form-input-send {
  71. height: 30px;
  72. }
  73. </style>
  74. }
  75. <style>
  76. label.error {
  77. bottom: 12px;
  78. right: 15px;
  79. }
  80. [type="radio"]:not(:checked) + label, [type="radio"]:checked + label {
  81. padding-left: 25px;
  82. font-size: 1.5rem;
  83. color: #dad9db;
  84. }
  85. [type="radio"]:not(:checked) + label::before, [type="radio"]:not(:checked) + label::after {
  86. border: 2px solid rgb(0,155,244) !important;
  87. }
  88. .MapperItem {
  89. border: 1px solid rebeccapurple;
  90. border-radius: 4px;
  91. padding: 3px 10px;
  92. margin-top: 3px;
  93. }
  94. .MapperItem:after, .MapperItem:before {
  95. display: table;
  96. content: " ";
  97. }
  98. .MapperItem:after {
  99. clear: both;
  100. }
  101. .accordion-toggle {
  102. font-size: 1.5rem;
  103. color: #000080;
  104. cursor: pointer;
  105. }
  106. .accordion-toggle > i, .guide > i {
  107. display: inline-block;
  108. color: #ffffff;
  109. transition: all 1s ease;
  110. }
  111. .accordion-toggle .down-direction {
  112. transform: rotate(-90deg);
  113. }
  114. .down-direction2 {
  115. transform: rotate(180deg);
  116. }
  117. </style>
  118. <div class="table-box mr-4 iwb-bootstrap-table">
  119. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  120. <table id="table"
  121. data-url="/api/services/app/OrderHeaders/GetAll"
  122. data-striped="true" data-id-field="id" data-unique-id="id"
  123. data-method="post"
  124. data-side-pagination="server"
  125. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  126. data-cache="false"
  127. 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"
  128. data-query-params="QueryParams"
  129. data-response-handler="ResponseHandler"
  130. data-click-to-select="true"
  131. data-single-select="true"
  132. data-show-jumpto="true">
  133. <thead>
  134. <tr class="row" id="header">
  135. <th data-field="state" data-checkbox="true"></th>
  136. <th data-align="center" data-field="id">流水号</th>
  137. <th data-align="center" data-field="orderStatusId" data-formatter="OrderStatusFormatter">订单状态</th>
  138. <th data-align="center" data-field="isLock" data-formatter="IsLockFormatter">是否删除</th>
  139. <th data-align="center" data-field="customerId">客户编号</th>
  140. <th data-align="center" data-field="stockNo">客户订单号</th>
  141. <th data-align="center" data-field="orderDate" data-formatter="DateFormatter">订单日期</th>
  142. <th data-align="center" data-field="linkName">联系人</th>
  143. <th data-align="center" data-field="telephone">电话</th>
  144. <th data-align="center" data-field="saleManName">订单业务员</th>
  145. <th data-align="center" data-field="saleTypeName">外销/内销</th>
  146. <th data-align="center" data-field="timeCreated">创建日期</th>
  147. @*
  148. <th data-align="center" data-formatter="ActionsFormatter"></th>
  149. *@
  150. </tr>
  151. </thead>
  152. </table>
  153. </div>
  154. <div class="table-box mr-4 iwb-bootstrap-table" id="orderItemDiv" style="display: none;">
  155. <div class="btn-toolbar row" role="toolbar" aria-label="Toolbar with button groups">
  156. <div class="col-sm-2 col-lg-2 item-tool-col">
  157. <span style=""><strong>流水号:</strong></span><span id="orderHeaderNo"></span>
  158. </div>
  159. <div class="col-sm-2 col-lg-2 item-tool-col">
  160. <span><strong>客户订单号:</strong></span><span id="stockNo"></span>
  161. </div>
  162. <div class="col-sm-2 col-lg-2 item-tool-col">
  163. <button class="btn btn-info" style="height: 20px; padding: 0px 12px; margin-right: 3px;border-radius: 50px;" id="BtnChangeOrderItemStoreCompleteStatus" onclick="f_ChangeOrderItemStoreCompleteStatus()"><i class="iconfont icon-edit"></i>修改货物配齐状态</button>
  164. @if (isCanChangeOrderItemStatus)
  165. {
  166. <button class="btn btn-info" style="height: 20px; padding: 0px 12px; border-radius: 50px;" id="BtnChangeOrderItemStatus" onclick="f_ChangeOrderItemStatus()"><i class="iconfont icon-edit"></i>修改订单明细状态</button>
  167. }
  168. </div>
  169. <div class="col-sm-3 col-lg-3 item-tool-col">
  170. @if (IsGranted(PermissionNames.PagesOrderInfoOrderStatusMgAuditItem))
  171. {
  172. <button class="btn btn-warning" style="height: 20px; padding: 0px 12px; border-radius: 50px;" id="BtnAuditNewOrderItems" onclick="f_AuditNewOrderItems()"><i class="iconfont icon-shenhe"></i>审核全部新建订单</button>
  173. }
  174. </div>
  175. <div class="col-sm-3 col-lg-3 item-tool-col">
  176. <span><strong>当前订单是否已全部完成发货:</strong></span><span id="isAllSend" style="color: red">未完成</span>
  177. </div>
  178. </div>
  179. <table id="tableOrderItem"
  180. data-striped="true" data-id-field="id" data-unique-id="id"
  181. data-method="post"
  182. data-side-pagination="server"
  183. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  184. data-cache="false"
  185. data-pagination="false" 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"
  186. data-click-to-select="true"
  187. data-single-select="false" data-show-footer="true">
  188. <thead>
  189. <tr class="row">
  190. <th data-field="state" data-checkbox="true"></th>
  191. <th data-align="center" data-field="orderStatusName" data-formatter="OrderItemStatusFormatter" data-footer-formatter="合计:">当前状态</th>
  192. <th data-align="center" data-field="id">明细流水号</th>
  193. <th data-align="center" data-field="productNo">产品编号</th>
  194. <th data-align="center" data-field="partNo">零件号</th>
  195. <th data-align="center" data-field="standardName">标准名称</th>
  196. <th data-align="center" data-field="model">规格</th>
  197. <th data-align="center" data-field="material">材质</th>
  198. <th data-align="center" data-field="productName">型号</th>
  199. <th data-align="center" data-field="surfaceColor">表色</th>
  200. <th data-align="center" data-field="rigidity">硬度</th>
  201. <th data-align="center" data-field="emergencyLevel" data-formatter="EmergencyLevelFormatter">紧急程度</th>
  202. <th data-align="center" data-field="storeCompleteState" data-formatter="StoreCompleteStateFormatter">是否库齐</th>
  203. @if (isCanViewPrice)
  204. {
  205. @*<th data-align="center" data-field="currencyId">货币</th>*@
  206. @*<th data-align="center" data-field="currencyPrice" data-formatter="CurrencyPriceFormatter">货币价格(含税)</th>*@
  207. <th data-align="center" data-field="price" data-formatter="PriceFormatter">含税价格</th>
  208. <th data-align="center" data-field="afterTaxPrice" data-formatter="TaxPriceFormatter">不含税价格</th>
  209. <th data-align="center" data-field="logisticsFee">运费</th>
  210. <th data-align="center" data-field="moldFee">模具费</th>
  211. }
  212. <th data-align="center" data-field="quantity" data-formatter="QuantityFormatter">总数</th>
  213. <th data-align="center" data-field="isSendQuantity">已发数</th>
  214. <th data-align="center" data-field="remainingQuantity">剩余数</th>
  215. @if (isCanViewPrice)
  216. {
  217. <th data-align="center" data-field="totalPrice" data-footer-formatter="AllTotalPriceFormatter" data-formatter="TotalPriceFormatter">含税总金额</th>
  218. <th data-align="center" data-field="afterTaxTotalPrice" data-footer-formatter="AllAfterTaxTotalPriceFormatter" data-formatter="TotalPriceFormatter">不含税总金额</th>
  219. }
  220. <th data-align="center" data-field="sendDate" data-formatter="SendDateFormatter">送货日期</th>
  221. @*<th data-align="center" data-field="isReport" data-formatter="IsReportFormatter">检验报告</th>*@
  222. <th data-align="center" data-field="operatorAction" data-formatter="ActionsItemFormatter"></th>
  223. </tr>
  224. </thead>
  225. </table>
  226. </div>
  227. @section modal{
  228. <section>
  229. <div class="modal fade" id="modalSendOrder" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  230. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 850px; ">
  231. <div class="modal-content">
  232. <div class="modal-header">
  233. <input type="hidden" id="totalQuantity" />
  234. <input type="hidden" id="isSendQuantity" />
  235. <input type="hidden" id="canSendQuantity" />
  236. <input type="hidden" id="orderItemNo_ForSend" />
  237. <div class="box-title" style="line-height: 25px; color: #f9f9f9;display: block;">
  238. @*<span id="productId"></span>*@
  239. @*<input type="text" name="productId" id="productId" />*@
  240. <label class="iwb-label col-md-2 control-label iwb-label-required" for="productId" style="padding: 3px 3px;">产品编号</label>
  241. <div class="col-md-4" style="margin-left: -30px;">
  242. <div class="input-group">
  243. <input class="form-control" Required id="productId" disabled="disabled" name="productId" placeholder="请输入..." value="" style="width:100%;" type="text" />
  244. @if (PermissionChecker.IsGranted(PermissionNames.PagesOrderInfoOrderStatusMgReplaceSendItem))
  245. {
  246. <div class="input-group-addon" onclick="ShowModal('query_Product_modal');">
  247. <i class="iconfont icon-search"></i>
  248. </div>
  249. }
  250. </div>
  251. </div>
  252. &nbsp;&nbsp;
  253. <div class="col-md-5">已发/总数:<span id="IsSendQuantity" style="text-decoration: underline"></span>&nbsp;&nbsp;被定量:<span id="IsLockQuantity" style="text-decoration: underline"></span></div>
  254. </div>
  255. <div style="position: absolute; right: 5px; top: 8px">
  256. <button class="btn btn-info" onclick="SendOrderAction()">确认发货</button>
  257. <button class="btn btn-default" onclick="$('#modalSendOrder').modal('hide')">取消</button>
  258. </div>
  259. </div>
  260. <div class="modal-body">
  261. <form id="formSend">
  262. @*<input type="number" class="form-control number sendQuantity form-input-send" id="ffffff" name="ffffff" required min="0" />*@
  263. <table class="table table-striped fahuo">
  264. <tbody>
  265. <tr>
  266. <th style="width: 150px">批次号</th>
  267. <th style="width: 150px">库位</th>
  268. @*<th style="width: 125px">包装(每包千件数)</th>*@
  269. <th style="width: 150px">可用数量(千件)</th>
  270. <th style="width: 200px">发货数量</th>
  271. <th style="width: 200px">千件/每包</th>
  272. </tr>
  273. </tbody>
  274. </table>
  275. <div class=" accordion" style="padding: 0; border-top: 2px dotted #ffffff; display: none;">
  276. <div class="accordion-group">
  277. <div class="accordion-heading" style="background: #ccc; padding: 4px;">
  278. <label class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
  279. 选择本次计划发货的信息 <i class="iconfont icon-left down-direction "></i>
  280. </label>
  281. </div>
  282. <div id="collapseOne" class="accordion-body collapse in" style="height: 100px; ">
  283. <div class="accordion-inner" style="display: flex;justify-content: flex-start;flex-direction: row;">
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. </form>
  289. </div>
  290. </div>
  291. </div>
  292. </div>
  293. </section>
  294. <section>
  295. <!--Main Modal-->
  296. <div class="modal fade" id="modalChangePrice" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  297. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  298. <div class="modal-content">
  299. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("价格变更", ""))
  300. @{
  301. var inputs = new List<InputViewModel>
  302. {
  303. new InputViewModel("orderItemNo",displayName:"订单明细编号",name:"orderItemNo").SetDisabled(),
  304. new InputViewModel("oldPrice",displayName:"原价格",@class:"number",other:"min=0.001").SetReadOnly(),
  305. new InputViewModel("newPrice", displayName:"修改的价格",@class:"number",other:"min=0.001"),
  306. };
  307. //var specials = new List<SpecialInputModel>();
  308. }
  309. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  310. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangePrice", "ChangePrice()"))
  311. </div>
  312. </div>
  313. </div>
  314. <div class="modal fade" id="modalChangeAfterTaxPrice" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  315. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  316. <div class="modal-content">
  317. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("税后价格变更", ""))
  318. @{
  319. var inputs5 = new List<InputViewModel>
  320. {
  321. new InputViewModel("orderItemNo5",displayName:"订单明细编号",name:"orderItemNo").SetDisabled(),
  322. new InputViewModel("oldPrice2",displayName:"原税后价格",@class:"number",name:"oldPrice",other:"min=0").SetReadOnly().SetNotRequired(),
  323. new InputViewModel("newAfterTaxPrice", displayName:"修改的价格",@class:"number",other:"min=0"),
  324. };
  325. //var specials = new List<SpecialInputModel>();
  326. }
  327. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs5))
  328. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangeAfterTaxPrice", "ChangeAfterTaxPrice()"))
  329. </div>
  330. </div>
  331. </div>
  332. <div class="modal fade" id="modalChangeQuantity" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  333. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  334. <div class="modal-content">
  335. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("数量变更", ""))
  336. @{
  337. var inputs2 = new List<InputViewModel>
  338. {
  339. new InputViewModel("orderItemNo2",displayName:"订单明细编号",name:"orderItemNo").SetDisabled(),
  340. new InputViewModel("oldQuantity",displayName:"原数量",@class:"number",other:"min=0.001").SetReadOnly(),
  341. new InputViewModel("newQuantity", displayName:"修改的数量",@class:"number",other:"min=0.001"),
  342. };
  343. //var specials = new List<SpecialInputModel>();
  344. }
  345. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs2))
  346. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangeQuantity", "ChangeQuantity()"))
  347. </div>
  348. </div>
  349. </div>
  350. <div class="modal fade" id="modalChangeSendDate" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  351. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  352. <div class="modal-content">
  353. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("发货日期变更", ""))
  354. @{
  355. var inputs3 = new List<InputViewModel>
  356. {
  357. new InputViewModel("orderItemNo3",displayName:"订单明细编号",name:"orderItemNo").SetDisabled(),
  358. new InputViewModel("oldSendDate",displayName:"原发货日期",@class:"date").SetDisabled(),
  359. new InputViewModel("newSendDate", displayName:"修改日期",@class:"date"),
  360. };
  361. //var specials = new List<SpecialInputModel>();
  362. }
  363. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs3))
  364. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangeSendDate", "ChangeSendDate()"))
  365. </div>
  366. </div>
  367. </div>
  368. <div class="modal fade" id="modalChangeStatus" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  369. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  370. <div class="modal-content">
  371. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("订单明细状态变更", ""))
  372. @{
  373. var inputs4 = new List<InputViewModel>
  374. {
  375. new InputViewModel("orderItemStatusId",InputTypes.List,"变更状态").SetSelectOptions(OrderItemStatusList)
  376. };
  377. }
  378. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs4))
  379. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangeStatus", "ChangeOrderItemStatus()"))
  380. </div>
  381. </div>
  382. </div>
  383. <div class="modal fade" id="modalCompleteStoreStatus" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  384. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  385. <div class="modal-content">
  386. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("货物配齐状态变更", ""))
  387. @{
  388. var inputs6 = new List<InputViewModel>
  389. {
  390. new InputViewModel("storeCompleteStateId",InputTypes.List,"货物配齐状态").SetSelectOptions(new List<SelectListItem>(){new SelectListItem(){Text = "到齐",Value = "1"},new SelectListItem(){ Text = "未到齐", Value = "0" },new SelectListItem(){ Text = "货物已齐,待改包", Value = "2" } })
  391. };
  392. }
  393. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs6))
  394. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalChangeStatus", "ChangeCompleteStoreStatus()"))
  395. </div>
  396. </div>
  397. </div>
  398. <div class="modal fade" id="showProductProcess" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  399. <div class="modal-dialog modal-dialog-centered" role="document" style="width: 600px">
  400. <div class="modal-content">
  401. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("生产进度", ""))
  402. <div class="timeline-small">
  403. <div class="timeline-small-body">
  404. <ul>
  405. </ul>
  406. </div>
  407. </div>
  408. @Html.Partial("Modals/_ModalFooter", "1")
  409. </div>
  410. </div>
  411. </div>
  412. </section>
  413. <section>
  414. @Html.Partial("Modals/Query/_Customer", "KeyWords-4")
  415. @Html.Partial("Modals/Query/_Product", "productId")
  416. @Html.Partial("Modals/Query/_Employee", "saleMan|KeyWords-7,saleManName|KeyWords-saleManName-7,saleManId")
  417. </section>
  418. }
  419. @Html.Partial("_searchInfoByProductNo")
  420. @section scripts
  421. {
  422. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  423. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  424. <script src="~/Content/Plugins/bootstrap-table-fixd-columns/bootstrap-table-fixed-columns.js"></script>
  425. <script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
  426. <script src="~/Views/OrderInfo/js/OrderStatusMg.js"></script>
  427. @*<script src="~/Views/OrderInfo/js/OrderMg.js"></script>*@
  428. <script type="text/javascript">
  429. var customerNo;
  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. $(function() {
  443. //show完毕前执行
  444. $("#KeyWords-2").datetimepicker(datePickerOpt).on('show',
  445. function(event) {
  446. event.preventDefault();
  447. event.stopPropagation();
  448. }).on('hide',
  449. function(event) {
  450. event.preventDefault();
  451. event.stopPropagation();
  452. });
  453. $("#KeyWords-3").datetimepicker(datePickerOpt).on('show',
  454. function(event) {
  455. event.preventDefault();
  456. event.stopPropagation();
  457. }).on('hide',
  458. function(event) {
  459. event.preventDefault();
  460. event.stopPropagation();
  461. });
  462. $("#newSendDate").datetimepicker(datePickerOpt).on('show',
  463. function(event) {
  464. event.preventDefault();
  465. event.stopPropagation();
  466. }).on('hide',
  467. function(event) {
  468. event.preventDefault();
  469. event.stopPropagation();
  470. });
  471. LoadTable();
  472. var funs = window.funs || { none: function() { console.log("No type"); } };
  473. $.extend(funs, { btnAudit: function(url) { BtnAudit(url); } });
  474. funs["btnPrint"] = function(url) {
  475. BtnPrint(url);
  476. }
  477. funs["btnQuery"] = function(url) {
  478. BtnShow(url);
  479. }
  480. //$(".sendQuantity").on('change',
  481. // function() {
  482. // var quantity = Number($(this).val());
  483. // var max = Number($(this).data("maxquantity"));
  484. // if (quantity > max) {
  485. // $(this).val(max);
  486. // }
  487. // });
  488. $(".modal-dialog").draggable();
  489. $(".accordion-toggle").on('click',
  490. function() {
  491. $(".accordion-toggle i").toggleClass("down-direction");
  492. });
  493. });
  494. function BtnPrint(url) {
  495. var rows = config.table.bootstrapTable("getSelections");
  496. if (rows.length === 1) {
  497. window.open("@Url.Action("OrderPrint")/" + rows[0].id, "_blank");
  498. } else
  499. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  500. }
  501. function BtnShow(url) {
  502. var rows = config.table.bootstrapTable("getSelections");
  503. if (rows.length === 1) {
  504. window.open("@Url.Action("OrderDetail")/" + rows[0].id, "_blank");
  505. } else
  506. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  507. }
  508. function OnLoadSuccess() {
  509. $(".bs-checkbox").find("input").addClass("filled-in").after("<label></label>");
  510. _isSearching = false;
  511. abp.ui.clearBusy();
  512. setTimeout(function() {
  513. var alldata = $("#table").bootstrapTable('getData');
  514. console.log(alldata);
  515. if (alldata.length > 0) {
  516. console.log(alldata);
  517. $("#table").bootstrapTable('check', 0);
  518. } else {
  519. $("#orderItemDiv").css("display", "none");
  520. }
  521. },
  522. 500);
  523. }
  524. function BtnAudit(url) {
  525. var rows = $("#table").bootstrapTable("getSelections");
  526. if (rows.length === 1) {
  527. abp.message.confirm("确认审核通过?",
  528. "订单审核",
  529. function() {
  530. if (rows[0].orderStatusId !== 2) {
  531. abp.message.warn("非新建的订单,无法进行审核!");
  532. return;
  533. }
  534. SaveAjax({
  535. url: url,
  536. dataType: "json",
  537. data: { id: rows[0].id },
  538. isAlert: false,
  539. isValidate: false,
  540. success: function(res) {
  541. if (res) {
  542. $("#table").bootstrapTable("updateCellById",
  543. { id: rows[0].id, field: "orderStatusId", value: 3 });
  544. RefreshOrderItemTable(rows[0].id, rows[0].orderStatusId, rows[0].saleType);
  545. }
  546. }
  547. });
  548. });
  549. } else
  550. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  551. }
  552. function OnCheck(row, $element) {
  553. RefreshOrderItemTable(row.id, row.orderStatusId, row.saleType);
  554. $("#orderHeaderNo").html(row.id);
  555. $("#stockNo").html(row.stockNo);
  556. //$("#isAllSend")
  557. customerNo = row.customerId;
  558. console.log(customerNo);
  559. }
  560. function OnUnCheck(row, $element) {
  561. $("#table").bootstrapTable('resetView');
  562. $orderItemDiv.css("display", "none");
  563. customerNo = "";
  564. $("#table").bootstrapTable('resetView', { height: 800 });
  565. }
  566. function OrderStatusFormatter(v, r) { //danger
  567. if (r.orderStatusId === 2) {
  568. return '<span class="label label-success">新建</span>';
  569. } else if (r.orderStatusId === 3) {
  570. return '<span class="label label-danger">已审核</span>';
  571. } else if (r.orderStatusId === 12) {
  572. return '<span class="label label-primary">完成</span>';
  573. }
  574. return v;
  575. }
  576. //item
  577. var $tableOrderItem = $("#tableOrderItem");
  578. var $orderItemDiv;
  579. function RefreshOrderItemTable(orderNo, orderStatusId, saleType) {
  580. $orderItemDiv = $("#orderItemDiv");
  581. if (orderNo) {
  582. $("#table").bootstrapTable('resetView', { height: 300 });
  583. $orderItemDiv.css("display", "block");
  584. SaveAjax({
  585. url: window.appUrl + "OrderItems/GetOrderItemsByOrderNo?pcOrderNo=" + orderNo,
  586. dataType: "json",
  587. isAlert: false,
  588. isValidate: false,
  589. success: function(res) {
  590. console.log(res);
  591. if (res && res.orderItems.length > 0) {
  592. if (res.isAllSend) {
  593. $('#isAllSend').html("完成");
  594. } else {
  595. $('#isAllSend').html("未完成");
  596. }
  597. $tableOrderItem.bootstrapTable("destroy");
  598. $tableOrderItem.bootstrapTable({
  599. data: res.orderItems,
  600. onPostBody: OnPostBody,
  601. onAll: OnAllItem
  602. });
  603. if (orderStatusId === 2) {
  604. $tableOrderItem.bootstrapTable("hideColumn", "operatorAction");
  605. } else {
  606. $tableOrderItem.bootstrapTable("showColumn", "operatorAction");
  607. }
  608. if (saleType === 2) {
  609. $tableOrderItem.bootstrapTable("hideColumn", "afterTaxPrice");
  610. $tableOrderItem.bootstrapTable("hideColumn", "afterTaxTotalPrice");
  611. }
  612. $tableOrderItem.bootstrapTable('resetView');
  613. $(".bs-checkbox").find("input").addClass("filled-in").after("<label></label");
  614. $("#tableOrderItem thead th.bs-checkbox ").off("click.checkOnTable").on(
  615. "click.checkOnTable",
  616. function() {
  617. $(this).find("input").click();
  618. });
  619. } else {
  620. $orderItemDiv.css("display", "none");
  621. $tableOrderItem.bootstrapTable("destroy");
  622. $tableOrderItem.bootstrapTable({ data: "", onPostBody: OnPostBody });
  623. $("#table").bootstrapTable('resetView', { height: 800 });
  624. }
  625. }
  626. });
  627. } else {
  628. $orderItemDiv.css("display", "none");
  629. $tableOrderItem.bootstrapTable("destroy");
  630. $tableOrderItem.bootstrapTable({ data: "", onPostBody: OnPostBody });
  631. $("#table").bootstrapTable('resetView', { height: 800 });
  632. }
  633. }
  634. function OnAllItem() {
  635. $("#BtnChangeOrderItemStatus,#BtnChangeOrderItemStoreCompleteStatus")
  636. .prop('disabled', $tableOrderItem.bootstrapTable('getSelections').length < 1);
  637. }
  638. </script>
  639. <script>
  640. function Submit_query_Product_modal(row) {
  641. row = row || $query_Product_modal_table.bootstrapTable("getSelections")[0];
  642. if (row) {
  643. var productNo = row.id;
  644. $("#productId").val(productNo);
  645. reloadSendTable(productNo);
  646. } else {
  647. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  648. }
  649. $("#query_Product_modal").modal('hide');
  650. }
  651. function reloadSendTable(productNo) {
  652. var $tbody = $(".table.table-striped.fahuo > tbody");
  653. $tbody.find("tr:not(:first)").remove();
  654. var customerId = $("#table").bootstrapTable("getSelections")[0].customerId;
  655. SaveAjax({
  656. url: window.appUrl + "Query/QueryStoreFilter?productNo=" + productNo + '&customerId=' + customerId,
  657. isAlert: false,
  658. isValidate: false,
  659. success: function(res) {
  660. //console.log(res);
  661. if (res && res.length > 0) {
  662. res.forEach(function(r) {
  663. var sTr = '<tr>';
  664. sTr += '<td class="currentProductStoreHouseNo" style="display:none;">' +
  665. r.currentProductStoreHouseNo +
  666. '</td>';
  667. sTr += '<td class="productionOrderNo">' + r.productionOrderNo + '</td>';
  668. sTr += '<td class="storeLocationNo">' + r.storeLocationNo + '</td>';
  669. var isCanUser = formatNum(Number(r.quantity), Number(r.freezeQuantity), 3);
  670. sTr += '<td>' + isCanUser + '</td>';
  671. sTr +=
  672. '<td style="position:relative"><input type="text" name="SendQuantity" class="form-control number sendQuantity form-input-send" min="0" max="' +
  673. isCanUser +
  674. '"/></td>';
  675. sTr +=
  676. '<td style="position:relative"><input type="text" name="AvgSendQuantity" class="form-control number avgQuantity form-input-send" min="0"/></td>';
  677. sTr += '</tr>';
  678. $tbody.append(sTr);
  679. });
  680. }
  681. }
  682. });
  683. SaveAjax({
  684. url: window.appUrl +
  685. "OrderItems/GetCurrentProductLock?productNo=" +
  686. productNo +
  687. '&orderNo=' +
  688. $("#orderHeaderNo").text(),
  689. isAlert: false,
  690. isValidate: false,
  691. success: function(res) {
  692. if (res) {
  693. $("#IsLockQuantity").html(res.quantity);
  694. }
  695. }
  696. });
  697. //accordion-inner
  698. $('#modalSendOrder .accordion-inner').html('');
  699. SaveAjax({
  700. url: window.appUrl +
  701. "OrderItems/GetSendDateWarns?orderItemId=" +
  702. $("#orderItemNo_ForSend").val(),
  703. isAlert: false,
  704. isValidate: false,
  705. success: function(res) {
  706. var rendInfo = '';
  707. if (res && res.length > 0) {
  708. res.forEach(function(v, i) {
  709. if (v.sendState !== 1) {
  710. rendInfo += `<div class="tool-radio"><input name="sendDateItemCheck" type="radio" checked="${i === 0 ? 'checked' : ''}" id="sendDateItemCheck${i}" class="activeStatus" value="${v.id}" /><label for="sendDateItemCheck${i}" style="color: #000;">日期:${DateFormatter(v.planDate)}(${v.planQuantity} 千件)</label></div>`;
  711. }
  712. });
  713. $('#modalSendOrder .accordion-inner').append(rendInfo);
  714. $('#modalSendOrder .tool-radio input[type="radio"]').on('click',
  715. function(e) {
  716. var $that = $(e.target);
  717. $that.attr('checked', 'checked');
  718. });
  719. $("#modalSendOrder .accordion").show();
  720. }
  721. if (!rendInfo) {
  722. $("#modalSendOrder .accordion").hide();
  723. }
  724. }
  725. });
  726. }
  727. function f_SendOrderItem(id, quantity, isSendQuantity, productNo) {
  728. $("#productId").val(productNo);
  729. $("#orderItemNo_ForSend").val(id);
  730. if (!isSendQuantity || !(isSendQuantity > 0)) {
  731. isSendQuantity = 0;
  732. }
  733. $("#IsSendQuantity").html('' + isSendQuantity + '/' + quantity);
  734. var totalQuantity = Number(quantity);
  735. isSendQuantity = Number(isSendQuantity);
  736. var canSendQuantity = formatNum(totalQuantity, isSendQuantity, 3);
  737. $("#canSendQuantity").val(canSendQuantity);
  738. $("#isSendQuantity").val(isSendQuantity);
  739. $("#totalQuantity").val(totalQuantity);
  740. reloadSendTable(productNo);
  741. $("#modalSendOrder").modal("show");
  742. }
  743. function SendOrderAction() {
  744. var orderItemId = $("#orderItemNo_ForSend").val();
  745. console.log("orderItemId" + orderItemId);
  746. var productId = $("#productId").val();
  747. var $tbody = $(".table.table-striped.fahuo > tbody");
  748. var trDatas = $tbody.find("tr:not(:first)");
  749. var sendAll = 0;
  750. var dataParam = {
  751. ProductNo: productId,
  752. CustomerNo: customerNo,
  753. SendItems: [],
  754. Id: orderItemId,
  755. SendAllQuantity: 0,
  756. SendDateWarnId: 0
  757. };
  758. if (trDatas) {
  759. for (var i = 0; i < trDatas.length; i++) {
  760. var sendItem = {};
  761. var sendQuantity = $(trDatas[i]).find(".sendQuantity").val();
  762. if (!sendQuantity || Number(sendQuantity) <= 0) {
  763. continue;
  764. }
  765. sendItem.SendQuantity = Number(sendQuantity);
  766. var avgQuantity = $(trDatas[i]).find(".avgQuantity").val();
  767. if (!avgQuantity || Number(avgQuantity) <= 0) {
  768. avgQuantity = sendQuantity;
  769. }
  770. sendItem.AvgQuantity = Number(avgQuantity);
  771. var currentProductStoreHouseNo = $(trDatas[i]).find(".currentProductStoreHouseNo").text();
  772. if (currentProductStoreHouseNo) {
  773. sendItem.CurrentProductStoreHouseNo = currentProductStoreHouseNo;;
  774. }
  775. var productionOrderNo = $(trDatas[i]).find(".productionOrderNo").text();
  776. if (productionOrderNo) {
  777. sendItem.ProductBatchNum = productionOrderNo;
  778. } else {
  779. sendItem.ProductBatchNum = "00000000000";
  780. }
  781. var storeLocationNo = $(trDatas[i]).find(".storeLocationNo").text();
  782. if (storeLocationNo) {
  783. sendItem.StoreLocationNo = storeLocationNo;
  784. }
  785. dataParam.SendItems.push(sendItem);
  786. sendAll += Number(sendQuantity);
  787. }
  788. }
  789. if (sendAll <= 0) {
  790. abp.message.warn("发货总量需要大于0千件!");
  791. return;
  792. }
  793. var canSendQuantity = Number($("#canSendQuantity").val());
  794. dataParam.SendAllQuantity = sendAll;
  795. dataParam.SendDateWarnId = $('#modalSendOrder .tool-radio input[name="sendDateItemCheck"]:checked').val();
  796. var save = function() {
  797. SaveAjax({
  798. url: window.appUrl + "OrderItems/SendOrderAction",
  799. //contentType: 'application/json',
  800. dataType: "json",
  801. form: $("#formSend"),
  802. data: dataParam,
  803. isAlert: false,
  804. isValidate: true,
  805. success: function(res) {
  806. if (res) {
  807. RefreshOrderItemTable(res.orderNo);
  808. $("#modalSendOrder").modal("hide");
  809. }
  810. }
  811. });
  812. }
  813. if (sendAll > canSendQuantity) {
  814. var isSendQuantity = $("#isSendQuantity").val(), totalQuantity = $("#totalQuantity").val();
  815. var temp = formatNum(Number(sendAll) + Number(isSendQuantity),
  816. Number(totalQuantity) + Number(totalQuantity * 0.05),
  817. 3);
  818. if (temp > 0) {
  819. abp.message.warn("发货总量已超出订单发货量5%,不能继续操作!");
  820. return;
  821. }
  822. abp.message.confirm("发货总量已超出订单发货量,是否要继续发货?",
  823. "确认发货",
  824. function(isConfirmed) {
  825. if (isConfirmed) {
  826. save();
  827. }
  828. });
  829. } else {
  830. save();
  831. }
  832. }
  833. var formatNum = function(f1, f2, digit) {
  834. //var m = Math.pow(10, digit);
  835. //return parseInt(f1*m-f2*m, 10) / m;
  836. var z = f1 - f2;
  837. return z.toFixed(digit);
  838. }
  839. function DateFormatter(v, r) {
  840. var sendDate = new Date(v);
  841. return '<span style="text-decoration:underline;" >' + sendDate.Format('yyyy-MM-dd') + '</span>';
  842. }
  843. function f_AuditOrderItem(id) {
  844. abp.message.confirm("确认审核通过?",
  845. "订单明细审核",
  846. function() {
  847. SaveAjax({
  848. url: window.appUrl + "OrderItems/Audit",
  849. dataType: "json",
  850. data: { id: id },
  851. isAlert: false,
  852. isValidate: false,
  853. success: function(res) {
  854. if (res) {
  855. RefreshOrderItemTable(res.orderNo);
  856. }
  857. }
  858. });
  859. });
  860. }
  861. function f_CloseOrderItem(id) {
  862. SaveAjax({
  863. url: window.appUrl + "OrderItems/End",
  864. dataType: "json",
  865. data: { id: id },
  866. isAlert: false,
  867. isValidate: false,
  868. success: function(res) {
  869. if (res) {
  870. RefreshOrderItemTable(res.orderItem.orderNo);
  871. //$("#table").bootstrapTable("refresh", { silent: true });
  872. /*setTimeout(function() {
  873. $("#table").bootstrapTable("checkBy", { field: "id", value: res.orderNo });//updateCellById
  874. },
  875. 500);*/
  876. if (res.isAllEnd) {
  877. $("#table").bootstrapTable("updateCellById",
  878. {
  879. id: res.orderItem.orderNo,
  880. field: "orderStatusId",
  881. value: '<span class="label label-primary">完成</span>'
  882. });
  883. $("#table").bootstrapTable("checkBy", { field: "id", value: res.orderItem.orderNo });
  884. }
  885. }
  886. }
  887. });
  888. }
  889. function f_ChangeOrderItemStatus() {
  890. var rows = $tableOrderItem.bootstrapTable("getSelections");
  891. if (rows.length > 0) {
  892. if (rows[0].isLock === 'Y') {
  893. abp.message.warn("订单已删除,不能变更明细!");
  894. return;
  895. }
  896. $("#modalChangeStatus").modal("show");
  897. } else {
  898. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  899. }
  900. }
  901. function f_ChangeOrderItemStoreCompleteStatus() {
  902. var rows = $tableOrderItem.bootstrapTable("getSelections");
  903. if (rows.length > 0) {
  904. if (rows[0].isLock === 'Y') {
  905. abp.message.warn("订单已删除,不能变更明细!");
  906. return;
  907. }
  908. $("#modalCompleteStoreStatus").modal("show");
  909. } else {
  910. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  911. }
  912. }
  913. function f_AuditNewOrderItems() {
  914. var headRow = config.table.bootstrapTable("getSelections");
  915. if (headRow[0].isLock === 'Y') {
  916. abp.message.warn("订单已删除,不能审核明细!");
  917. return;
  918. }
  919. if (headRow[0].orderStatusId === 2) {
  920. abp.message.warn("订单未审核,不能审核明细!");
  921. return;
  922. }
  923. var datas = $tableOrderItem.bootstrapTable("getData");
  924. if (datas.length > 0) {
  925. var newDataId = [];
  926. datas.forEach(function(r) {
  927. if (r.orderItemStatusId === 2) {
  928. newDataId.push(r.id);
  929. }
  930. });
  931. if (newDataId.length > 0) {
  932. var nd = newDataId.join(',');
  933. abp.message.confirm("确认审核通过全部新建订单?",
  934. "订单明细审核",
  935. function() {
  936. SaveAjax({
  937. url: window.appUrl + "OrderItems/AuditAllItems",
  938. data: { Id: nd },
  939. isAlert: false,
  940. isValidate: false,
  941. success: function(res) {
  942. RefreshOrderItemTable(res[0].orderNo);
  943. }
  944. });
  945. });
  946. } else {
  947. abp.message.warn("没有可审核的订单明细!");
  948. }
  949. } else {
  950. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  951. }
  952. }
  953. function ChangeOrderItemStatus() {
  954. var rows = $tableOrderItem.bootstrapTable("getSelections");
  955. if (rows.length > 0) {
  956. var ids = "";
  957. rows.forEach(function(r) {
  958. ids += "," + r.id;
  959. });
  960. ids = ids.substr(1);
  961. abp.message.confirm("确认变更选中明细的状态?",
  962. "订单明细状态变更",
  963. function() {
  964. SaveAjax({
  965. url: window.appUrl + "OrderItems/ChangeOrderItemStatusOnHeader",
  966. dataType: "json",
  967. data: { id: ids, orderItemStatusId: $("#orderItemStatusId").val() },
  968. isAlert: false,
  969. isValidate: false,
  970. success: function(res) {
  971. if (res) {
  972. RefreshOrderItemTable(res.orderItems[0].orderNo);
  973. if (res.isAllEnd) {
  974. $("#table").bootstrapTable("updateCellById",
  975. {
  976. id: res.orderItems[0].orderNo,
  977. field: "orderStatusId",
  978. value: '<span class="label label-primary">完成</span>'
  979. });
  980. $("#table").bootstrapTable("checkBy",
  981. { field: "id", value: res.orderItems[0].orderNo });
  982. }
  983. $("#modalChangeStatus").modal("hide");
  984. }
  985. }
  986. });
  987. });
  988. } else {
  989. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  990. }
  991. }
  992. function ChangeCompleteStoreStatus() {
  993. var rows = $tableOrderItem.bootstrapTable("getSelections");
  994. if (rows.length > 0) {
  995. var ids = "";
  996. rows.forEach(function(r) {
  997. ids += "," + r.id;
  998. });
  999. ids = ids.substr(1);
  1000. abp.message.confirm("确认变更选中明细的到货状态?",
  1001. "订单明细到货状态变更",
  1002. function() {
  1003. SaveAjax({
  1004. url: window.appUrl + "OrderItems/ChangeOrderItemCompleteStoreStatus",
  1005. dataType: "json",
  1006. data: { id: ids, orderItemStoreCompleteState: $("#storeCompleteStateId").val() },
  1007. isAlert: false,
  1008. isValidate: false,
  1009. success: function(res) {
  1010. if (res) {
  1011. RefreshOrderItemTable(res.orderItems[0].orderNo);
  1012. $("#modalCompleteStoreStatus").modal("hide");
  1013. }
  1014. }
  1015. });
  1016. });
  1017. } else {
  1018. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  1019. }
  1020. }
  1021. function ActionsItemFormatter(v, r) {
  1022. var str = "";
  1023. if (r.orderItemStatusId === 15) {
  1024. str = '<span class="table-action" onclick="f_SendOrderItem(\'' +
  1025. r.id +
  1026. '\',\'' +
  1027. r.quantity +
  1028. '\',\'' +
  1029. r.isSendQuantity +
  1030. '\',\'' +
  1031. r.productNo +
  1032. '\')"><i class="iconfont icon-right"></i>发货</span>';
  1033. } else if (r.orderItemStatusId === 9) {
  1034. str = '<span class="table-action" onclick="f_CloseOrderItem(\'' +
  1035. r.id +
  1036. '\')"><i class="iconfont icon-right"></i>结束</span>';
  1037. } else if (r.orderItemStatusId === 2) {
  1038. str = '<span class="table-action" onclick="f_AuditOrderItem(' +
  1039. r.id +
  1040. ')"><i class="iconfont icon-right"></i>完成审核</span>';
  1041. }
  1042. //else if (r.orderItemStatusId !== 15 && r.orderItemStatusId !== 9 && r.orderItemStatusId !== 11) {
  1043. // str = '<span class="table-action" onclick="f_AuditOrderItem(' +
  1044. // r.id +
  1045. // ')"><i class="iconfont icon-right"></i>完成审核</span>';
  1046. //}
  1047. return str;
  1048. }
  1049. function OrderItemStatusFormatter(v, r) {
  1050. if (r.orderItemStatusId === 15) {
  1051. return '<span class="label label-success">完成审核</span>';
  1052. } else if (r.orderItemStatusId === 9) {
  1053. return '<span class="label label-danger">发货</span>';
  1054. } else if (r.orderItemStatusId === 11) {
  1055. return '<span class="label label-primary">结束</span>';
  1056. } else if (r.orderItemStatusId === 2) {
  1057. return '<span class="label label-primary">新建</span>';
  1058. } else if (r.orderItemStatusId === 20) {
  1059. return '<span class="label label-primary">协商完成</span>';
  1060. }
  1061. return v;
  1062. }
  1063. function IsReportFormatter(v, r) {
  1064. var str = "";
  1065. if (v === "Y") {
  1066. str = '<span class="table-action">需要</span>';
  1067. } else if (v === "N") {
  1068. str = '<span class="table-action">不需要</span>';;
  1069. }
  1070. return str;
  1071. }
  1072. function SendDateFormatter(v, r) {
  1073. var dataNow = abp.clock.now();
  1074. var sendDate = new Date(v);
  1075. var s1 = dataNow.getTime(), s2 = sendDate.getTime();
  1076. var span = (s2 - s1) / 1000;
  1077. var dayspan = parseInt(span / (24 * 60 * 60));
  1078. if (dayspan < 0) {
  1079. return '<span style="text-decoration:underline;color:#ff0000" onclick="f_showChangeSendDate(' +
  1080. r.id +
  1081. ',\'' +
  1082. r.sendDate +
  1083. '\',' +
  1084. r.orderItemStatusId +
  1085. ')">' +
  1086. sendDate.Format('yyyy-MM-dd') +
  1087. '</span>';
  1088. }
  1089. if (dayspan > -1 && dayspan < 4) {
  1090. return '<span style="text-decoration:underline;color:#dd4b39" onclick="f_showChangeSendDate(' +
  1091. r.id +
  1092. ',\'' +
  1093. r.sendDate +
  1094. '\',' +
  1095. r.orderItemStatusId +
  1096. ')">' +
  1097. sendDate.Format('yyyy-MM-dd') +
  1098. '</span>';
  1099. }
  1100. return '<span style="text-decoration:underline;" onclick="f_showChangeSendDate(' +
  1101. r.id +
  1102. ',\'' +
  1103. r.sendDate +
  1104. '\',' +
  1105. r.orderItemStatusId +
  1106. ')">' +
  1107. sendDate.Format('yyyy-MM-dd') +
  1108. '</span>';
  1109. }
  1110. function f_showChangeSendDate(id, sendDate, s) {
  1111. if (s != @OrderItemStatusEnum.NewCreate.ToInt() && s != @OrderItemStatusEnum.Audited.ToInt()) {
  1112. abp.message.warn("已发货(或已结束),不能操作!");
  1113. return;
  1114. }
  1115. $("#orderItemNo3").val(id);
  1116. $("#oldSendDate").val(sendDate);
  1117. $("#newSendDate").val(sendDate);
  1118. $('#modalChangeSendDate form #btn_addWarnItem').remove();
  1119. $('#modalChangeSendDate form .MapperItem').remove();
  1120. $('#modalChangeSendDate form').append(` <div id="btn_addWarnItem" class="form-group-sm" style="margin-right: 15px;text-align: right"><button type="button" class="btn btn-sm btn-info" style="width:20%; background-color: #583d9c;border-color: #583d9c;" onclick="AddSendDateWarnItem()">增加分次发货提醒</button></div>`);
  1121. SaveAjax({
  1122. url: window.appUrl + "OrderItems/GetSendDateWarns?orderItemId=" + id,
  1123. //data: formUtil.Serialize(form),
  1124. modal: $("#modalChangeSendDate"),
  1125. dataType: "json",
  1126. isAlert: false,
  1127. isValidate: false,
  1128. success: function(res) {
  1129. if (res) {
  1130. res.forEach(function(v, i) {
  1131. AddSendDateWarnItem();
  1132. $('.MapperItem:eq(' + i + ') [name="id"]').val(v.id);
  1133. $('.MapperItem:eq(' + i + ') [name="planDate"]').val(v.planDate);
  1134. $('.MapperItem:eq(' + i + ') [name="planQuantity"]').val(v.planQuantity);
  1135. $('.MapperItem:eq(' + i + ') [name="remark"]').val(v.remark);
  1136. $('.MapperItem:eq(' + i + ') [name="planDate"]').prop('disabled', true);
  1137. $('.MapperItem:eq(' + i + ') [name="planQuantity"]').prop('readonly', true);
  1138. $('.MapperItem:eq(' + i + ') [name="remark"]').prop('readonly', true);
  1139. });
  1140. }
  1141. }
  1142. });
  1143. $("#modalChangeSendDate").modal("show");
  1144. }
  1145. function ChangeSendDate() {
  1146. //var form = $("#modalChangeSendDate").find("form");
  1147. var data = getSendDateItemFormData();
  1148. SaveAjax({
  1149. url: window.appUrl + "OrderItems/ChangeSendDate",
  1150. //data: formUtil.Serialize(form),
  1151. data: data,
  1152. modal: $("#modalChangeSendDate"),
  1153. dataType: "json",
  1154. isAlert: false,
  1155. isValidate: true,
  1156. success: function(res) {
  1157. if (res) {
  1158. RefreshOrderItemTable(res.orderNo);
  1159. $("#modalChangeSendDate").modal("hide");
  1160. }
  1161. }
  1162. });
  1163. }
  1164. //分批发货提醒 2023
  1165. function AddSendDateWarnItem() {
  1166. var str = ' <div class="MapperItem"><input class="form-control" name="id" type="hidden" value="0" >';
  1167. str += '<label class="iwb-label col-md-2 control-label iwb-label-required" for="planDate">送货日期</label>';
  1168. str += ' <div class="col-md-4">';
  1169. str +=
  1170. '<input class="form-control iwb-date" name="planDate" type="text" placeholder="请输入日期..." value="" style="width: 100%;">';
  1171. str += '</div>';
  1172. str += '<label class="iwb-label col-md-2 control-label iwb-label-required" for="planQuantity">数量(千件)</label>';
  1173. str += '<div class="col-md-4">';
  1174. str +=
  1175. '<input class="form-control" name="planQuantity" type="number" placeholder="请输入数量..." value="" style="width: 100%;">';
  1176. str += '</div>';
  1177. str +=
  1178. '<label class="iwb-label col-md-2 control-label " for="remark" style="margin-top:10px;">备注</label>';
  1179. str += '<div class="col-md-4">';
  1180. str +=
  1181. '<input class="form-control" name="remark" type="text" placeholder="请输入..." value="" style="width: 100%;margin-top:10px">';
  1182. str += '</div>';
  1183. str += ' <div class="col-md-6" style="text-align:center;">';
  1184. str +=
  1185. ' <button type="button" class="btn btn-sm btn-danger" style="width:90%;margin-top:10px; " onclick="DeleteSendDateItem(this)">删除</button>';
  1186. str += ' </div>';
  1187. str += '</div>';
  1188. $("#modalChangeSendDate form").append(str);
  1189. $('.MapperItem:last .iwb-date').iwbDate({ language: window.lang });
  1190. }
  1191. function DeleteSendDateItem(that) {
  1192. var $item = $(that).closest('.MapperItem');
  1193. var $id = $item.find('input[name="id"]');
  1194. if ($id.val() > 0) {
  1195. abp.message.confirm("确认删除发货提醒?",
  1196. "删除发货提醒",
  1197. function() {
  1198. SaveAjax({
  1199. url: window.appUrl + "OrderItems/DeleteSendDateWarns?sendDateWarnId=" + $id.val(),
  1200. dataType: "json",
  1201. isAlert: false,
  1202. isValidate: false,
  1203. success: function(res) {
  1204. $item.remove();
  1205. }
  1206. });
  1207. });
  1208. } else {
  1209. $item.remove();
  1210. }
  1211. }
  1212. function getSendDateItemFormData() {
  1213. var d = {
  1214. orderItemNo: $("#orderItemNo3").val(),
  1215. oldSendDate: $("#oldSendDate").val(),
  1216. newSendDate: $("#newSendDate").val(),
  1217. sendDateWarns: []
  1218. };
  1219. var items = $('.MapperItem');
  1220. for (var i = 0; i < items.length; i++) {
  1221. if (!$('.MapperItem:eq(' + i + ') [name="planDate"]').val()) {
  1222. continue;
  1223. }
  1224. d.sendDateWarns[i] = {
  1225. Id: $('.MapperItem:eq(' + i + ') [name="id"]').val(),
  1226. PlanDate: $('.MapperItem:eq(' + i + ') [name="planDate"]').val(),
  1227. PlanQuantity: $('.MapperItem:eq(' + i + ') [name="planQuantity"]').val(),
  1228. Remark: $('.MapperItem:eq(' + i + ') [name="remark"]').val()
  1229. }
  1230. }
  1231. return d;
  1232. }
  1233. //分批发货提醒 2023-end
  1234. function StoreCompleteStateFormatter(v, r) {
  1235. var str = "";
  1236. if (v === 0) {
  1237. str = '<span class="label label-danger">货物不齐全</span>';
  1238. } else if (v === 1) {
  1239. str = '<span class="label label-success">货物已齐</span>';;
  1240. } else if (v === 2) {
  1241. str = '<span class="label label-success">货物已齐,待改包</span>';;
  1242. }
  1243. return str;
  1244. }
  1245. function PriceFormatter(v, r) {
  1246. var str = "0.00";
  1247. if (v && v > 0) {
  1248. v = (v * 10000) / 10000;
  1249. str = _formatAmount(v, 4);
  1250. }
  1251. str = '<span style="text-decoration:underline;color:red;" onclick="f_showChangePrice(' +
  1252. r.id +
  1253. ',' +
  1254. r.price +
  1255. ',' +
  1256. r.orderItemStatusId +
  1257. ')">' +
  1258. str +
  1259. ' ' +
  1260. r.currencyId +
  1261. '</span>';
  1262. return str;
  1263. }
  1264. function CurrencyPriceFormatter(v, r) {
  1265. var str = "0.00";
  1266. if (v && v > 0) {
  1267. v = (v * 10000) / 10000;
  1268. str = _formatAmount(v, 4);
  1269. }
  1270. str = '<span style="text-decoration:underline;color:red;">' +
  1271. str +
  1272. ' ' +
  1273. r.currencyId +
  1274. '</span>';
  1275. return str;
  1276. }
  1277. function TaxPriceFormatter(v, r) {
  1278. var str = "0.00";
  1279. if (v && v > 0) {
  1280. v = (v * 10000) / 10000;
  1281. str = _formatAmount(v, 4);
  1282. }
  1283. str = '<span style="text-decoration:underline;color:red;" onclick="f_showChangeAfterTaxPrice(' +
  1284. r.id +
  1285. ',' +
  1286. r.afterTaxPrice +
  1287. ',' +
  1288. r.orderItemStatusId +
  1289. ')">' +
  1290. str +
  1291. ' ' +
  1292. r.currencyId +
  1293. '</span>';
  1294. return str;
  1295. }
  1296. function f_showChangePrice(id, price, s) {
  1297. if (s != @OrderItemStatusEnum.NewCreate.ToInt() && s != @OrderItemStatusEnum.Audited.ToInt()) {
  1298. abp.message.warn("已发货(或已结束),不能操作!");
  1299. return;
  1300. }
  1301. $("#orderItemNo").val(id);
  1302. $("#oldPrice").val(price);
  1303. $("#newPrice").val("");
  1304. $("#modalChangePrice").modal("show");
  1305. }
  1306. function ChangePrice() {
  1307. var form = $("#modalChangePrice").find("form");
  1308. SaveAjax({
  1309. url: window.appUrl + "OrderItems/ChangePrice",
  1310. data: formUtil.Serialize(form),
  1311. modal: $("#modalChangePrice"),
  1312. dataType: "json",
  1313. isAlert: false,
  1314. isValidate: true,
  1315. success: function(res) {
  1316. if (res) {
  1317. RefreshOrderItemTable(res.orderNo);
  1318. $("#modalChangePrice").modal("hide");
  1319. }
  1320. }
  1321. });
  1322. }
  1323. function f_showChangeAfterTaxPrice(id, price, s) {
  1324. if (s != @OrderItemStatusEnum.NewCreate.ToInt() && s != @OrderItemStatusEnum.Audited.ToInt()) {
  1325. abp.message.warn("已发货(或已结束),不能操作!");
  1326. return;
  1327. }
  1328. $("#orderItemNo5").val(id);
  1329. if (price <= 0) {
  1330. price = 0;
  1331. }
  1332. $("#oldPrice2").val(price);
  1333. $("#newAfterTaxPrice").val("");
  1334. $("#modalChangeAfterTaxPrice").modal("show");
  1335. }
  1336. function ChangeAfterTaxPrice() {
  1337. var form = $("#modalChangeAfterTaxPrice").find("form");
  1338. SaveAjax({
  1339. url: window.appUrl + "OrderItems/ChangeAfterTaxPrice",
  1340. data: formUtil.Serialize(form),
  1341. modal: $("#modalChangeAfterTaxPrice"),
  1342. dataType: "json",
  1343. isAlert: false,
  1344. isValidate: true,
  1345. success: function(res) {
  1346. if (res) {
  1347. RefreshOrderItemTable(res.orderNo);
  1348. $("#modalChangeAfterTaxPrice").modal("hide");
  1349. }
  1350. }
  1351. });
  1352. }
  1353. function QuantityFormatter(v, r) {
  1354. var str = '<span style="text-decoration:underline;" onclick="f_showChangeQuantity(' +
  1355. r.id +
  1356. ',' +
  1357. r.quantity +
  1358. ',' +
  1359. r.orderItemStatusId +
  1360. ')">' +
  1361. v +
  1362. '</span>';
  1363. return str;
  1364. }
  1365. function f_showChangeQuantity(id, quantity, s) {
  1366. if (s != @OrderItemStatusEnum.NewCreate.ToInt() && s != @OrderItemStatusEnum.Audited.ToInt()) {
  1367. abp.message.warn("已发货(或已结束),不能操作!");
  1368. return;
  1369. }
  1370. $("#orderItemNo2").val(id);
  1371. $("#oldQuantity").val(quantity);
  1372. $("#newQuantity").val("");
  1373. $("#modalChangeQuantity").modal("show");
  1374. }
  1375. function ChangeQuantity() {
  1376. var form = $("#modalChangeQuantity").find("form");
  1377. SaveAjax({
  1378. url: window.appUrl + "OrderItems/ChangeQuantity",
  1379. data: formUtil.Serialize(form),
  1380. modal: $("#modalChangeQuantity"),
  1381. dataType: "json",
  1382. isAlert: false,
  1383. isValidate: true,
  1384. success: function(res) {
  1385. if (res) {
  1386. RefreshOrderItemTable(res.orderNo);
  1387. $("#modalChangeQuantity").modal("hide");
  1388. }
  1389. }
  1390. });
  1391. }
  1392. function TotalPriceFormatter(v, r) {
  1393. var str = "0.00";
  1394. if (v && v > 0) {
  1395. v = (v * 10000) / 10000;
  1396. str = _formatAmount(v, 4);
  1397. }
  1398. str = '<span style="text-decoration:underline;">' + str + '' + r.currencyId + '</span>';
  1399. return str;
  1400. }
  1401. function AllTotalPriceFormatter(data) {
  1402. console.log(data);
  1403. var count = 0;
  1404. var currencyId = "CNY";
  1405. data.forEach(function(e) {
  1406. currencyId = e.currencyId;
  1407. count += e.totalPrice;
  1408. });
  1409. if (count && count > 0) {
  1410. count = (count * 10000) / 10000;
  1411. count = _formatAmount(count, 4);
  1412. }
  1413. return '<strong>' + count + ' ' + currencyId + '<strong>';
  1414. }
  1415. function AllAfterTaxTotalPriceFormatter(data) {
  1416. var count = 0;
  1417. var currencyId = "CNY";
  1418. data.forEach(function(e) {
  1419. currencyId = e.currencyId;
  1420. count += e.afterTaxTotalPrice;
  1421. });
  1422. if (count && count > 0) {
  1423. count = (count * 10000) / 10000;
  1424. count = _formatAmount(count, 4);
  1425. }
  1426. return '<strong>' + count + currencyId + '<strong>';
  1427. }
  1428. function EmergencyLevelFormatter(v, r) {
  1429. let result = '';
  1430. var name = $('#hid-emergencyLevel option[value="' + v + '"]').text();
  1431. if (v === '1') {
  1432. result += '<span class="label label-success">' + name + '</span>';
  1433. } else {
  1434. result += '<span class="label label-danger">' + name + '</span>';
  1435. }
  1436. result +=
  1437. `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showProductProcess(${r.id
  1438. })">生产进度</span>`;
  1439. result += `<span class="label label-success" style="text-decoration:underline;margin-left:2px;" onclick="showSelectProductDialog('${r.productNo}')">产品查询</span>`;
  1440. return result;
  1441. }
  1442. function IsLockFormatter(v, r) {
  1443. if (v === 'Y') {
  1444. return '<span class="label label-danger">已删除</span>';
  1445. } else {
  1446. return '<span class="label label-success">-</span>';
  1447. }
  1448. }
  1449. //function StoreHouseIdFormatter(v,r) {
  1450. // var name = $("#hide-StoreHouses option[value='" + v + "']").text();
  1451. // return '<span class="label label-primary">' + name + '</span>';
  1452. // }
  1453. </script>
  1454. <script>
  1455. </script>
  1456. <script>
  1457. //将数字转换成金额显示 n是小数点后位数
  1458. function toNumber(num, n) {
  1459. var re = String(num);
  1460. var dotfront = "";
  1461. var dotlast = "";
  1462. if (re.indexof('.') > -1) {
  1463. var sarr = re.spilt('.');
  1464. dotfront = sarr[0];
  1465. dotlast = sarr[1];
  1466. var dotlastlength = strlen(dotlast);
  1467. if (dotlastlength < n) {
  1468. for (var j = 0; j < n - dotlastlength; j++) {
  1469. dotlast += "0";
  1470. }
  1471. }
  1472. if (dotlastlength > n) {
  1473. dotlast = dotlast.substr(0, n);
  1474. }
  1475. } else {
  1476. dotfront = re;
  1477. for (var i = 0; i < n; i++) {
  1478. dotlast += "0";
  1479. }
  1480. }
  1481. num = dotfront + '.' + dotlast;
  1482. return num;
  1483. }
  1484. function _formatAmount(strData, n) {
  1485. var CurrencyAndAmountRegExp =
  1486. /^(\d{1,18})|(\d{1,18}\.)|(\d{1,17}\.\d{0,1})|(\d{1,16}\.\d{0,2})|(\.\d{1,2})$/;
  1487. var _result = CurrencyAndAmountRegExp.test(strData);
  1488. if (_result == false) {
  1489. return strData;
  1490. } // 一般来说最多就6位吧,当然如果有特殊需求可自行更改(`・∀・´)
  1491. n = n > 0 && n <= 6 ? n : 2;
  1492. var formatData = parseFloat((strData + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '';
  1493. var l = formatData.split('.')[0].split('').reverse();
  1494. var r = formatData.split('.')[1];
  1495. var t = '';
  1496. for (i = 0; i < l.length; i++) {
  1497. t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? ',' : '');
  1498. }
  1499. return t.split('').reverse().join('') + '.' + r;
  1500. }
  1501. function strlen(str) {
  1502. var len = 0;
  1503. for (var i = 0; i < str.length; i++) {
  1504. var c = str.charCodeAt(i);
  1505. //单字节加1
  1506. if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
  1507. len++;
  1508. } else {
  1509. len += 2;
  1510. }
  1511. }
  1512. return len;
  1513. }
  1514. </script>
  1515. }
  1516. <section style="display: none">
  1517. <select id="hid-type">
  1518. <option value=""></option>
  1519. </select>
  1520. @Html.DropDownList("hid-emergencyLevel", emergencyLevelList);
  1521. @*@Html.DropDownList("hide-StoreHouses", storeHouses)*@
  1522. </section>