ProductionOrderMg.cshtml 23 KB

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