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" data-formatter="KgWeightFormatter">千件重</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. @Html.Partial("_ProductionOrderEx")
  162. }
  163. @section scripts
  164. {
  165. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  166. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  167. <script src="~/Content/Plugins/viewer/viewer.min.js"></script>
  168. <script src="~/Content/Plugins/PrintPreView/print-preView.js"></script>
  169. <script type="text/javascript">
  170. var datePickerOpt = {
  171. language: 'zh-CN',
  172. format: "yyyy-mm-dd",
  173. todayBtn: true,
  174. autoclose: true,
  175. startView: 2,
  176. minView: 2,
  177. maxView: 4
  178. //showSecond: true,
  179. //showHours: true,
  180. //minuteStep: 10
  181. };
  182. var isUpdate
  183. $(function () {
  184. //$("#planProduceDate").datetimepicker(datePickerOpt).on('show',
  185. // function (event) {
  186. // event.preventDefault();
  187. // event.stopPropagation();
  188. // }).on('hide',
  189. // function (event) {
  190. // event.preventDefault();
  191. // event.stopPropagation();
  192. // });
  193. //$("#KeyWords-7").datetimepicker(datePickerOpt);
  194. //$("#KeyWords-8").datetimepicker(datePickerOpt);
  195. //show完毕前执行
  196. LoadTable();
  197. //$("#print").printPreview({
  198. // printBody: "#modal"
  199. //});
  200. var funs = window.funs || { none: function () { console.log("No type"); } };
  201. funs["btnCreate"] = function () {
  202. $("#productionType").off("change.productionType").on("change.productionType", ChangeProductionType);
  203. $(".type2").css("display", "block");
  204. BtnCreate({
  205. readonly: "semiProductNo",
  206. disabled:
  207. "productionOrderNo,semiProductName,model,material,rigidity,surfaceColor,partNo,timeCreated",
  208. data: {
  209. productionOrderStatus: 1,
  210. productionType: "0",
  211. processingType: "1",
  212. processingLevel: "1",
  213. maxQuantity:"0"
  214. }
  215. });
  216. //abp.ajax({
  217. // url: window.appUrl + 'ProductionOrders/GetNewProductionOrderNo?isOutsourcing=0',
  218. // async: true,
  219. // type: "Post",
  220. // contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  221. // isValidate: false,
  222. // dataType: "json",
  223. // success: function (res) {
  224. // }
  225. //});
  226. }
  227. funs["btnUpdate"] = function () {
  228. var rows = config.table.bootstrapTable("getSelections");
  229. if (rows.length === 1)
  230. {
  231. console.log(rows[0]);
  232. if (rows[0].isLock == 'Y')
  233. {
  234. abp.message.warn("排产单已删除,不可进行更改!");
  235. return;
  236. }
  237. if (rows[0].productionOrderStatus > 2 && rows[0].productionOrderStatus !== 7)
  238. {
  239. abp.message.warn("排产单已审核或者生产入库,不可进行更改!");
  240. return;
  241. }
  242. $("#productionType").off("change.productionType");
  243. //$("#productionType").off("change.productionType").on("change.productionType", ChangeProductionType);
  244. if (rows[0].productionOrderStatus === 2) {
  245. $(".type2").css("display", "none");
  246. } else {
  247. $(".type2").css("display", "block");
  248. var no = rows[0].productionOrderNo.substr(2, 1).toUpperCase();
  249. var type1 = "GHWJKLMNOPQRT";
  250. //rows[0].productionType = "0";
  251. $(".type0").css("display", "block");
  252. $(".type1").css("display", "none");
  253. if (no && type1.indexOf(no) > -1) {
  254. //rows[0].productionType = "1";
  255. $(".type1").css("display", "block");
  256. $(".type0").css("display", "none");
  257. }
  258. }
  259. SaveAjax({
  260. url: window.appUrl + "Query/GetSingleSemiProduct?input=" + rows[0].semiProductNo,
  261. isAlert: false,
  262. isValidate: false,
  263. success: function(res) {
  264. var data = rows[0];
  265. console.log('data---',data)
  266. if (res) {
  267. data.model = res.model;
  268. data.partNo = res.partNo;
  269. data.material = res.material;
  270. data.rigidity = res.rigidity;
  271. data.surfaceColor = res.surfaceColor;
  272. }
  273. let isValidate = rows[0].productionOrderStatus !== 2;
  274. data.kgWeight = data.kgWeight == 0 ? "" : data.kgWeight;
  275. BtnUpdate({
  276. readonly: "semiProductNo",
  277. data: data,
  278. isValidate: isValidate,
  279. disabled:
  280. "productionOrderNo,model,material,rigidity,surfaceColor,productionType,partNo,timeCreated"
  281. });
  282. }
  283. });
  284. }
  285. };
  286. funs["btnDelete"] = function (url) {
  287. var rows = config.table.bootstrapTable("getSelections");
  288. if (rows.length === 1) {
  289. if (rows[0].isLock == 'Y') {
  290. abp.message.warn("排产单已删除,不可进行删除!");
  291. return;
  292. }
  293. if (rows[0].productionOrderStatus >= 2 && rows[0].productionOrderStatus !== 7) {
  294. abp.message.warn("排产单已生产,不可进行删除!");
  295. return;
  296. }
  297. BtnDelete(url);
  298. }
  299. };
  300. funs["btnExport"] = function (url) {
  301. var rows = config.table.bootstrapTable("getSelections");
  302. if (rows.length === 1) {
  303. if (rows[0].productionOrderStatus === 1) {
  304. abp.message.warn("排产单未确认审核,不可导出!");
  305. return;
  306. }
  307. SaveAjax({
  308. url: url,
  309. data: { Id: rows[0].id },
  310. isAlert: false,
  311. isValidate: false,
  312. success: function (res) {
  313. //console.log(res);
  314. RefreshTable();
  315. window.location.href = res;
  316. }
  317. });
  318. }
  319. // var rows = config.table.bootstrapTable("getSelections");
  320. };
  321. $("#Tool1").append(
  322. '<button type="button" class="btn btn-default menu-btn" onclick="f_changeOrderType()"><i class="iconfont icon-model"></i>修改排产单类型</button>'+
  323. '<div class="tool-radio"><input name="proType" type="radio" id="allProduction" checked value=""/><label for="allProduction">全部</label></div>' +
  324. '<div class="tool-radio"><input name="proType" type="radio" id="machineShop" value="0"/><label for="machineShop">车间加工</label></div>' +
  325. '<div class="tool-radio"><input name="proType" type="radio" id="outFinish" value="1"/><label for="outFinish">外购成品</label></div>' +
  326. '<div class="tool-radio"><input name="proType" type="radio" id="removalProcess" value="2"/><label for="removalProcess">去料加工</label></div>');
  327. $(".tool-radio input[type='radio']").on('click',
  328. function (e) {
  329. //var outType = $(this).val();
  330. document.getElementById("SearchForm").reset();
  331. GetSearchList();
  332. RefreshTable();
  333. });
  334. //$('input').on('ifChecked', function(event){ alert(event.type + ' callback'); });
  335. });
  336. function GetSearchList() {
  337. var count = $("#SearchForm").find(".KeyWords").length;
  338. window._searchList = [];
  339. window._searchList.push({ KeyWords: "1", KeyField: "ProcessingLevel", FieldType: "0", ExpType: "0" });
  340. var outType = $('input[name="proType"]:checked').val();
  341. if (outType) {
  342. window._searchList.push({
  343. KeyWords: outType,
  344. KeyField: "ProductionType",
  345. FieldType: "0",
  346. ExpType: "0"
  347. });
  348. }
  349. //if ($("#hiddenClose").is(':checked')) {
  350. // window._searchList.push({
  351. // KeyWords: "5",
  352. // KeyField: "productionOrderStatus",
  353. // FieldType: "1",
  354. // ExpType: "1"
  355. // });
  356. //}
  357. for (var i = 1; i <= count; i++) {
  358. var keyWords = $("#KeyWords-" + i).val();
  359. if (keyWords) {
  360. var keyField = $("#KeyField-" + i).val();
  361. var fieldType = $("#FieldType-" + i).val();
  362. var expType = $("#ExpType-" + i).val();
  363. //隐藏显示失效,移除状态查询条件
  364. //if (keyField === "productionOrderStatus") {
  365. // let pindex = _searchList.findIndex((v, i) => {
  366. // return v.KeyField === "productionOrderStatus";
  367. // });
  368. // if (pindex > -1) {
  369. // _searchList.splice(pindex, 1);
  370. // }
  371. //}
  372. _searchList.push({
  373. KeyWords: keyWords,
  374. KeyField: keyField,
  375. FieldType: fieldType,
  376. ExpType: expType
  377. });
  378. }
  379. }
  380. }
  381. function Submit_query_semiProduct_modal(row) {
  382. row = row || $query_semiProduct_modal_table.bootstrapTable("getSelections")[0];
  383. row = CheckIsExistAndGetNewProduct(row.id);
  384. if (row) {
  385. $(targetDom + ' #semiProductNo').val(row.id);
  386. $(targetDom + ' #KeyWords-9').val(row.id);
  387. $(targetDom + " #semiProductName").val(row.semiProductName);
  388. $(targetDom + " #model").val(row.model);
  389. $(targetDom + " #material").val(row.material);
  390. $(targetDom + " #surfaceColor").val(row.surfaceColor);
  391. $(targetDom + " #rigidity").val(row.rigidity);
  392. $("#query_semiProduct_modal").modal('hide');
  393. }
  394. }
  395. function CheckIsExistAndGetNewProduct(productNo) {
  396. let row;
  397. SaveAjax({
  398. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  399. isValidate: false,
  400. isAlert: false,
  401. async:false,
  402. success: function(res) {
  403. if (res) {
  404. let pNo = res.id;
  405. let reg = new RegExp(/^s.{13}/g);
  406. if (productNo !==pNo&&reg.test(pNo)) {
  407. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  408. }
  409. row = res;
  410. //$("#productNo").val(pNo);
  411. //$("#ProductName").val(res.productName);
  412. //$("#Model").val(res.model);
  413. //$("#Material").val(res.material);
  414. //$("#SurfaceColor").val(res.surfaceColor);
  415. //$("#Rigidity").val(res.rigidity);
  416. //$("#IsStandard").val(res.isStandard === "Y" ? "是" : "否");
  417. }
  418. }
  419. });
  420. return row;
  421. }
  422. </script>
  423. <script type="text/javascript">
  424. function f_changeOrderType() {
  425. var rows = config.table.bootstrapTable("getSelections");
  426. if (rows.length === 1) {
  427. if (rows[0].isLock == 'Y') {
  428. abp.message.warn("排产单已删除,不可进行更改!");
  429. return;
  430. }
  431. if (rows[0].productionOrderStatus > 1 && rows[0].productionOrderStatus !== 7) {
  432. abp.message.warn("排产单已审核或者生产入库,不可进行更改!");
  433. return;
  434. }
  435. var data = rows[0];
  436. OpenModal(window.appUrl + "ProductionOrders/UpdateProductionType",
  437. {
  438. data: data,
  439. modal: $("#changeTypeModal"),
  440. disabled:"productionOrderNo",
  441. success: function () { $("#changeTypeModal").modal("hide"); RefreshTable(); }
  442. });
  443. }
  444. }
  445. function ChangeProductionType() {
  446. var type = $("#productionType").val();
  447. abp.ajax({
  448. url: window.appUrl + 'ProductionOrders/GetNewProductionOrderNo?isOutsourcing=' + type,
  449. async: true,
  450. type: "Post",
  451. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  452. isValidate: false,
  453. dataType: "json",
  454. success: function (res) {
  455. $("#productionOrderNo").val(res);
  456. }
  457. });
  458. if (type === "0") {
  459. $(".type0").css("display", "block");
  460. $(".type1").css("display", "none");
  461. } else {
  462. $(".type1").css("display", "block");
  463. $(".type0").css("display", "none");
  464. }
  465. }
  466. function f_ExcuteProduction(id, status, row) {
  467. row = row || $("#table").bootstrapTable("getRowByUniqueId", id);
  468. if (row.productionOrderStatus === 5) {
  469. abp.message.warn("排产单已关闭,不可操作");
  470. return;
  471. }
  472. if (row.productionOrderStatus > 2 && row.productionOrderStatus !== 6 && row.productionOrderStatus !== 7) {
  473. abp.message.warn("排产单已进行入库,不可操作!(关闭入库申请后可操作)");
  474. return;
  475. }
  476. abp.message.confirm("确认变更排产单状态?",
  477. "排产单状态变更",
  478. function () {
  479. abp.ajax({
  480. url: window.appUrl + 'ProductionOrders/ChangeProductionOrderStatus',
  481. data: { Id: id, ProductionOrderStatus: status },
  482. async: true,
  483. type: "Post",
  484. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  485. isValidate: false,
  486. dataType: "json",
  487. success: function () {
  488. abp.message.success(abp.localization.localize("OpSuccess"));
  489. RefreshTable();
  490. }
  491. });
  492. });
  493. }
  494. </script>
  495. }