Преглед на файлове

2024090016
摊销方案,增加支持结案、反结案按钮

zxl преди 1 седмица
родител
ревизия
4062f433f3

+ 25 - 3
WebContent/app/controller/fa/gla/AmortProgram.js

@@ -8,7 +8,7 @@ Ext.define('erp.controller.fa.gla.AmortProgram', {
       		'core.form.Panel','fa.gla.AmortProgram','core.grid.Panel2','core.toolbar.Toolbar','core.form.FileField','core.form.MultiField',
       		'core.button.Audit','core.button.ResAudit','core.button.Close','core.button.Delete','core.button.Update',
       		'core.button.DeleteDetail','core.button.Add','core.button.Save',
-      		'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger'
+      		'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger', 'core.button.End','core.button.ResEnd',
       	],
     init:function(){
     	var me = this;
@@ -69,7 +69,7 @@ Ext.define('erp.controller.fa.gla.AmortProgram', {
     		'erpAuditButton': {
     			afterrender: function(btn){
     				var status = Ext.getCmp('ap_statuscode');
-    				if(status && status.value == 'AUDITED'){
+    				if(status && status.value != 'COMMITED'){
     					btn.hide();
     				}
     			},
@@ -92,7 +92,29 @@ Ext.define('erp.controller.fa.gla.AmortProgram', {
     			click: function(){
     				me.FormUtil.onAdd('addAmortProgram', '新增摊销方案', 'jsps/fa/gla/amortProgram.jsp');
     			}
-    		}
+    		},
+			'erpEndButton': {
+				afterrender: function(btn){
+					var status = Ext.getCmp('ap_statuscode');
+					if(status && status.value != 'AUDITED'){
+						btn.hide();
+					}
+				},
+				click: function(btn){
+					me.FormUtil.onEnd(Ext.getCmp('ap_id').value);
+				}
+			},
+			'erpResEndButton': {
+				afterrender: function(btn){
+					var status = Ext.getCmp('ap_statuscode');
+					if(status && status.value != 'FINISH'){
+						btn.hide();
+					}
+				},
+				click: function(btn){
+					me.FormUtil.onResEnd(Ext.getCmp('ap_id').value);
+				}
+			}
     	});
     },
     onGridItemClick: function(selModel, record){//grid行选择

+ 2 - 0
WebContent/app/view/fa/gla/AmortProgram.js

@@ -13,6 +13,8 @@ Ext.define('erp.view.fa.gla.AmortProgram',{
 				auditUrl: 'fa/gla/auditAmortProgram.action',
 				saveUrl: 'fa/gla/saveAmortProgram.action',
 				resAuditUrl: 'fa/gla/resAuditAmortProgram.action',
+				endUrl: 'fa/gla/endAmortProgram.action',
+				resEndUrl: 'fa/gla/resEndAmortProgram.action',
 				getIdUrl: 'common/getId.action?seq=AmortProgram_SEQ',
 				keyField: 'ap_id',
 				codeField: 'ap_code',

+ 24 - 0
src/com/uas/erp/controller/fa/AmortProgramController.java

@@ -87,4 +87,28 @@ public class AmortProgramController extends BaseController {
 		modelMap.put("success", true);
 		return modelMap;
 	}
+
+	/**
+	 * 摊销方案结案
+	 */
+	@RequestMapping("/fa/gla/endAmortProgram.action")
+	@ResponseBody
+	public Map<String, Object> endAmortProgram(String caller, int id) {
+		Map<String, Object> modelMap = new HashMap<String, Object>();
+		amortProgramService.endAmortProgram(caller,id);
+		modelMap.put("success", true);
+		return modelMap;
+	}
+
+	/**
+	 * 摊销方案反结案
+	 */
+	@RequestMapping("/fa/gla/resEndAmortProgram.action")
+	@ResponseBody
+	public Map<String, Object> resEndAmortProgram(String caller, int id) {
+		Map<String, Object> modelMap = new HashMap<String, Object>();
+		amortProgramService.resEndAmortProgram(caller,id);
+		modelMap.put("success", true);
+		return modelMap;
+	}
 }

+ 4 - 0
src/com/uas/erp/service/fa/AmortProgramService.java

@@ -8,4 +8,8 @@ public interface AmortProgramService {
 	void deleteAmortProgram(int ap_id, String caller);
 	void auditAmortProgram(int ap_id, String caller);
 	void resAuditAmortProgram(int ap_id, String caller);
+
+	void endAmortProgram(String caller, int id);
+
+	void resEndAmortProgram(String caller, int id);
 }

+ 32 - 0
src/com/uas/erp/service/fa/impl/AmortProgramServiceImpl.java

@@ -145,4 +145,36 @@ public class AmortProgramServiceImpl implements AmortProgramService {
 		// 执行保存后的其它逻辑
 		handlerService.afterSave(caller, new Object[] { store, grid });
 	}
+
+	@Override
+	public void endAmortProgram(String caller, int id) {
+		// 执行禁用前的其它逻辑
+		handlerService.handler(caller, "end", "before", new Object[] { id });
+		// 执行禁用操作
+		baseDao.updateByCondition("AmortProgram","ap_statuscode='FINISH'," + "ap_status='" + BaseUtil.getLocalMessage("FINISH") + "'", "ap_id=" + id);
+		// 记录操作
+		try {
+			baseDao.logger.end(caller, "ap_id", id);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		// 执行禁用后的其它逻辑
+		handlerService.handler(caller, "end", "after", new Object[] { id });
+	}
+
+	@Override
+	public void resEndAmortProgram(String caller, int id) {
+		// 执行反禁用前的其它逻辑
+		handlerService.handler(caller, "resEnd", "before", new Object[] { id });
+		// 执行反禁用操作
+		baseDao.updateByCondition("AmortProgram","ap_statuscode='AUDITED'," + "ap_status='" + BaseUtil.getLocalMessage("AUDITED") + "'", "ap_id=" + id);
+		// 记录操作
+		try {
+			baseDao.logger.resEnd(caller, "ap_id", id);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		// 执行反禁用后的其它逻辑
+		handlerService.handler(caller, "resEnd", "after", new Object[] { id });
+	}
 }