ProductionOutStoreApplyMg.cshtml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. @using IwbZero.AppServiceBase
  2. @using ShwasherSys.Authorization.Permissions
  3. @using ShwasherSys.Models.Layout
  4. @using ShwasherSys.Models.Modal
  5. @{
  6. /**/
  7. ViewBag.ActiveMenu = PermissionNames.PagesProductionInfoProductionOutStoreApplyMg; //The menu item will be active for this page.
  8. ViewBag.Title = "外协加工出库申请";
  9. List<SelectListItem> processTypeItems = ViewBag.ProcessTypeItems;
  10. List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
  11. List<SelectListItem> storeHouses = ViewBag.StoreHouses;
  12. List<SelectListItem> closeStatus = new List<SelectListItem>()
  13. {
  14. new SelectListItem(){Text = @"未关闭",Value = "false",Selected = true},
  15. new SelectListItem(){Text = @"已关闭",Value = "true"}
  16. };
  17. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  18. {
  19. new SearchItem("productionOrderNo","排产单号"),
  20. new SearchItem("semiProductNo","半成品编码").SetSearchIcon("query_semiProduct_modal"),
  21. new SearchItem("applyStatus","申请状态" )
  22. .SetSearchItem(applyStatus),
  23. new SearchItem("isClose","关闭状态" ,FiledType.Bnull,ExpType.Equal)
  24. .SetSearchItem(closeStatus)
  25. }, false);
  26. }
  27. @section css{
  28. <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
  29. }
  30. <section style="display: none">
  31. @Html.DropDownList("hide-ApplyStatus", applyStatus)
  32. @Html.DropDownList("hide-StoreHouses", storeHouses)
  33. </section>
  34. <div class="table-box mr-4 iwb-bootstrap-table">
  35. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  36. <table id="table"
  37. data-url="/api/services/app/ProductionOrders/GetSemiOutStoreApply"
  38. data-striped="true" data-id-field="id" data-unique-id="id"
  39. data-method="post"
  40. data-side-pagination="server"
  41. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  42. data-cache="false"
  43. 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"
  44. data-query-params="QueryParams"
  45. data-response-handler="ResponseHandler"
  46. data-click-to-select="true"
  47. data-single-select="true">
  48. <thead>
  49. <tr class="row" id="header">
  50. <th data-field="state" data-checkbox="true"></th>
  51. <th data-align="center" data-field="productionOrderNo">排产单号</th>
  52. <th data-align="center" data-field="semiProductNo">半成品编码</th>
  53. <th data-align="center" data-field="semiProductName">半成品名称</th>
  54. <th data-align="center" data-field="quantity">申请出库数量(kg)</th>
  55. <th data-align="center" data-field="actualQuantity">出库数量(kg)</th>
  56. <th data-align="center" data-field="storeHouseId" data-formatter="StoreHouseIdFormatte">仓库</th>
  57. <th data-align="center" data-field="applyStatus" data-formatter="ApplyStatusFormatter">申请状态</th>
  58. <th data-align="center" data-field="applyOutDate">申请时间</th>
  59. <th data-align="center" data-field="surfaceColor">表色</th>
  60. <th data-align="center" data-field="model">规格</th>
  61. <th data-align="center" data-field="rigidity">硬度</th>
  62. <th data-align="center" data-field="material">材质</th>
  63. <th data-align="center" data-field="partNo">零件号</th>
  64. <th data-align="center" data-field="remark">备注</th>
  65. <th data-align="center" data-formatter="ActionFormatter">操作</th>
  66. </tr>
  67. </thead>
  68. </table>
  69. </div>
  70. @section modal{
  71. <section>
  72. <!--Main Modal-->
  73. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  74. <div class="modal-dialog modal-dialog-centered" role="document">
  75. <div class="modal-content">
  76. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("出库申请"))
  77. @{
  78. var inputs = new List<InputViewModel>
  79. {
  80. new InputViewModel("id", hide:true),
  81. new InputViewModel("maxQuantity", hide:true),
  82. new InputViewModel("productionOrderNo",displayName:"源流转单号").SetSearchIcon("query_semiCurrentStore_modal"),
  83. new InputViewModel("currentSemiStoreHouseNo", hide:true),
  84. new InputViewModel("semiProductNo", displayName:"半成品编码"),
  85. new InputViewModel("quantity", displayName:"申请数量",@class:"number",other:"min=0.001"),
  86. new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),
  87. //new InputViewModel("surfaceColor", displayName: "表色").SetNotRequired(),
  88. //new InputViewModel("model", displayName: "规格").SetNotRequired(),
  89. //new InputViewModel("rigidity", displayName: "硬度").SetNotRequired(),
  90. //new InputViewModel("material", displayName: "材质").SetNotRequired(),
  91. //new InputViewModel("kgWeight", displayName: "千件重").SetNotRequired(),
  92. new InputViewModel("applyStatus",hide:true),
  93. new InputViewModel("applyOutStoreSource",hide:true),
  94. new InputViewModel("canUserQuantity",hide:true),
  95. new InputViewModel("storeHouseId",hide:true),
  96. };
  97. //var specials = new List<SpecialInputModel>();
  98. }
  99. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  100. @Html.Partial("Modals/_ModalFooter", "0")
  101. </div>
  102. </div>
  103. </div>
  104. </section>
  105. @{
  106. List<MultiSearchDto> searchListDto = new List<MultiSearchDto>();
  107. searchListDto.Add(new MultiSearchDto()
  108. {
  109. ExpType = 1,
  110. FieldType = 1,
  111. KeyWords = "4",
  112. KeyField = "StoreHouseId"
  113. });
  114. }
  115. @Html.Partial("Modals/Query/_SemiCurrentStoreEx", new QueryParamModel(targetDom: "6:quantity|maxQuantity", searchList: searchListDto))
  116. <section>
  117. <!--CreateProductionOrder Modal-->
  118. <div class="modal fade" id="modalCreateProductionOrder" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  119. <div class="modal-dialog modal-dialog-centered" role="document">
  120. <div class="modal-content">
  121. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("确认收货并创建外协流转单", ""))
  122. @{
  123. var inputs2 = new List<InputViewModel>
  124. {
  125. new InputViewModel("outStoreId",hide:true),
  126. new InputViewModel("outsourcingFactory",hide:true),
  127. new InputViewModel("sourceProductionOrderNo",displayName:"源流转单号").SetDisabled(),
  128. new InputViewModel("processingType",InputTypes.List,displayName:"加工类别").SetSelectOptions(processTypeItems),
  129. new InputViewModel("outsourcingFactoryName",displayName:"外协厂商").SetSearchIcon("query_outFactory_modal"),
  130. new InputViewModel("processingTypeNo",displayName:"外协编码",@class:"outCode" ),
  131. new InputViewModel("planProduceDate",displayName:"计划完成日期" ),
  132. new InputViewModel("eaCurrentSemiStoreHouseNo", hide:true),
  133. //new InputViewModel("eaSemiProductNo", displayName:"半成品编码").SetDisabled().SetInterBefore(" <div class=\"input-group\">").SetInterAfter("<div class=\"input-group-addon\" style=\"padding: 1px 12px\" onclick=\"showSelectSemiProductDialog()\" > <i class=\"iconfont icon-search\"></i></div></div>"),
  134. new InputViewModel("eaSemiProductNo", displayName:"半成品编码").SetSearchIcon("query_semiProductEx_modal"),
  135. new InputViewModel("eaQuantity", displayName:"加工数量",@class:"number",other:"min=0.001"),
  136. new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),
  137. new InputViewModel("semiProductName", displayName:"半成品名称").SetDisabled(),
  138. new InputViewModel("model", displayName:"规格").SetDisabled(),
  139. new InputViewModel("material", displayName:"材质").SetDisabled(),
  140. new InputViewModel("rigidity", displayName:"硬度").SetDisabled(),
  141. new InputViewModel("surfaceColor", displayName:"表色").SetDisabled(),
  142. };
  143. //var specials = new List<SpecialInputModel>();
  144. }
  145. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs2, "CreateProductionOrderForm"))
  146. @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalCreateProductionOrder", "Submitcreateorder()"))
  147. </div>
  148. </div>
  149. </div>
  150. </section>
  151. @Html.Partial("Modals/Query/_SemiProduct", "KeyWords-2")
  152. @Html.Partial("Modals/Query/_SemiProductEx", "eaSemiProductNo")
  153. @Html.Partial("Modals/Query/_OutFactory", "outsourcingFactory,outsourcingFactoryName")
  154. }
  155. @section scripts
  156. {
  157. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
  158. <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
  159. <script type="text/javascript">
  160. // 外协编码验证
  161. jQuery.validator.addMethod("outCode", function (value, element) {
  162. //var tel = /^[a-zA-Z0-9]{2}$/;
  163. var tel = /^[0-9]{2}$/;
  164. return this.optional(element) || (tel.test(value));
  165. }, "外协编码为两位数字");
  166. var datePickerOpt = {
  167. language: 'zh-CN',
  168. format: "yyyy-mm-dd",
  169. todayBtn: true,
  170. autoclose: true,
  171. startView: 2,
  172. minView: 2,
  173. maxView: 4
  174. //showSecond: true,
  175. //showHours: true,
  176. //minuteStep: 10
  177. };
  178. $(function () {
  179. $("#planProduceDate").datetimepicker(datePickerOpt).on('show',
  180. function (event) {
  181. event.preventDefault();
  182. event.stopPropagation();
  183. }).on('hide',
  184. function (event) {
  185. event.preventDefault();
  186. event.stopPropagation();
  187. });
  188. $("#KeyWords-4").val("false").select2();
  189. LoadTable();
  190. var funs = window.funs || { none: function () { console.log("No type"); } };
  191. //funs["btnUpdate"] = function () {
  192. // var rows = config.table.bootstrapTable("getSelections");
  193. // if (rows.length === 1) {
  194. // if (rows[0].applyStatus === "2") {
  195. // abp.message.warn("申请单已处理,不能进行修改!");
  196. // return;
  197. // }
  198. // if (rows[0].applyStatus === "5" ) {
  199. // abp.message.warn("申请单已出库,不能进行修改!");
  200. // return;
  201. // }
  202. // BtnUpdate({ readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight" });
  203. // } else
  204. // abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  205. //};
  206. //funs["btnCreate"] = function () { BtnCreate({
  207. // readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight",
  208. // data: { applyStatus: "1", applyOutStoreSource: "1", storeHouseId: "2" }
  209. // });
  210. //};
  211. funs["btnCreate"] = function (url) {
  212. BtnCreate({
  213. readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight",
  214. data: { applyStatus: "1", applyOutStoreSource: "1", storeHouseId: "2" },
  215. save: function() {
  216. var q = Number($("#quantity").val());
  217. if ( q<= 0) {
  218. abp.message.warn("出库数量必须大于0!");
  219. return;
  220. } else if (q >Number($("#maxQuantity").val())) {
  221. abp.message.warn("出库数量必须小于可用库存(" + $("#maxQuantity").val() + ")!");
  222. return;
  223. }
  224. SaveAjax({
  225. url: url,
  226. form: $('#form'),
  227. success: function(res) {
  228. abp.message.success(abp.localization.localize("OpSuccess")).done(function() {
  229. f_createProductionOrder(res.id);
  230. });
  231. RefreshTable();
  232. }
  233. });
  234. }
  235. });
  236. };
  237. funs["btnQueryStore"] = function () {
  238. ShowModal("query_semiCurrentStore_modal");
  239. };
  240. });
  241. function f_cancelApply(id, status) {
  242. console.log("cancelApply", id);
  243. abp.message.confirm("确认取消申请?",
  244. "取消申请",
  245. function () {
  246. abp.ajax({
  247. url: window.appUrl + 'ProductionOrders/CancelSemiOutStoreApplyStatus',
  248. data: { Id: id, ProductionOrderStatus: status },
  249. async: true,
  250. type: "Post",
  251. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  252. isValidate: false,
  253. dataType: "json",
  254. success: function () {
  255. abp.message.success(abp.localization.localize("OpSuccess"));
  256. RefreshTable();
  257. }
  258. });
  259. });
  260. }
  261. function f_recoveryApply(id) {
  262. console.log("recoveryApply", id);
  263. abp.message.confirm("确认恢复申请?",
  264. "恢复申请",
  265. function () {
  266. abp.ajax({
  267. url: window.appUrl + 'ProductionOrders/RecoverySemiOutStoreApplyStatus',
  268. data: { Id: id, ProductionOrderStatus: status },
  269. async: true,
  270. type: "Post",
  271. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  272. isValidate: false,
  273. dataType: "json",
  274. success: function () {
  275. abp.message.success(abp.localization.localize("OpSuccess"));
  276. RefreshTable();
  277. }
  278. });
  279. });
  280. }
  281. function f_closeApply(id) {
  282. console.log("recoveryApply", id);
  283. abp.message.confirm("出库申请关闭后不可恢复,确认关闭申请?",
  284. "关闭申请",
  285. function () {
  286. abp.ajax({
  287. url: window.appUrl + 'ProductionOrders/CloseOutStoreApply',
  288. data: { Id: id },
  289. async: true,
  290. type: "Post",
  291. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  292. isValidate: false,
  293. dataType: "json",
  294. success: function () {
  295. abp.message.success(abp.localization.localize("OpSuccess"));
  296. RefreshTable();
  297. }
  298. });
  299. });
  300. }
  301. function f_createProductionOrder(id) {
  302. SaveAjax({
  303. url: window.appUrl + "ProductionOrders/GetSemiOutStoreApplyById?id=" + id,
  304. isAlert: false,
  305. isValidate: false,
  306. success: function (row) {
  307. $("#outStoreId").val(row.id);
  308. $("#sourceProductionOrderNo").val(row.productionOrderNo);
  309. /*$("#processingType").val(row.productionOrderNo);*/
  310. $("#processingTypeNo").val("");
  311. $("#eaCurrentSemiStoreHouseNo").val(row.currentSemiStoreHouseNo);
  312. $("#eaSemiProductNo").val(row.semiProductNo);
  313. $("#eaQuantity").val(row.actualQuantity).prop("disabled",true);
  314. $("#model").val(row.model);
  315. $("#material").val(row.material);
  316. $("#rigidity").val(row.rigidity);
  317. $("#surfaceColor").val(row.surfaceColor);
  318. queryParams.model = row.model;
  319. queryParams.modelExpType = '6';
  320. queryParams.material = row.material;
  321. queryParams.materialExpType = '6';
  322. queryParams.semiProductName = row.semiProductName;
  323. queryParams.semiProductNameExpType = '6';
  324. $("#modalCreateProductionOrder").modal("show");
  325. }
  326. });
  327. }
  328. function f_confirmOutApply(id) {
  329. console.log("cancelApply", id);
  330. abp.message.confirm("确认产品出库数量正确吗?",
  331. "确认出库数量",
  332. function () {
  333. abp.ajax({
  334. url: window.appUrl + 'ProductionOrders/ConfirmSemiOutStoreQuantity',
  335. data: { Id: id },
  336. async: true,
  337. type: "Post",
  338. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  339. isValidate: false,
  340. dataType: "json",
  341. success: function () {
  342. abp.message.success(abp.localization.localize("OpSuccess")).done(function() {
  343. f_createProductionOrder(id);
  344. });
  345. RefreshTable();
  346. }
  347. });
  348. });
  349. }
  350. function Submitcreateorder() {
  351. SaveAjax({
  352. url: window.appUrl + "ProductionOrders/CreateOutProductionOrder",
  353. data: { OutStoreId: $("#outStoreId").val(), sourceProductionOrderNo: $("#sourceProductionOrderNo").val(), processingTypeNo: $("#processingTypeNo").val(), outsourcingFactory: $("#outsourcingFactory").val(), processingType: $("#processingType").val(), Quantity: $("#eaQuantity").val(), SemiProductNo: $("#eaSemiProductNo").val(),planProduceDate:$("#planProduceDate").val(),Remark:$('#modalCreateProductionOrder #remark').val() },
  354. modal:$("#modalCreateProductionOrder"),
  355. isAlert: false,
  356. success: function (res) {
  357. if (res) {
  358. abp.message.success("外协流转单创建成功,前往外协生产维护中查看信息!").done(function() {
  359. window.location.href = "@Url.Action("OutProductionOrderMg","ProductionInfo")";
  360. });
  361. $("#modalCreateProductionOrder").modal("hide");
  362. RefreshTable();
  363. }
  364. }
  365. });
  366. }
  367. function Submit_query_semiProductEx_modal(row) {
  368. row = row || $query_semiProductEx_modal_table.bootstrapTable("getSelections")[0];
  369. row = CheckIsExistAndGetNewProduct(row.id);
  370. if (row) {
  371. $(targetDom + ' #eaSemiProductNo').val(row.id);
  372. $(targetDom + " #semiProductName").val(row.productName);
  373. $(targetDom + " #model").val(row.model);
  374. $(targetDom + " #material").val(row.material);
  375. $(targetDom + " #surfaceColor").val(row.surfaceColor);
  376. $(targetDom + " #rigidity").val(row.rigidity);
  377. $("#query_semiProductEx_modal").modal('hide');
  378. }
  379. }
  380. function CheckIsExistAndGetNewProduct(productNo) {
  381. let row;
  382. SaveAjax({
  383. url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
  384. isValidate: false,
  385. isAlert: false,
  386. async: false,
  387. success: function (res) {
  388. if (res) {
  389. let pNo = res.id;
  390. let reg = new RegExp(/^s.{13}/g);
  391. if (productNo !== pNo && reg.test(pNo)) {
  392. abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
  393. }
  394. row = res;
  395. }
  396. }
  397. });
  398. return row;
  399. }
  400. </script>
  401. <script id="formatter">
  402. function StoreHouseIdFormatte(v) {
  403. var name = $("#hide-StoreHouses option[value='" + v + "']").text();
  404. return '<span class="label label-primary">' + name + '</span>';
  405. }
  406. function ApplyStatusFormatter(v, r) {
  407. if (r.isClose) {
  408. return '<span class="label label-primary">已结束</span>';
  409. }
  410. var name = $("#hide-ApplyStatus option[value='" + v + "']").text();
  411. if (v === "1") {
  412. return '<span class="label label-default">' + name + '</span>';
  413. } else if (v === "2") {
  414. return '<span class="label label-success">' + name + '</span>';
  415. } else if (v === "3") {
  416. return '<span class="label label-warning">' + name + '</span>';
  417. } else if (v === "4") {
  418. return '<span class="label label-danger">' + name + '</span>';
  419. }
  420. return '<span class="label label-info">' + name + '</span>';
  421. }
  422. function ActionFormatter(v, r) {
  423. var str = '<span class="table-action">暂无操作</span>';;
  424. if (r.isConfirm && !r.isClose) {
  425. str = '<span class="table-action" onclick="f_createProductionOrder(\'' +
  426. r.id +
  427. '\')"><i class="iconfont icon-right"></i>创建流转单</span>';
  428. }
  429. //else {
  430. // if (r.applyStatus === "1") {
  431. // str = '<span class="table-action" onclick="f_cancelApply(\'' +
  432. // r.id +
  433. // '\',3)"><i class="iconfont icon-right"></i>取消申请</span>';
  434. // } else if (r.applyStatus === "2") {
  435. // str = '<span class="table-action" onclick="f_confirmOutApply(\'' +
  436. // r.id +
  437. // '\')"><i class="iconfont icon-right"></i>确认收货</span>';
  438. // } else if (r.applyStatus === "3" || r.applyStatus === "4") {
  439. // str = '<span class="table-action" onclick="f_recoveryApply(\'' + r.id +
  440. // '\')"><i class="iconfont icon-right"></i>恢复申请</span><span class="table-action" onclick="f_closeApply(\'' + r.id +
  441. // '\')"><i class="iconfont icon-right"></i>关闭申请</span>';
  442. // } else {
  443. // str = '<span class="table-action">暂无操作</span>';
  444. // }
  445. //}
  446. return str;
  447. }
  448. </script>
  449. }