OrderStatusMg.cshtml 71 KB

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