ProductionOrderMg.cshtml 23 KB

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