DisqualifiedSemiProduct.cshtml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. @using ShwasherSys
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Views.Shared.New.Modals
  5. @using ShwasherSys.Views.Shared.New.Table
  6. @{
  7. ViewBag.Title = "不合格半成品处理";
  8. string activeMenu = PermissionNames.PagesProductInspectDisqualifiedSemiProductMg; //The menu item will be active for this page.
  9. ViewBag.ActiveMenu = activeMenu;
  10. string storeHouse1 = ViewBag.StoreHouse1, storeHouse2 = ViewBag.StoreHouse2;
  11. List<SelectListItem> productType = new List<SelectListItem>()
  12. {
  13. new SelectListItem(){Value = ProductTypeDefinition.Semi+"",Text = @"半成品"},
  14. new SelectListItem(){Value = ProductTypeDefinition.Finish+"",Text = @"成品"},
  15. }, inspectType = new List<SelectListItem>()
  16. {
  17. new SelectListItem(){Value = DisProductStateDefinition.NormalReturn+"",Text = @"正常退货"},
  18. new SelectListItem(){Value = DisProductStateDefinition.Downgrade+"",Text = @"检验降级"},
  19. new SelectListItem(){Value = DisProductStateDefinition.Scrapped+"",Text = @"检验报废"},
  20. new SelectListItem(){Value = DisProductStateDefinition.AntiPlating+"",Text = @"返工反镀"},
  21. new SelectListItem(){Value = DisProductStateDefinition.OutPurchaseReturnGood+"",Text = @"外购退货"},
  22. new SelectListItem(){Value = DisProductStateDefinition.SpecialPurchase+"",Text = @"特采"},
  23. }, handleType = ViewBag.HandleType;
  24. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  25. {
  26. new SearchItem("disqualifiedNo","编号"),
  27. new SearchItem("productOrderNo","流转单号"),
  28. new SearchItem("productName","产品名称"),
  29. // new SearchItem("productType","产品类型",FiledType.I).SetSearchItem(productType),
  30. new SearchItem("handleType","处理类型",FiledType.I).SetSearchItem(handleType),
  31. });
  32. var table = new TableViewModel("/api/services/app/DisqualifiedProduct/GetAllDisqualifiedSemiProduct", activeMenu, searchForm)
  33. .SetFields(new List<FieldItem>()
  34. {
  35. new FieldItem("disqualifiedNo", "编号"),
  36. new FieldItem("productOrderNo", "流转单号"),
  37. new FieldItem("productNo", "产品编码"),
  38. new FieldItem("productName", "产品名称"),
  39. new FieldItem("model", "规格"),
  40. new FieldItem("productType", "产品类型","ProductTypeFormatter"),
  41. new FieldItem("quantityWeight", "产品数量(Kg)"),
  42. new FieldItem("kgWeight", "千件重"),
  43. new FieldItem("quantityPcs", "产品数量(千件)"),
  44. new FieldItem("handleType", "处理类型","HandleTypeFormatter"),
  45. new FieldItem("checkUser", "检验人员"),
  46. new FieldItem("checkDate", "检验时间","DateTimeFormatter"),
  47. new FieldItem("handleUser", "最后处理人"),
  48. new FieldItem("handleDate", "最后处理时间","DateTimeFormatter"),
  49. //new FieldItem("", "操作","ActionFormatter"),
  50. });
  51. }
  52. @section css{
  53. }
  54. @Html.Partial("New/Table/_Table", table)
  55. @section modal{
  56. <!--Main Modal-->
  57. @{
  58. var modal = new ModalViewModel("产品降级", "", new ModalBodyViewModel(new List<Input>()
  59. {
  60. new InputHide("id"),
  61. new Input("storeHouseId","仓库",other:"onchange=StoreHouseChange()").SetOuterBefore("<div class=\"col-sm-6\">").SetSelectOptions(""),
  62. new Input("storeLocationNo", "库位编号").SetSearchIcon("query_storeHouseLocation_modal","modal"),
  63. new Input("quantity", "入库数量",@class:"number",other:"min=0.001"),
  64. new Input("productName","产品名称").SetOuterBefore("<div class=\"p1\">").SetSearchIcon("query_Product_modal",".p1"),
  65. new InputHide("productNo").SetOuterAfter("</div>"),
  66. new Input("productName","产品名称").SetOuterBefore("<div class=\"p2\">").SetSearchIcon("query_semiProduct_modal",".p2"),
  67. new InputHide("productNo").SetOuterAfter("</div></div>"),
  68. new Input("custom-name-1","客户名称",@class:"custom-name").SetNotRequired().SetOuterBefore("<div class=\"col-sm-6\"><div class=\"customer-1\">").SetSearchIcon("query_customer_modal",".customer-1"),
  69. new InputHide("custom-id-1",@class:"custom-id",name:"customerNos").SetNotRequired().SetOuterAfter("</div>"),
  70. new Input("custom-name-2","客户名称",@class:"custom-name").SetNotRequired().SetOuterBefore("<div class=\"customer-2\">").SetSearchIcon("query_customer_modal",".customer-2"),
  71. new InputHide("custom-id-2",@class:"custom-id",name:"customerNos").SetNotRequired().SetOuterAfter("</div>"),
  72. new Input("custom-name-3","客户名称",@class:"custom-name").SetNotRequired().SetOuterBefore("<div class=\"customer-3\">").SetSearchIcon("query_customer_modal",".customer-3"),
  73. new InputHide("custom-id-3",@class:"custom-id",name:"customerNos").SetNotRequired().SetOuterAfter("</div></div>"),
  74. }),sizeClass:"lg",width:1000);
  75. var modal2 = new ModalViewModel("产品检验情况","",new ModalBodyViewModel(new List<Input>
  76. {
  77. new InputHide("id"),
  78. new InputHide("productType"),
  79. new Input("inspectType", "检验选项",other:"onchange=InspectTypeChange(this)").SetSelectOptions(inspectType),
  80. new Input("surveyReason", "调查情况",@class:"type type1").SetSelectOptions(new List<SelectListItem>(){
  81. new SelectListItem(){Text = @"人工原因",Value = "人工原因"},
  82. new SelectListItem(){Text = @"生产原因",Value = "生产原因"},
  83. new SelectListItem(){Text = @"外协原因",Value = "外协原因"},
  84. new SelectListItem(){Text = @"存放原因",Value = "存放原因"},
  85. new SelectListItem(){Text = @"其他原因",Value = "其他原因"},
  86. },true),
  87. new InputTextarea("surveyDetail", "调查原因",@class:"type type1"),
  88. new InputTextarea("solution", "解决办法",@class:"type type1"),
  89. new Input("storeHouseId","仓库",@class:"type type2",other:"onchange=StoreHouseChange2(this)").SetSelectOptions(storeHouse2),//成品仓库
  90. new Input("storeHouseId2","仓库",@class:"type type3",other:"onchange=StoreHouseChange2(this)").SetSelectOptions(storeHouse1),//半成品仓库
  91. new Input("storeLocationNo", "库位编号",@class:"type type2 type3").SetSearchIcon("query_storeHouseLocation_modal","return_modal"),
  92. new InputTextarea("SpecialPurchaseRemark", "特采备注",@class:"type type3"),
  93. }),"return_modal");
  94. var modal3 = new ModalViewModel("退货信息","",new ModalBodyViewModel(new List<Input>
  95. {
  96. new Input("returnOrderNo", "退货单号"),
  97. new Input("productNo", "产品编码"),
  98. new Input("productName", "产品名称"),
  99. new Input("model", "规格"),
  100. new Input("surfaceColor", "表色"),
  101. new Input("material", "材质"),
  102. new Input("rigidity", "硬度"),
  103. new InputTextarea("reason", "退货原因"),
  104. }),"returnInfo_modal");
  105. }
  106. @Html.Partial("New/Modals/_Modal", modal)
  107. @Html.Partial("New/Modals/_Modal", modal2)
  108. @Html.Partial("New/Modals/_Modal", modal3)
  109. @Html.Partial("Modals/Query/_Customer", ".custom-id,.custom-name")
  110. @Html.Partial("Modals/Query/_StoreHouseLocation", "storeHouseId,storeLocationNo")
  111. @Html.Partial("Modals/Query/_Product", "productNo,productName")
  112. @Html.Partial("Modals/Query/_SemiProduct", "productNo,productName")
  113. }
  114. @section scripts
  115. {
  116. <script type="text/javascript">
  117. var $table, productOrderNos = [];
  118. $(function() {
  119. LoadTable();
  120. var funs = window.funs || { none: function() { console.log("No type"); } };
  121. funs["btnCheckDowngrade"] = function(url) {
  122. var row = config.table.bootstrapTable("getSelections")[0];
  123. if (row) {
  124. if (row.handleType !== @(DisProductStateDefinition.NoHandle)) {
  125. abp.message.warn("该记录已处理,不能操作。");
  126. return;
  127. }
  128. $('#return_modal #inspectType option[value="@(DisProductStateDefinition.NormalReturn)"]')
  129. .prop("disabled", true);
  130. $('#return_modal #inspectType option[value="@(DisProductStateDefinition.OutPurchaseReturnGood)"]')
  131. .prop("disabled", true);
  132. $('#return_modal #inspectType option[value="@(DisProductStateDefinition.SpecialPurchase)"]')
  133. .prop("disabled", true);
  134. if (row.productType === @ProductTypeDefinition.Finish) {
  135. $('#return_modal #inspectType option[value="@(DisProductStateDefinition.NormalReturn)"]')
  136. .prop("disabled", false);
  137. }
  138. if (row.productType === @ProductTypeDefinition.Semi) {
  139. $(
  140. '#return_modal #inspectType option[value="@(DisProductStateDefinition.OutPurchaseReturnGood)"]')
  141. .prop("disabled", false);
  142. $('#return_modal #inspectType option[value="@(DisProductStateDefinition.SpecialPurchase)"]')
  143. .prop("disabled", false);
  144. }
  145. $('#return_modal .type').removeClass('required').closest('.form-group-sm').hide();
  146. OpenModal({
  147. modal: $('#return_modal'),
  148. data: row,
  149. disabled: "storeLocationNo",
  150. save: function() {
  151. SaveAjax({ url: url, modal: $('#return_modal'), isValidate: true });
  152. }
  153. });
  154. } else
  155. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  156. }
  157. funs["btnScrap"] = function(url) {
  158. var row = config.table.bootstrapTable("getSelections")[0];
  159. if (row) {
  160. if (row.handleType !== @(DisProductStateDefinition.NoHandle)) {
  161. abp.message.warn("该记录已处理,不能操作。");
  162. return;
  163. }
  164. abp.message.confirm("确认产品需要报废?",
  165. "产品报废",
  166. function() {
  167. ReturnOrder(url, row);
  168. });
  169. } else
  170. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  171. }
  172. funs["btnUnScrapped"] = function(url) {
  173. var row = config.table.bootstrapTable("getSelections")[0];
  174. if (row) {
  175. if (row.handleType !== @(DisProductStateDefinition.Scrapped)) {
  176. abp.message.warn("该记录未被确认报废,不能操作。");
  177. return;
  178. }
  179. abp.message.confirm("确认产品不需要报废?",
  180. "拒绝产品报废",
  181. function() {
  182. SaveAjax({ url: url, data: { Id: row.id }, isValidate: false });
  183. });
  184. } else
  185. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  186. }
  187. //降级使用
  188. funs["btnUseDowngrade"] = function(url) {
  189. var row = config.table.bootstrapTable("getSelections")[0];
  190. if (row) {
  191. if (row.handleType === @(DisProductStateDefinition.NoHandle)) {
  192. abp.message.warn("该记录未被检验处理,不能降级。");
  193. return;
  194. } else if (row.handleType === @(DisProductStateDefinition.DowngradeHandled) ||
  195. row.handleType === @(DisProductStateDefinition.ScrappedHandled)) {
  196. abp.message.warn("该记录已处理,不能降级。");
  197. return;
  198. } else if (row.handleType !== @(DisProductStateDefinition.Downgrade) &&
  199. row.handleType !== @(DisProductStateDefinition.ScrappedDowngrade)) {
  200. abp.message.warn("该记录未被确认降级,不能降级。");
  201. return;
  202. }
  203. UseDowngrade(row);
  204. OpenModal({
  205. url: url,
  206. modal: $('#modal'),
  207. disabled: "storeLocationNo,productName,custom-name-1,custom-name-2,custom-name-3",
  208. save: function() {
  209. var customerNos = [];
  210. $('.custom-id').each(function() {
  211. if ($(this).val()) {
  212. customerNos.push($(this).val());
  213. }
  214. });
  215. var storeHouseId = $('#storeHouseId').val();
  216. var storeLocationNo = $('#storeLocationNo').val();
  217. var storeHouseType = $('#storeHouseId option:selected').data('type');
  218. var productNo = $('.p' + storeHouseType + " #productNo").val();
  219. console.log("---", storeHouseType, productNo);
  220. var quantity = $('#quantity').val();
  221. if (!storeHouseId) {
  222. abp.message.warn("请选择一个仓库...");
  223. return;
  224. }
  225. if (!storeLocationNo) {
  226. abp.message.warn("请选择一个库位...");
  227. return;
  228. }
  229. //console.log({
  230. // Id: row.id,
  231. // CustomerNos: customerNos,
  232. // StoreHouseId: storeHouseId,
  233. // StoreLocationNo: storeLocationNo,
  234. // StoreHouseType:storeHouseType,
  235. // ProductNo:productNo,
  236. // ProductOrderNos:productOrderNos
  237. //});
  238. //return;
  239. SaveAjax({
  240. url: url,
  241. isValidate: false,
  242. data: {
  243. Id: row.id,
  244. CustomerNos: customerNos,
  245. StoreHouseId: storeHouseId,
  246. StoreLocationNo: storeLocationNo,
  247. StoreHouseType: storeHouseType,
  248. ProductNo: productNo,
  249. ProductOrderNos: productOrderNos,
  250. Quantity: quantity
  251. },
  252. success: function() {
  253. $('#modal').modal('hide');
  254. RefreshTable();
  255. }
  256. });
  257. }
  258. });
  259. } else
  260. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  261. }
  262. funs["btnConfirmScrapped"] = function(url) {
  263. var row = config.table.bootstrapTable("getSelections")[0];
  264. if (row) {
  265. if (row.handleType === @(DisProductStateDefinition.NoHandle)) {
  266. abp.message.warn("该记录未被检验处理,不能报废。");
  267. return;
  268. } else if (row.handleType === @(DisProductStateDefinition.DowngradeHandled) ||
  269. row.handleType === @(DisProductStateDefinition.ScrappedHandled)) {
  270. abp.message.warn("该记录未已处理,不能报废。");
  271. return;
  272. } else if (row.handleType !== @(DisProductStateDefinition.Scrapped)) {
  273. abp.message.warn("该记录未被确认报废,不能报废。");
  274. return;
  275. }
  276. abp.message.confirm("确认报废产品,产品存入报废仓库?",
  277. "报废产品",
  278. function() {
  279. SaveAjax({ url: url, data: { Id: row.id }, isValidate: false });
  280. });
  281. } else
  282. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  283. }
  284. funs["btnAntiPlating"] = function(url) {
  285. var row = config.table.bootstrapTable("getSelections")[0];
  286. if (row) {
  287. if (row.handleType !== @(DisProductStateDefinition.NoHandle)) {
  288. abp.message.warn("该记录已处理,不能操作。");
  289. return;
  290. }
  291. abp.message.confirm("确认反镀产品?",
  292. "确认反镀",
  293. function() {
  294. SaveAjax({ url: url, data: { Id: row.id }, isValidate: false });
  295. });
  296. } else
  297. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  298. }
  299. @*$("#Tool1").append(
  300. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType1" checked value=""/><label for="radioType1">全部</label></div>' +
  301. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType2" value="@(ProductTypeDefinition.Finish)"/><label for="radioType2">退货成品</label></div>' +
  302. '<div class="tool-radio"><input name="radioType" type="radio" id="radioType3" value="@(ProductTypeDefinition.Semi)"/><label for="radioType3">不合格半成品</label></div>');*@
  303. //$(".tool-radio input[type='radio']").on('click',
  304. // function() {
  305. // document.getElementById("SearchForm").reset();
  306. // GetSearchList();
  307. // RefreshTable();
  308. // });
  309. });
  310. function GetSearchList() {
  311. var count = $("#SearchForm").find(".KeyWords").length;
  312. window._searchList = [];
  313. //var radioType = $('input[name="radioType"]:checked').val();
  314. //if (radioType) {
  315. // window._searchList.push({ KeyWords: radioType, KeyField: "productType", FieldType: "1", ExpType: "0" });
  316. //}
  317. for (var i = 1; i <= count; i++) {
  318. var keyWords = $("#KeyWords-" + i).val();
  319. if (keyWords) {
  320. var keyField = $("#KeyField-" + i).val();
  321. var fieldType = $("#FieldType-" + i).val();
  322. var expType = $("#ExpType-" + i).val();
  323. window._searchList.push({
  324. KeyWords: keyWords,
  325. KeyField: keyField,
  326. FieldType: fieldType,
  327. ExpType: expType
  328. });
  329. }
  330. }
  331. }
  332. function ReturnOrder(url, row) {
  333. if (row.productType === @ProductTypeDefinition.Finish) {
  334. OpenModal({
  335. modal: $('#return_modal'),
  336. data: row,
  337. save: function() {
  338. SaveAjax({ url: url, modal: $('#return_modal'), isValidate: true });
  339. }
  340. });
  341. } else {
  342. SaveAjax({ url: url, data: { Id: row.id }, isValidate: false });
  343. }
  344. }
  345. </script>
  346. <script>
  347. function Submit_query_semiProduct_modal(row) {
  348. row = row || $query_semiProduct_modal_table.bootstrapTable("getSelections")[0];
  349. row = CheckIsExistAndGetNewProduct(row.id);
  350. if (row) {
  351. $(targetDom + ' #productNo').val(row.id);
  352. $(targetDom + ' #productName').val(row.semiProductName);
  353. $("#query_semiProduct_modal").modal('hide');
  354. }
  355. }
  356. function CheckIsExistAndGetNewProduct(productNo) {
  357. let row;
  358. SaveAjax({
  359. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  360. isValidate: false,
  361. isAlert: false,
  362. async:false,
  363. success: function(res) {
  364. if (res) {
  365. let pNo = res.id;
  366. let reg = new RegExp(/^s.{13}/g);
  367. if (productNo !==pNo&&reg.test(pNo)) {
  368. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  369. }
  370. row = res;
  371. }
  372. }
  373. });
  374. return row;
  375. }
  376. </script>
  377. <script>
  378. var $DowngradeBox = $('#Downgrade_box'), productTypeGlobal;
  379. function UseDowngrade(row) {
  380. var storeHouseStr = '<option value="">请选择仓库</option>';
  381. queryParams.storeHouseId = 0;
  382. $DowngradeBox.remove();
  383. productTypeGlobal = row.productType;
  384. if (row.handleType === @(DisProductStateDefinition.NormalReturn)) {
  385. $('#modal .custom-id').closest('.form-group-sm').hide();
  386. } else {
  387. $('#modal .custom-id').closest('.form-group-sm').show();
  388. }
  389. if (row.productType === @(ProductTypeDefinition.Semi)) {
  390. storeHouseStr += $('#hid-storeHouse1').html();
  391. $('.p1').hide();
  392. $('.p2').hide();
  393. } else if (row.productType === @(ProductTypeDefinition.Finish)) {
  394. storeHouseStr += '<optgroup label="成品仓库">';
  395. storeHouseStr += $('#hid-storeHouse2').html();
  396. storeHouseStr += '</optgroup>';
  397. storeHouseStr += '<optgroup label="半成品仓库">';
  398. storeHouseStr += $('#hid-storeHouse1').html();
  399. storeHouseStr += '</optgroup>';
  400. $('.p1').show();
  401. $('.p2').hide();
  402. $DowngradeBox = $(
  403. '<div id="Downgrade_box" ><button class="btn btn-info" type="button" style="width: 100%" onclick="QueryCurrentProduct(\'' +
  404. row.productOrderNo +
  405. '\')">查询关联产品,勾选降级</button><div class="table-box iwb-bootstrap-table" style="display:none"><table id="table-downgrade" data-method="post" data-side-pagination="server" data-cache="false" data-pagination="true" data-page-number="1" data-page-list="[10,25,50]" data-pagination-detail-h-align="right" data-pagination-h-align="left" data-click-to-select="true" data-single-select="false"><thead><tr>' +
  406. '<th data-field="state" data-checkbox="true"></th>' +
  407. '<th data-align="center" data-field="productOrderNo" data-sortable="true">排产单号</th>' +
  408. '<th data-align="center" data-field="productNo" data-sortable="true">产品编号</th>' +
  409. '<th data-align="center" data-field="productName" data-sortable="true">产品名称</th>' +
  410. '<th data-align="center" data-field="partNo" data-sortable="true">零件号</th>' +
  411. '<th data-align="center" data-field="model">规格</th>' +
  412. '<th data-align="center" data-field="material">材质</th>' +
  413. '<th data-align="center" data-field="surfaceColor">表色</th>' +
  414. '<th data-align="center" data-field="rigidity">硬度</th>' +
  415. //'<th data-align="center" data-field="">数量</th>' +
  416. '</tr></thead></table></div></div>');
  417. $('#modal .modal-body').append($DowngradeBox);
  418. }
  419. $('#storeHouseId').html(storeHouseStr).select2();
  420. }
  421. var storeHouseTypeGlobal;
  422. function StoreHouseChange() {
  423. queryParams.storeHouseId = $('#modal #storeHouseId').val();
  424. $("#storeLocationNo").val('');
  425. var storeHouseType = $('#modal #storeHouseId option:selected').data('type');
  426. storeHouseTypeGlobal = storeHouseType;
  427. var r = config.table.bootstrapTable("getSelections")[0];
  428. if (r.productType === @(ProductTypeDefinition.Semi)) {
  429. $('#modal .p1,#modal .p2').hide().find("#productNo").val('');
  430. } else {
  431. if (storeHouseTypeGlobal === 2) {
  432. $('#modal .p1,#modal .p2').hide().find("#productNo").val('');
  433. $('#modal .p2').show();
  434. }
  435. if (storeHouseTypeGlobal === 1) {
  436. $('#modal .p1,#modal .p2').hide().find("#productNo").val('');
  437. }
  438. }
  439. $('#modal .p1,#modal .p2').find("#productName").val('').prop('disabled', true);
  440. //if (productTypeGlobal === 2) {
  441. // $('#modal .p1,#modal .p2').hide().find("#productNo").val('');
  442. //} else if (storeHouseTypeGlobal !== storeHouseType) {
  443. // $('#modal .p1,#modal .p2').find("#productNo").val('');
  444. // $('#modal .p1,#modal .p2').find("#productName").val('').prop('disabled', true);
  445. //} else {
  446. // if (storeHouseType === 1) {//成品仓库
  447. // //$('#modal .p1').show();
  448. // $('#modal .p1').hide();
  449. // $('#modal .p2').hide();
  450. // } else if (storeHouseType ===2) {//半成品仓库
  451. // $('#modal .p2').show();
  452. // $('#modal .p1').hide();
  453. // }
  454. // $('#modal .p1,#modal .p2').find("#productName").val('').prop('disabled', true);
  455. //}
  456. }
  457. function InspectTypeChange(that) {
  458. var type = $(that).val();
  459. var productType = $("#return_modal #productType").val();
  460. $('#return_modal .type').removeClass('required').closest('.form-group-sm').hide();
  461. if (type === "@(DisProductStateDefinition.NormalReturn)") {
  462. $('#return_modal .type2').addClass('required').closest('.form-group-sm').show();
  463. } else if (productType === "@(ProductTypeDefinition.Finish)" &&
  464. (type === "@(DisProductStateDefinition.Downgrade)" || type === "@(DisProductStateDefinition.Scrapped)")
  465. ) {
  466. $('#return_modal .type1').addClass('required').closest('.form-group-sm').show();
  467. } else if (productType === "@(ProductTypeDefinition.Semi)" &&
  468. (type === "@(DisProductStateDefinition.SpecialPurchase)")
  469. ) {
  470. $('#return_modal .type3').addClass('required').closest('.form-group-sm').show();
  471. }
  472. }
  473. function StoreHouseChange2(that) {
  474. queryParams.storeHouseId = $(that).val();
  475. $("#return_modal #storeLocationNo").val('');
  476. }
  477. function QueryCurrentProduct(orderNo) {
  478. function downgradeCheck(row) {
  479. if ($.inArray(id, productOrderNos) === -1) {
  480. productOrderNos[productOrderNos.length] = row.productOrderNo;
  481. }
  482. }
  483. function downgradeUnCheck(row) {
  484. var index = $.inArray(row.productOrderNo, productOrderNos);
  485. if (index !== -1) {
  486. productOrderNos.splice(index, 1);
  487. downgradeUnCheck(row);
  488. }
  489. }
  490. function downgradeQueryParams(params) {
  491. var sorting = '';
  492. if (params.sort) {
  493. sorting = params.sort;
  494. if (params.order) {
  495. sorting += ' ' + params.order;
  496. }
  497. }
  498. return {
  499. MaxResultCount: params.limit,
  500. SkipCount: params.offset,
  501. Sorting: sorting,
  502. ProductOrderNo: orderNo
  503. }
  504. }
  505. function downgradeResponseHandler(res) {
  506. var data = ResponseHandler(res);
  507. $.each(data.rows,
  508. function(i, row) {
  509. //注意这里的row.id 中的id指的是列表的主键,替换成你使用的就行了比如 studentId等
  510. row.state = $.inArray(row.productOrderNo, productOrderNos) !== -1;
  511. });
  512. return data;
  513. }
  514. $('#table-downgrade').closest('.table-box').show();
  515. $('#table-downgrade').bootstrapTable("destroy");
  516. LoadTable({
  517. table: $('#table-downgrade'),
  518. url: abp.appUrl + 'DisqualifiedProduct/QueryRelatedProductionOrderPage?productOrderNo=' + orderNo,
  519. queryParams: downgradeQueryParams,
  520. responseHandler: downgradeResponseHandler,
  521. onCheck: downgradeCheck,
  522. onUncheck: downgradeUnCheck,
  523. onCheckAll: function(r1) {
  524. $.each(r1,
  525. function(i, v) {
  526. downgradeCheck(v);
  527. });
  528. },
  529. onUncheckAll: function(r1) {
  530. $.each(r1,
  531. function(i, v) {
  532. downgradeUnCheck(v);
  533. });
  534. },
  535. onLoadSuccess: function(data) {
  536. OnLoadSuccess(data, $('#table-downgrade'));
  537. var topHeight = $(window).height() - $('#modal').find('.modal-dialog').height() - 50;
  538. if (topHeight < 30) {
  539. topHeight = 30;
  540. }
  541. $('#modal').find('.modal-dialog').animate({ 'marginTop': topHeight / 2 + "px" });
  542. }
  543. });
  544. }
  545. function showReturnInfo(id) {
  546. SaveAjax(
  547. {
  548. url: abp.appUrl + 'DisqualifiedProduct/GetReturnOrderInfo?no=' + id,
  549. isValidate: false,
  550. isAlert:false,
  551. success: function (res) {
  552. if (res) {
  553. OpenModal({
  554. modal: $('#returnInfo_modal'),
  555. data: res,
  556. });
  557. $('#returnInfo_modal').find('.modal-footer .save-btn').fadeOut();
  558. }
  559. }
  560. }
  561. );
  562. }
  563. </script>
  564. <!--格式化-->
  565. <script id="formatter-script" type="text/javascript">
  566. function ProductTypeFormatter(v, r) {
  567. var name = $('#hid-productType option[value="' + v + '"]').text();
  568. let returnInfo = `<a href="#" class="btn btn-info" onclick="showReturnInfo('${r.id}')">退货信息</a>`;
  569. switch (v) {
  570. case 2:
  571. return '<span class="label label-success">' + name + '</span>' ;
  572. case 1:
  573. return '<span class="label label-danger">' + name + '</span>&nbsp;' + returnInfo;
  574. default:
  575. return '<span class="label label-success">' + name + '</span>';
  576. }
  577. }
  578. function HandleTypeFormatter(v) {
  579. var name = $('#hid-handleType option[value="' + v + '"]').text();
  580. switch (v) {
  581. case 1:
  582. return '<span class="label label-info">' + name + '</span>';
  583. case 2:
  584. return '<span class="label label-warning">' + name + '</span>';
  585. case 3:
  586. return '<span class="label label-danger">' + name + '</span>';
  587. case 4:
  588. return '<span class="label label-primary">' + name + '</span>';
  589. case 8:
  590. return '<span class="label label-iwb">' + name + '</span>';
  591. default:
  592. return '<span class="label label-success">' + name + '</span>';
  593. }
  594. }
  595. function TypeFormatter(v) {
  596. var name = $('#hid-type option[value="' + v + '"]').text();
  597. switch (v) {
  598. case 0:
  599. return '<span class="label label-danger">' + name + '</span>';
  600. default:
  601. return '<span class="label label-info">' + name + '</span>';
  602. }
  603. }
  604. </script>
  605. }
  606. <section style="display: none">
  607. <select id="hid-storeHouse1">
  608. @Html.Raw(storeHouse1)
  609. </select>
  610. <select id="hid-storeHouse2">
  611. @Html.Raw(storeHouse2)
  612. </select>
  613. @Html.DropDownList("hid-productType", productType)
  614. @Html.DropDownList("hid-handleType", handleType)
  615. </section>