ProductionOrderMg.cshtml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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]);
  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 = "GHWJKLMNOPQRT";
  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. console.log('data---',data)
  265. if (res) {
  266. data.model = res.model;
  267. data.partNo = res.partNo;
  268. data.material = res.material;
  269. data.rigidity = res.rigidity;
  270. data.surfaceColor = res.surfaceColor;
  271. }
  272. let isValidate = rows[0].productionOrderStatus !== 2;
  273. data.kgWeight = data.kgWeight == 0 ? "" : data.kgWeight;
  274. BtnUpdate({
  275. readonly: "semiProductNo",
  276. data: data,
  277. isValidate: isValidate,
  278. disabled:
  279. "productionOrderNo,model,material,rigidity,surfaceColor,productionType,partNo,timeCreated"
  280. });
  281. }
  282. });
  283. }
  284. };
  285. funs["btnDelete"] = function (url) {
  286. var rows = config.table.bootstrapTable("getSelections");
  287. if (rows.length === 1) {
  288. if (rows[0].isLock == 'Y') {
  289. abp.message.warn("排产单已删除,不可进行删除!");
  290. return;
  291. }
  292. if (rows[0].productionOrderStatus >= 2 && rows[0].productionOrderStatus !== 7) {
  293. abp.message.warn("排产单已生产,不可进行删除!");
  294. return;
  295. }
  296. BtnDelete(url);
  297. }
  298. };
  299. funs["btnExport"] = function (url) {
  300. var rows = config.table.bootstrapTable("getSelections");
  301. if (rows.length === 1) {
  302. if (rows[0].productionOrderStatus === 1) {
  303. abp.message.warn("排产单未确认审核,不可导出!");
  304. return;
  305. }
  306. SaveAjax({
  307. url: url,
  308. data: { Id: rows[0].id },
  309. isAlert: false,
  310. isValidate: false,
  311. success: function (res) {
  312. //console.log(res);
  313. RefreshTable();
  314. window.location.href = res;
  315. }
  316. });
  317. }
  318. // var rows = config.table.bootstrapTable("getSelections");
  319. };
  320. $("#Tool1").append(
  321. '<button type="button" class="btn btn-default menu-btn" onclick="f_changeOrderType()"><i class="iconfont icon-model"></i>修改排产单类型</button>'+
  322. '<div class="tool-radio"><input name="proType" type="radio" id="allProduction" checked value=""/><label for="allProduction">全部</label></div>' +
  323. '<div class="tool-radio"><input name="proType" type="radio" id="machineShop" value="0"/><label for="machineShop">车间加工</label></div>' +
  324. '<div class="tool-radio"><input name="proType" type="radio" id="outFinish" value="1"/><label for="outFinish">外购成品</label></div>' +
  325. '<div class="tool-radio"><input name="proType" type="radio" id="removalProcess" value="2"/><label for="removalProcess">去料加工</label></div>');
  326. $(".tool-radio input[type='radio']").on('click',
  327. function (e) {
  328. //var outType = $(this).val();
  329. document.getElementById("SearchForm").reset();
  330. GetSearchList();
  331. RefreshTable();
  332. });
  333. //$('input').on('ifChecked', function(event){ alert(event.type + ' callback'); });
  334. });
  335. function GetSearchList() {
  336. var count = $("#SearchForm").find(".KeyWords").length;
  337. window._searchList = [];
  338. window._searchList.push({ KeyWords: "1", KeyField: "ProcessingLevel", FieldType: "0", ExpType: "0" });
  339. var outType = $('input[name="proType"]:checked').val();
  340. if (outType) {
  341. window._searchList.push({
  342. KeyWords: outType,
  343. KeyField: "ProductionType",
  344. FieldType: "0",
  345. ExpType: "0"
  346. });
  347. }
  348. //if ($("#hiddenClose").is(':checked')) {
  349. // window._searchList.push({
  350. // KeyWords: "5",
  351. // KeyField: "productionOrderStatus",
  352. // FieldType: "1",
  353. // ExpType: "1"
  354. // });
  355. //}
  356. for (var i = 1; i <= count; i++) {
  357. var keyWords = $("#KeyWords-" + i).val();
  358. if (keyWords) {
  359. var keyField = $("#KeyField-" + i).val();
  360. var fieldType = $("#FieldType-" + i).val();
  361. var expType = $("#ExpType-" + i).val();
  362. //隐藏显示失效,移除状态查询条件
  363. //if (keyField === "productionOrderStatus") {
  364. // let pindex = _searchList.findIndex((v, i) => {
  365. // return v.KeyField === "productionOrderStatus";
  366. // });
  367. // if (pindex > -1) {
  368. // _searchList.splice(pindex, 1);
  369. // }
  370. //}
  371. _searchList.push({
  372. KeyWords: keyWords,
  373. KeyField: keyField,
  374. FieldType: fieldType,
  375. ExpType: expType
  376. });
  377. }
  378. }
  379. }
  380. function Submit_query_semiProduct_modal(row) {
  381. row = row || $query_semiProduct_modal_table.bootstrapTable("getSelections")[0];
  382. row = CheckIsExistAndGetNewProduct(row.id);
  383. if (row) {
  384. $(targetDom + ' #semiProductNo').val(row.id);
  385. $(targetDom + ' #KeyWords-9').val(row.id);
  386. $(targetDom + " #semiProductName").val(row.semiProductName);
  387. $(targetDom + " #model").val(row.model);
  388. $(targetDom + " #material").val(row.material);
  389. $(targetDom + " #surfaceColor").val(row.surfaceColor);
  390. $(targetDom + " #rigidity").val(row.rigidity);
  391. $("#query_semiProduct_modal").modal('hide');
  392. }
  393. }
  394. function CheckIsExistAndGetNewProduct(productNo) {
  395. let row;
  396. SaveAjax({
  397. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  398. isValidate: false,
  399. isAlert: false,
  400. async:false,
  401. success: function(res) {
  402. if (res) {
  403. let pNo = res.id;
  404. let reg = new RegExp(/^s.{13}/g);
  405. if (productNo !==pNo&&reg.test(pNo)) {
  406. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  407. }
  408. row = res;
  409. //$("#productNo").val(pNo);
  410. //$("#ProductName").val(res.productName);
  411. //$("#Model").val(res.model);
  412. //$("#Material").val(res.material);
  413. //$("#SurfaceColor").val(res.surfaceColor);
  414. //$("#Rigidity").val(res.rigidity);
  415. //$("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  416. }
  417. }
  418. });
  419. return row;
  420. }
  421. </script>
  422. <script type="text/javascript">
  423. function f_changeOrderType() {
  424. var rows = config.table.bootstrapTable("getSelections");
  425. if (rows.length === 1) {
  426. if (rows[0].isLock == 'Y') {
  427. abp.message.warn("排产单已删除,不可进行更改!");
  428. return;
  429. }
  430. if (rows[0].productionOrderStatus > 1 && rows[0].productionOrderStatus !== 7) {
  431. abp.message.warn("排产单已审核或者生产入库,不可进行更改!");
  432. return;
  433. }
  434. var data = rows[0];
  435. OpenModal(window.appUrl + "ProductionOrders/UpdateProductionType",
  436. {
  437. data: data,
  438. modal: $("#changeTypeModal"),
  439. disabled:"productionOrderNo",
  440. success: function () { $("#changeTypeModal").modal("hide"); RefreshTable(); }
  441. });
  442. }
  443. }
  444. function ChangeProductionType() {
  445. var type = $("#productionType").val();
  446. abp.ajax({
  447. url: window.appUrl + 'ProductionOrders/GetNewProductionOrderNo?isOutsourcing=' + type,
  448. async: true,
  449. type: "Post",
  450. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  451. isValidate: false,
  452. dataType: "json",
  453. success: function (res) {
  454. $("#productionOrderNo").val(res);
  455. }
  456. });
  457. if (type === "0") {
  458. $(".type0").css("display", "block");
  459. $(".type1").css("display", "none");
  460. } else {
  461. $(".type1").css("display", "block");
  462. $(".type0").css("display", "none");
  463. }
  464. }
  465. function f_ExcuteProduction(id, status, row) {
  466. row = row || $("#table").bootstrapTable("getRowByUniqueId", id);
  467. if (row.productionOrderStatus === 5) {
  468. abp.message.warn("排产单已关闭,不可操作");
  469. return;
  470. }
  471. if (row.productionOrderStatus > 2 && row.productionOrderStatus !== 6 && row.productionOrderStatus !== 7) {
  472. abp.message.warn("排产单已进行入库,不可操作!(关闭入库申请后可操作)");
  473. return;
  474. }
  475. abp.message.confirm("确认变更排产单状态?",
  476. "排产单状态变更",
  477. function () {
  478. abp.ajax({
  479. url: window.appUrl + 'ProductionOrders/ChangeProductionOrderStatus',
  480. data: { Id: id, ProductionOrderStatus: status },
  481. async: true,
  482. type: "Post",
  483. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  484. isValidate: false,
  485. dataType: "json",
  486. success: function () {
  487. abp.message.success(abp.localization.localize("OpSuccess"));
  488. RefreshTable();
  489. }
  490. });
  491. });
  492. }
  493. </script>
  494. }