| | |
| | | var result = ajax.start(); |
| | | if(result.data.length === 0) { |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/productionOrdeInfo/editItem", function (data) { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) { |
| | | Feng.success("开始工单成功!"); |
| | | table.reload(ProductionOrdeInfo.tableId); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("开始工单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 冻结工单 |
| | | */ |
| | | WorkOrder.freezeOrder = function (data) { |
| | | console.log(data) |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editOrderState", function (data) { |
| | | Feng.success("冻结工单成功!"); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("冻结工单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(data); |
| | | console.log(data) |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否冻结工单?", operation); |
| | | }; |
| | | |
| | | /** |
| | | * 点击解冻工单 |
| | | */ |
| | | WorkOrder.thawOrder = function (data) { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/list?state=3"); |
| | | var result = ajax.start(); |
| | | if(result.data.length === 0) { |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) { |
| | | Feng.success("解冻工单成功!"); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("解冻工单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(data); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否解冻工单?", operation); |
| | | }else { |
| | | layer.open({ |
| | | title: "操作提示", |
| | | icon: 0, |
| | | closeBtn: 2, |
| | | area: ['450px', '200px'], |
| | | time: 5000, |
| | | content: '<span style="font-size: 30px;color: red">解冻失败,只能有一条生产中的工单进行生产!</span>' |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 关闭工单 |
| | | */ |
| | | WorkOrder.closeOrder = function (data) { |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editOrderState", function (data) { |
| | | Feng.success("关闭工单成功!"); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("关闭工单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(data); |
| | | console.log(data) |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否关闭工单?", operation); |
| | | }; |
| | | |
| | | /** |
| | | * 点击启用工单 |
| | | */ |
| | | WorkOrder.enableOrder = function (data) { |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) { |
| | | Feng.success("启用工单成功!"); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("启用工单失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(data); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否启用工单?", operation); |
| | | }; |
| | | |
| | | /** |
| | | * 点击完成 |
| | | * |
| | | * @param data 点击按钮时候的行数据 |
| | | */ |
| | | WorkOrder.finish = function (data) { |
| | | var operation = function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/workOrder/editItem", function (data) { |
| | | Feng.success("已完成!"); |
| | | table.reload(WorkOrder.tableId); |
| | | }, function (data) { |
| | | Feng.error("删除失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(data); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("是否完成?", operation); |
| | | }; |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(' + WorkOrder.tableId + ')', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | console.log(data) |
| | | |
| | | // if (layEvent === 'edit') { |
| | | // WorkOrder.jumpEditPage(data); |
| | |
| | | WorkOrder.jumpEditPage(data); |
| | | } |
| | | else if (layEvent === 'start') {//开始 |
| | | data.orderStatus = '3'; |
| | | // data.actualStartTime = getDateTime(); |
| | | data.state = '3'; |
| | | data.produceStartTime = getDateTime(); |
| | | WorkOrder.startOrder(data); |
| | | }else if (layEvent === 'freeze') {//冻结 |
| | | data.orderStatus = '4'; |
| | | data.state = '4'; |
| | | WorkOrder.freezeOrder(data); |
| | | }else if (layEvent === 'thaw') {//解冻 |
| | | data.orderStatus = '3'; |
| | | data.state = '3'; |
| | | WorkOrder.thawOrder(data); |
| | | }else if (layEvent === 'close') {//关闭 |
| | | data.orderStatus = '6'; |
| | | data.state = '6'; |
| | | WorkOrder.closeOrder(data); |
| | | }else if (layEvent === 'enable') {//启用 |
| | | data.orderStatus = '1'; |
| | | data.state = '1'; |
| | | WorkOrder.enableOrder(data); |
| | | }else if (layEvent === 'delete') { |
| | | WorkOrder.onDeleteItem(data); |
| | | }else if (layEvent === 'materialCodeClick') { |
| | | WorkOrder.materialCodeClick(data); |
| | | }else if (layEvent === 'finish') {//完成 |
| | | data.orderStatus = '5'; |
| | | data.actualEndTime = getDateTime(); |
| | | data.state = '5'; |
| | | data.produceEndTime = getDateTime(); |
| | | WorkOrder.finish(data); |
| | | } |
| | | }); |