ProductionOrderMg.cshtml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. @using Abp.Authorization
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.BasicInfo
  4. @using ShwasherSys.Models.Layout
  5. @using ShwasherSys.Models.Modal
  6. @{
  7. /**/
  8. ViewBag.ActiveMenu = PermissionNames.PagesProductionInfoProductionOrderMg; //The menu item will be active for this page.
  9. ViewBag.Title = "排产单信息维护";
  10. List<SelectListItem> productionType = new List<SelectListItem>
  11. {
  12. new SelectListItem{Text = @"车间生产",Value = "0"},
  13. new SelectListItem{Text = @"外购成品",Value = "1"},
  14. new SelectListItem{Text = @"去料加工",Value = "2"},
  15. };
  16. List<SelectListItem> handleType = new List<SelectListItem>
  17. {
  18. new SelectListItem{Text = @"导出",Value = "1"},
  19. new SelectListItem{Text = @"确认导出",Value = "2"},
  20. };
  21. List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  22. List<SelectListItem> productionOrderStatus = ViewBag.ProductionOrderStatus;
  23. List<SelectListItem> employee = ViewBag.Employee;
  24. List<SelectListItem> storeHouses = ViewBag.StoreHouses;
  25. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  26. {
  27. new SearchItem("productionOrderNo","排产单号"),
  28. new SearchItem("partNo","零件号"),
  29. new SearchItem("semiProductName","半成品名称"),
  30. new SearchItem("model","规格"),
  31. new SearchItem("material","材质"),
  32. new SearchItem("remark","备注" ),
  33. new SearchItem("planProduceDate","计划完成时间",FiledType.Dnull,ExpType.GreaterOrEqual),
  34. new SearchItem("planProduceDate","至",FiledType.Dnull,ExpType.LessOrEqual),
  35. new SearchItem("semiProductNo","半成品编码").SetSearchIcon("query_semiProduct_modal"),
  36. new SearchItem("productionOrderStatus","排产状态" ,FiledType.I).SetSearchItem(productionOrderStatus),
  37. }, false);
  38. }
  39. @section css{
  40. <link href="~/Content/Plugins/viewer/viewer.min.css" rel="stylesheet" />
  41. @*<link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />*@
  42. <style>
  43. .tool-radio {
  44. display: inline-block;
  45. margin-left: 10px;
  46. }
  47. .tool-radio [type="radio"]:not(:checked) + label, [type="radio"]:checked + label {
  48. padding-left: 25px;
  49. font-size: 1.5rem;
  50. color: #dad9db;
  51. }
  52. .tool-radio [type="radio"]:not(:checked) + label::before, [type="radio"]:not(:checked) + label::after {
  53. border: 2px solid #fff;
  54. }
  55. </style>
  56. }
  57. <div class="table-box mr-4 iwb-bootstrap-table">
  58. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  59. <table id="table"
  60. data-url="/api/services/app/ProductionOrders/GetAll"
  61. data-striped="true" data-id-field="id" data-unique-id="id"
  62. data-method="post"
  63. data-side-pagination="server"
  64. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  65. data-cache="false"
  66. 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"
  67. data-query-params="QueryParams"
  68. data-response-handler="ResponseHandler"
  69. data-click-to-select="true"
  70. data-single-select="true">
  71. <thead>
  72. <tr class="row" id="header">
  73. <th data-field="state" data-checkbox="true"></th>
  74. <th data-align="center" data-field="productionOrderNo">排产单号</th>
  75. <th data-align="center" data-field="partNo">零件号</th>
  76. <th data-align="center" data-field="semiProductName">名称</th>
  77. <th data-align="center" data-field="model">规格</th>
  78. <th data-align="center" data-field="quantity">排产数量(千件)</th>
  79. <th data-align="center" data-field="timeCreated">创建时间</th>
  80. <th data-align="center" data-field="productionOrderStatus" data-formatter="ProductionOrderStatusFormatter">生产状态</th>
  81. <th data-align="center" data-field="remark">备注</th>
  82. <th data-align="center" data-field="material">材质</th>
  83. <th data-align="center" data-field="surfaceColor">表色</th>
  84. <th data-align="center" data-field="rigidity">硬度</th>
  85. @*<th data-align="center" data-field="stoveNo">炉号</th>
  86. <th data-align="center" data-field="carNo">车号</th>*@
  87. <th data-align="center" data-field="kgWeight">千件重</th>
  88. <th data-align="center" data-field="planProduceDate" data-formatter="PlanDateFormatter">计划完成时间</th>
  89. <th data-align="center" data-field="enterDate" data-formatter="DateFormatter">入库时间</th>
  90. <th data-align="center" data-field="semiProductNo" data-formatter="SemiProductNoFormatter">半成品编码</th>
  91. <th data-align="center" data-formatter="ActionFormatter">操作</th>
  92. </tr>
  93. </thead>
  94. </table>
  95. </div>
  96. @section modal{
  97. <section>
  98. <!--Main Modal-->
  99. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  100. <div class="modal-dialog modal-dialog-centered" role="document">
  101. <div class="modal-content">
  102. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("排产单"))
  103. @{
  104. var inputs = new List<InputViewModel>
  105. {
  106. new InputViewModel("id", hide:true),
  107. new InputViewModel("productionOrderNo",displayName:"流转单编号").SetOuterBefore("<div class=\"type2\">"),
  108. new InputViewModel("semiProductNo", displayName: "半成品编码").SetSearchIcon("query_semiProduct_modal","#modal"),
  109. new InputViewModel("quantity", displayName:"生产数量",@class:"number",other:"min=0.001"),
  110. new InputViewModel("maxQuantity", displayName:"最大生产数量",@class:"number",other:"min=0.001"),
  111. new InputViewModel("planProduceDate", displayName:"计划完成时间",@class:"iwb-date"),
  112. new InputViewModel("productionType",InputTypes.List, "排产单类型").SetSelectOptions(productionType),
  113. new InputViewModel("kgWeight",displayName:"千件重",@class:"number",other:"min=0.001").SetNotRequired(),
  114. new InputViewModel("stoveNo", displayName:"炉号").SetNotRequired().SetOuterBefore("<div class=\"type0\">"),
  115. new InputViewModel("carNo",displayName:"车号").SetNotRequired().SetOuterAfter("</div></div>"),
  116. //new InputViewModel("OutsourceNo", displayName:"外购单号").SetNotRequired().SetOuterBefore("<div class=\"type1\">").SetOuterAfter("</div>"),
  117. new InputViewModel("remark",InputTypes.Textarea,"备注").SetNotRequired(),
  118. new InputViewModel("semiProductName", displayName: "半成品名称").SetNotRequired().SetOuterBefore("<div class=\"type2\">"),
  119. new InputViewModel("model", displayName: "规格").SetNotRequired(),
  120. new InputViewModel("partNo", displayName: "零件号").SetNotRequired(),
  121. new InputViewModel("material", displayName: "材质").SetNotRequired(),
  122. new InputViewModel("rigidity", displayName: "硬度").SetNotRequired(),
  123. new InputViewModel("surfaceColor", displayName: "表色").SetNotRequired(),
  124. //new InputViewModel("kgWeight", displayName: "千件重").SetNotRequired(),
  125. new InputViewModel("timeCreated", displayName: "创建时间").SetNotRequired().SetOuterAfter("</div>"),
  126. new InputViewModel("productionOrderStatus",hide:true),
  127. new InputViewModel("processingType",hide:true),
  128. new InputViewModel("processingLevel",hide:true),
  129. };
  130. //var specials = new List<SpecialInputModel>();
  131. }
  132. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  133. @Html.Partial("Modals/_ModalFooter", "0")
  134. </div>
  135. </div>
  136. </div>
  137. <div class="modal fade" id="changeTypeModal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  138. <div class="modal-dialog modal-dialog-centered" role="document">
  139. <div class="modal-content">
  140. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("变更排产单类型", ""))
  141. @{
  142. var inputs3 = new List<InputViewModel>
  143. {
  144. //new InputViewModel("currentProductStoreHouseNo", hide:true),
  145. new InputViewModel("id", hide:true),
  146. new InputViewModel("productionOrderNo", displayName: "流转单号"),
  147. new InputViewModel("productionType",InputTypes.List, "排产单类型").SetSelectOptions(productionType),
  148. };
  149. }
  150. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs3))
  151. @Html.Partial("Modals/_ModalFooter", "0")
  152. </div>
  153. </div>
  154. </div>
  155. </section>
  156. @Html.Partial("Modals/Query/_SemiProduct", "semiProductNo|KeyWords-9")
  157. @{
  158. List<SelectListItem>[] arr = new List<SelectListItem>[4] { employee, storeHouses, applyStatus, productionOrderStatus };
  159. }
  160. @Html.Partial("_EnterStoreShare", arr)
  161. }
  162. @section scripts
  163. {
  164. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  165. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  166. <script src="~/Content/Plugins/viewer/viewer.min.js"></script>
  167. <script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>
  168. <script type="text/javascript">
  169. var datePickerOpt = {
  170. language: 'zh-CN',
  171. format: "yyyy-mm-dd",
  172. todayBtn: true,
  173. autoclose: true,
  174. startView: 2,
  175. minView: 2,
  176. maxView: 4
  177. //showSecond: true,
  178. //showHours: true,
  179. //minuteStep: 10
  180. };
  181. var isUpdate
  182. $(function () {
  183. //$("#planProduceDate").datetimepicker(datePickerOpt).on('show',
  184. // function (event) {
  185. // event.preventDefault();
  186. // event.stopPropagation();
  187. // }).on('hide',
  188. // function (event) {
  189. // event.preventDefault();
  190. // event.stopPropagation();
  191. // });
  192. //$("#KeyWords-7").datetimepicker(datePickerOpt);
  193. //$("#KeyWords-8").datetimepicker(datePickerOpt);
  194. //show完毕前执行
  195. LoadTable();
  196. //$("#print").printPreview({
  197. // printBody: "#modal"
  198. //});
  199. var funs = window.funs || { none: function () { console.log("No type"); } };
  200. funs["btnCreate"] = function () {
  201. $("#productionType").off("change.productionType").on("change.productionType", ChangeProductionType);
  202. $(".type2").css("display", "block");
  203. BtnCreate({
  204. readonly: "semiProductNo",
  205. disabled:
  206. "productionOrderNo,semiProductName,model,material,rigidity,surfaceColor,partNo,timeCreated",
  207. data: {
  208. productionOrderStatus: 1,
  209. productionType: "0",
  210. processingType: "1",
  211. processingLevel: "1",
  212. maxQuantity:"0"
  213. }
  214. });
  215. //abp.ajax({
  216. // url: window.appUrl + 'ProductionOrders/GetNewProductionOrderNo?isOutsourcing=0',
  217. // async: true,
  218. // type: "Post",
  219. // contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  220. // isValidate: false,
  221. // dataType: "json",
  222. // success: function (res) {
  223. // }
  224. //});
  225. }
  226. funs["btnUpdate"] = function () {
  227. var rows = config.table.bootstrapTable("getSelections");
  228. if (rows.length === 1)
  229. {
  230. console.log(rows[0].productionOrderStatus);
  231. if (rows[0].isLock == 'Y')
  232. {
  233. abp.message.warn("排产单已删除,不可进行更改!");
  234. return;
  235. }
  236. if (rows[0].productionOrderStatus > 2 && rows[0].productionOrderStatus !== 7)
  237. {
  238. abp.message.warn("排产单已审核或者生产入库,不可进行更改!");
  239. return;
  240. }
  241. $("#productionType").off("change.productionType");
  242. //$("#productionType").off("change.productionType").on("change.productionType", ChangeProductionType);
  243. if (rows[0].productionOrderStatus === 2) {
  244. $(".type2").css("display", "none");
  245. } else {
  246. $(".type2").css("display", "block");
  247. var no = rows[0].productionOrderNo.substr(2, 1).toUpperCase();
  248. var type1 = "GHIJKLMNOPQRT";
  249. rows[0].productionType = "0";
  250. $(".type0").css("display", "block");
  251. $(".type1").css("display", "none");
  252. if (no && type1.indexOf(no) > -1) {
  253. rows[0].productionType = "1";
  254. $(".type1").css("display", "block");
  255. $(".type0").css("display", "none");
  256. }
  257. }
  258. SaveAjax({
  259. url: window.appUrl + "Query/GetSingleSemiProduct?input=" + rows[0].semiProductNo,
  260. isAlert: false,
  261. isValidate: false,
  262. success: function(res) {
  263. var data = rows[0];
  264. if (res) {
  265. data.model = res.model;
  266. data.partNo = res.partNo;
  267. data.material = res.material;
  268. data.rigidity = res.rigidity;
  269. data.surfaceColor = res.surfaceColor;
  270. }
  271. let isValidate = rows[0].productionOrderStatus !== 2;
  272. data.kgWeight = data.kgWeight == 0 ? "" : data.kgWeight;
  273. BtnUpdate({
  274. readonly: "semiProductNo",
  275. data: data,
  276. isValidate: isValidate,
  277. disabled:
  278. "productionOrderNo,model,material,rigidity,surfaceColor,productionType,partNo,timeCreated"
  279. });
  280. }
  281. });
  282. }
  283. };
  284. funs["btnDelete"] = function (url) {
  285. var rows = config.table.bootstrapTable("getSelections");
  286. if (rows.length === 1) {
  287. if (rows[0].isLock == 'Y') {
  288. abp.message.warn("排产单已删除,不可进行删除!");
  289. return;
  290. }
  291. if (rows[0].productionOrderStatus >= 2 && rows[0].productionOrderStatus !== 7) {
  292. abp.message.warn("排产单已生产,不可进行删除!");
  293. return;
  294. }
  295. BtnDelete(url);
  296. }
  297. };
  298. funs["btnExport"] = function (url) {
  299. var rows = config.table.bootstrapTable("getSelections");
  300. if (rows.length === 1) {
  301. if (rows[0].productionOrderStatus === 1) {
  302. abp.message.warn("排产单未确认审核,不可导出!");
  303. return;
  304. }
  305. SaveAjax({
  306. url: url,
  307. data: { Id: rows[0].id },
  308. isAlert: false,
  309. isValidate: false,
  310. success: function (res) {
  311. //console.log(res);
  312. RefreshTable();
  313. window.location.href = res;
  314. }
  315. });
  316. }
  317. // var rows = config.table.bootstrapTable("getSelections");
  318. };
  319. $("#Tool1").append(
  320. '<button type="button" class="btn btn-default menu-btn" onclick="f_changeOrderType()"><i class="iconfont icon-model"></i>修改排产单类型</button>'+
  321. '<div class="tool-radio"><input name="proType" type="radio" id="allProduction" checked value=""/><label for="allProduction">全部</label></div>' +
  322. '<div class="tool-radio"><input name="proType" type="radio" id="machineShop" value="0"/><label for="machineShop">车间加工</label></div>' +
  323. '<div class="tool-radio"><input name="proType" type="radio" id="outFinish" value="1"/><label for="outFinish">外购成品</label></div>' +
  324. '<div class="tool-radio"><input name="proType" type="radio" id="removalProcess" value="2"/><label for="removalProcess">去料加工</label></div>');
  325. $(".tool-radio input[type='radio']").on('click',
  326. function (e) {
  327. //var outType = $(this).val();
  328. document.getElementById("SearchForm").reset();
  329. GetSearchList();
  330. RefreshTable();
  331. });
  332. //$('input').on('ifChecked', function(event){ alert(event.type + ' callback'); });
  333. });
  334. function GetSearchList() {
  335. var count = $("#SearchForm").find(".KeyWords").length;
  336. window._searchList = [];
  337. window._searchList.push({ KeyWords: "1", KeyField: "ProcessingLevel", FieldType: "0", ExpType: "0" });
  338. var outType = $('input[name="proType"]:checked').val();
  339. if (outType) {
  340. window._searchList.push({
  341. KeyWords: outType,
  342. KeyField: "ProductionType",
  343. FieldType: "0",
  344. ExpType: "0"
  345. });
  346. }
  347. //if ($("#hiddenClose").is(':checked')) {
  348. // window._searchList.push({
  349. // KeyWords: "5",
  350. // KeyField: "productionOrderStatus",
  351. // FieldType: "1",
  352. // ExpType: "1"
  353. // });
  354. //}
  355. for (var i = 1; i <= count; i++) {
  356. var keyWords = $("#KeyWords-" + i).val();
  357. if (keyWords) {
  358. var keyField = $("#KeyField-" + i).val();
  359. var fieldType = $("#FieldType-" + i).val();
  360. var expType = $("#ExpType-" + i).val();
  361. //隐藏显示失效,移除状态查询条件
  362. //if (keyField === "productionOrderStatus") {
  363. // let pindex = _searchList.findIndex((v, i) => {
  364. // return v.KeyField === "productionOrderStatus";
  365. // });
  366. // if (pindex > -1) {
  367. // _searchList.splice(pindex, 1);
  368. // }
  369. //}
  370. _searchList.push({
  371. KeyWords: keyWords,
  372. KeyField: keyField,
  373. FieldType: fieldType,
  374. ExpType: expType
  375. });
  376. }
  377. }
  378. }
  379. function Submit_query_semiProduct_modal(row) {
  380. row = row || $query_semiProduct_modal_table.bootstrapTable("getSelections")[0];
  381. row = CheckIsExistAndGetNewProduct(row.id);
  382. if (row) {
  383. $(targetDom + ' #semiProductNo').val(row.id);
  384. $(targetDom + ' #KeyWords-9').val(row.id);
  385. $(targetDom + " #semiProductName").val(row.semiProductName);
  386. $(targetDom + " #model").val(row.model);
  387. $(targetDom + " #material").val(row.material);
  388. $(targetDom + " #surfaceColor").val(row.surfaceColor);
  389. $(targetDom + " #rigidity").val(row.rigidity);
  390. $("#query_semiProduct_modal").modal('hide');
  391. }
  392. }
  393. function CheckIsExistAndGetNewProduct(productNo) {
  394. let row;
  395. SaveAjax({
  396. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  397. isValidate: false,
  398. isAlert: false,
  399. async:false,
  400. success: function(res) {
  401. if (res) {
  402. let pNo = res.id;
  403. let reg = new RegExp(/^s.{13}/g);
  404. if (productNo !==pNo&&reg.test(pNo)) {
  405. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  406. }
  407. row = res;
  408. //$("#productNo").val(pNo);
  409. //$("#ProductName").val(res.productName);
  410. //$("#Model").val(res.model);
  411. //$("#Material").val(res.material);
  412. //$("#SurfaceColor").val(res.surfaceColor);
  413. //$("#Rigidity").val(res.rigidity);
  414. //$("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  415. }
  416. }
  417. });
  418. return row;
  419. }
  420. </script>
  421. <script type="text/javascript">
  422. function f_changeOrderType() {
  423. var rows = config.table.bootstrapTable("getSelections");
  424. if (rows.length === 1) {
  425. if (rows[0].isLock == 'Y') {
  426. abp.message.warn("排产单已删除,不可进行更改!");
  427. return;
  428. }
  429. if (rows[0].productionOrderStatus > 1 && rows[0].productionOrderStatus !== 7) {
  430. abp.message.warn("排产单已审核或者生产入库,不可进行更改!");
  431. return;
  432. }
  433. var data = rows[0];
  434. OpenModal(window.appUrl + "ProductionOrders/UpdateProductionType",
  435. {
  436. data: data,
  437. modal: $("#changeTypeModal"),
  438. disabled:"productionOrderNo",
  439. success: function () { $("#changeTypeModal").modal("hide"); RefreshTable(); }
  440. });
  441. }
  442. }
  443. function ChangeProductionType() {
  444. var type = $("#productionType").val();
  445. abp.ajax({
  446. url: window.appUrl + 'ProductionOrders/GetNewProductionOrderNo?isOutsourcing=' + type,
  447. async: true,
  448. type: "Post",
  449. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  450. isValidate: false,
  451. dataType: "json",
  452. success: function (res) {
  453. $("#productionOrderNo").val(res);
  454. }
  455. });
  456. if (type === "0") {
  457. $(".type0").css("display", "block");
  458. $(".type1").css("display", "none");
  459. } else {
  460. $(".type1").css("display", "block");
  461. $(".type0").css("display", "none");
  462. }
  463. }
  464. function f_ExcuteProduction(id, status, row) {
  465. row = row || $("#table").bootstrapTable("getRowByUniqueId", id);
  466. if (row.productionOrderStatus === 5) {
  467. abp.message.warn("排产单已关闭,不可操作");
  468. return;
  469. }
  470. if (row.productionOrderStatus > 2 && row.productionOrderStatus !== 6 && row.productionOrderStatus !== 7) {
  471. abp.message.warn("排产单已进行入库,不可操作!(关闭入库申请后可操作)");
  472. return;
  473. }
  474. abp.message.confirm("确认变更排产单状态?",
  475. "排产单状态变更",
  476. function () {
  477. abp.ajax({
  478. url: window.appUrl + 'ProductionOrders/ChangeProductionOrderStatus',
  479. data: { Id: id, ProductionOrderStatus: status },
  480. async: true,
  481. type: "Post",
  482. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  483. isValidate: false,
  484. dataType: "json",
  485. success: function () {
  486. abp.message.success(abp.localization.localize("OpSuccess"));
  487. RefreshTable();
  488. }
  489. });
  490. });
  491. }
  492. </script>
  493. }