RePlatingOutStoreApplyMg.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. @using IwbZero.AppServiceBase
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Models.Modal
  5. @{
  6. /**/
  7. ViewBag.ActiveMenu = PermissionNames.PagesProductionInfoRePlatingOutStoreApplyMg; //The menu item will be active for this page.
  8. ViewBag.Title = "改镀出库申请";
  9. List<SelectListItem> processTypeItems = ViewBag.ProcessTypeItems;
  10. List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  11. List<SelectListItem> storeHouses = ViewBag.StoreHouses;
  12. List<SelectListItem> closeStatus = new List<SelectListItem>()
  13. {
  14. new SelectListItem(){Text = @"未关闭",Value = "false",Selected = true},
  15. new SelectListItem(){Text = @"已关闭",Value = "true"}
  16. };
  17. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  18. {
  19. new SearchItem("productionOrderNo","排产单号"),
  20. new SearchItem("applyStatus","申请状态" )
  21. .SetSearchItem(applyStatus),
  22. new SearchItem("isClose","关闭状态" ,FiledType.Bnull,ExpType.Equal)
  23. .SetSearchItem(closeStatus),
  24. new SearchItem("productNo","成品编码").SetSearchIcon("query_Product_modal"),
  25. }, false);
  26. }
  27. @section css{
  28. <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  29. }
  30. <section style="display: none">
  31. @Html.DropDownList("hide-ApplyStatus", applyStatus)
  32. @Html.DropDownList("hide-StoreHouses", storeHouses)
  33. </section>
  34. <div class="table-box mr-4 iwb-bootstrap-table">
  35. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  36. <table id="table"
  37. data-url="/api/services/app/ProductionOrders/GetRePlatingOutStoreApply"
  38. data-striped="true" data-id-field="id" data-unique-id="id"
  39. data-method="post"
  40. data-side-pagination="server"
  41. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  42. data-cache="false"
  43. 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"
  44. data-query-params="QueryParams"
  45. data-response-handler="ResponseHandler"
  46. data-click-to-select="true"
  47. data-single-select="true">
  48. <thead>
  49. <tr class="row" id="header">
  50. <th data-field="state" data-checkbox="true"></th>
  51. <th data-align="center" data-field="productionOrderNo">排产单号</th>
  52. <th data-align="center" data-field="productNo">成品编码</th>
  53. <th data-align="center" data-field="productName">半成品名称</th>
  54. <th data-align="center" data-field="quantity">申请出库数量(kg)</th>
  55. <th data-align="center" data-field="actualQuantity">出库数量(kg)</th>
  56. <th data-align="center" data-field="storeHouseId" data-formatter="StoreHouseIdFormatte">仓库</th>
  57. <th data-align="center" data-field="applyStatus" data-formatter="ApplyStatusFormatter">申请状态</th>
  58. <th data-align="center" data-field="applyOutDate">申请时间</th>
  59. <th data-align="center" data-field="surfaceColor">表色</th>
  60. <th data-align="center" data-field="model">规格</th>
  61. <th data-align="center" data-field="rigidity">硬度</th>
  62. <th data-align="center" data-field="material">材质</th>
  63. <th data-align="center" data-formatter="ActionFormatter">操作</th>
  64. </tr>
  65. </thead>
  66. </table>
  67. </div>
  68. @section modal{
  69. <section>
  70. <!--CreateProductionOrder Modal-->
  71. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  72. <div class="modal-dialog modal-dialog-centered" role="document">
  73. <div class="modal-content">
  74. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("确认收货并创建外协流转单", ""))
  75. @{
  76. var inputs2 = new List<InputViewModel>
  77. {
  78. new InputViewModel("outStoreId",hide:true),
  79. new InputViewModel("outsourcingFactory",hide:true),
  80. new InputViewModel("sourceProductionOrderNo",displayName:"源流转单号").SetDisabled(),
  81. new InputViewModel("processingType",InputTypes.List,displayName:"加工类别").SetSelectOptions(processTypeItems),
  82. new InputViewModel("outsourcingFactoryName",displayName:"外协厂商").SetSearchIcon("query_outFactory_modal"),
  83. new InputViewModel("processingTypeNo",displayName:"外协编码",@class:"outCode" ),
  84. new InputViewModel("planProduceDate",displayName:"计划完成日期" ),
  85. //new InputViewModel("eaCurrentSemiStoreHouseNo", hide:true),
  86. //new InputViewModel("eaSemiProductNo", displayName:"半成品编码").SetDisabled().SetInterBefore(" <div class=\"input-group\">").SetInterAfter("<div class=\"input-group-addon\" style=\"padding: 1px 12px\" onclick=\"showSelectSemiProductDialog()\" > <i class=\"iconfont icon-search\"></i></div></div>"),
  87. new InputViewModel("semiProductNo", displayName:"半成品编码").SetSearchIcon("query_semiProduct_modal","#modal"),
  88. new InputViewModel("quantity", displayName:"加工数量",@class:"number",other:"min=0.001"),
  89. new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),
  90. new InputViewModel("semiProductName", displayName:"半成品名称").SetDisabled(),
  91. new InputViewModel("model", displayName:"规格").SetDisabled(),
  92. new InputViewModel("material", displayName:"材质").SetDisabled(),
  93. new InputViewModel("rigidity", displayName:"硬度").SetDisabled(),
  94. new InputViewModel("surfaceColor", displayName:"表色").SetDisabled(),
  95. };
  96. //var specials = new List<SpecialInputModel>();
  97. }
  98. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs2, "CreateProductionOrderForm"))
  99. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modal", "Submitcreateorder()"))
  100. </div>
  101. </div>
  102. </div>
  103. </section>
  104. @Html.Partial("Modals/Query/_SemiProduct", "semiProductNo,semiProductName,model,material,surfaceColor,rigidity")
  105. @*@Html.Partial("Modals/Query/_SemiProductEx", "eaSemiProductNo")*@
  106. @Html.Partial("Modals/Query/_OutFactory", "outsourcingFactory,outsourcingFactoryName")
  107. @Html.Partial("Modals/Query/_Product", "KeyWords-4")
  108. }
  109. @section scripts
  110. {
  111. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  112. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  113. <script type="text/javascript">
  114. // 外协编码验证
  115. jQuery.validator.addMethod("outCode",
  116. function(value, element) {
  117. //var tel = /^[a-zA-Z0-9]{2}$/;
  118. var tel = /^[0-9]{2}$/;
  119. return this.optional(element) || (tel.test(value));
  120. },
  121. "外协编码为两位数字");
  122. var datePickerOpt = {
  123. language: 'zh-CN',
  124. format: "yyyy-mm-dd",
  125. todayBtn: true,
  126. autoclose: true,
  127. startView: 2,
  128. minView: 2,
  129. maxView: 4
  130. //showSecond: true,
  131. //showHours: true,
  132. //minuteStep: 10
  133. };
  134. $(function() {
  135. $("#planProduceDate").datetimepicker(datePickerOpt).on('show',
  136. function(event) {
  137. event.preventDefault();
  138. event.stopPropagation();
  139. }).on('hide',
  140. function(event) {
  141. event.preventDefault();
  142. event.stopPropagation();
  143. });
  144. $("#KeyWords-3").val("false").select2();
  145. LoadTable();
  146. var funs = window.funs || { none: function() { console.log("No type"); } };
  147. });
  148. function f_createProductionOrder(id, preOrderNo) {
  149. $("#outStoreId").val(id);
  150. $("#sourceProductionOrderNo").val(preOrderNo);
  151. $("#processingTypeNo").val("");
  152. $("#modal").modal("show");
  153. }
  154. function Submitcreateorder() {
  155. SaveAjax({
  156. url: window.appUrl + "ProductionOrders/CreateOutProductionOrder",
  157. data: {
  158. IsReplating: 1,
  159. OutStoreId: $("#outStoreId").val(),
  160. sourceProductionOrderNo: $("#sourceProductionOrderNo").val(),
  161. processingTypeNo: $("#processingTypeNo").val(),
  162. outsourcingFactory: $("#outsourcingFactory").val(),
  163. processingType: $("#processingType").val(),
  164. Quantity: $("#quantity").val(),
  165. SemiProductNo: $("#semiProductNo").val(),
  166. planProduceDate: $("#planProduceDate").val(),
  167. Remark: $('#modal #remark').val()
  168. },
  169. modal: $("#modal"),
  170. isAlert: false,
  171. success: function(res) {
  172. if (res) {
  173. abp.message.success("外协流转单创建成功,前往外协生产维护中查看信息!").done(function() {
  174. window.location.href = "@Url.Action("OutProductionOrderMg", "ProductionInfo")";
  175. });
  176. $("#modal").modal("hide");
  177. RefreshTable();
  178. }
  179. }
  180. });
  181. }
  182. function f_RefuseApply(id) {
  183. //console.log("cancef_RefuseApplylApply", id);
  184. abp.message.confirm("确认取消返镀申请?",
  185. "取消返镀",
  186. function() {
  187. abp.ajax({
  188. url: window.appUrl + 'ProductionOrders/CancelFinishOutStoreApply',
  189. data: { Id: id }, // ProductionOrderStatus: 4
  190. async: true,
  191. type: "Post",
  192. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  193. isValidate: false,
  194. dataType: "json",
  195. success: function() {
  196. abp.message.success(abp.localization.localize("OpSuccess"));
  197. RefreshTable();
  198. }
  199. });
  200. });
  201. }
  202. function f_ExportApply(id)
  203. {
  204. console.log(id)
  205. SaveAjax({
  206. url: window.appUrl + "ProductionOrders/RePlatingExportApply",
  207. data: {
  208. Id: id
  209. },
  210. modal: $("#modal"),
  211. isAlert: false,
  212. isValidate: false,
  213. success: function(res) {
  214. if (res) {
  215. window.location.href = "/" + res;
  216. }
  217. }
  218. });
  219. }
  220. function Submit_query_semiProduct_modal(row) {
  221. row = row || $query_semiProduct_modal_table.bootstrapTable("getSelections")[0];
  222. row = CheckIsExistAndGetNewProduct(row.id);
  223. if (row) {
  224. $(targetDom + ' #semiProductNo').val(row.id);
  225. $(targetDom + " #semiProductName").val(row.productName);
  226. $(targetDom + " #model").val(row.model);
  227. $(targetDom + " #material").val(row.material);
  228. $(targetDom + " #surfaceColor").val(row.surfaceColor);
  229. $(targetDom + " #rigidity").val(row.rigidity);
  230. $("#query_semiProduct_modal").modal('hide');
  231. }
  232. }
  233. function CheckIsExistAndGetNewProduct(productNo) {
  234. let row;
  235. SaveAjax({
  236. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  237. isValidate: false,
  238. isAlert: false,
  239. async:false,
  240. success: function(res) {
  241. if (res) {
  242. let pNo = res.id;
  243. let reg = new RegExp(/^s.{13}/g);
  244. if (productNo !==pNo&&reg.test(pNo)) {
  245. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  246. }
  247. row = res;
  248. //$("#productNo").val(pNo);
  249. //$("#ProductName").val(res.productName);
  250. //$("#Model").val(res.model);
  251. //$("#Material").val(res.material);
  252. //$("#SurfaceColor").val(res.surfaceColor);
  253. //$("#Rigidity").val(res.rigidity);
  254. //$("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  255. }
  256. }
  257. });
  258. return row;
  259. }
  260. </script>
  261. <script id="formatter">
  262. function StoreHouseIdFormatte(v) {
  263. var name = $("#hide-StoreHouses option[value='" + v + "']").text();
  264. return '<span class="label label-primary">' + name + '</span>';
  265. }
  266. function ApplyStatusFormatter(v, r) {
  267. if (r.isClose) {
  268. return '<span class="label label-primary">已结束</span>';
  269. }
  270. var name = $("#hide-ApplyStatus option[value='" + v + "']").text();
  271. if (v === "1") {
  272. return '<span class="label label-default">' + name + '</span>';
  273. } else if (v === "2") {
  274. return '<span class="label label-success">' + name + '</span>';
  275. } else if (v === "3") {
  276. return '<span class="label label-warning">' + name + '</span>';
  277. } else if (v === "4") {
  278. return '<span class="label label-danger">' + name + '</span>';
  279. }
  280. return '<span class="label label-info">' + name + '</span>';
  281. }
  282. function ActionFormatter(v, r) {
  283. var str = '<span class="table-action">暂无操作</span>';;
  284. if (!r.isConfirm && !r.isClose) { //&&r.applyOutStoreSourceTypeFormatter===5
  285. str = `<span class="table-action" onclick="f_createProductionOrder(\'${r.id
  286. }\',\'${r.productionOrderNo}\')"><i class="iconfont icon-right"></i>返镀创建流转单</span>`;
  287. str += `<span class="table-action" onclick="f_RefuseApply(\'${r.id
  288. }\')"><i class="iconfont icon-right"></i>拒绝返镀</span>`;
  289. str += `<span class="table-action" onclick="f_ExportApply(\'${r.id
  290. }\')"><i class="iconfont icon-right"></i>导出返镀申请</span>`;
  291. }
  292. return str;
  293. }
  294. </script>
  295. }