ouyj 4 dienas atpakaļ
vecāks
revīzija
73aac375fd

+ 7 - 6
src/main/contract/com/yw/contract/contract/action/ContractFlowCustomAction.java

@@ -100,13 +100,14 @@ public class ContractFlowCustomAction  extends BpmBaseAction {
 		String department = oasession.getGroup().getGroupName();
 		String depid = oasession.getGroup().getId().toString();
 		String applyDate = DateUtil.getCurrDate("yyyy-MM-dd"); 
-		String contract_num = codeRuleService.createCode("CONTRACT_CODE", oasession.getUnit().getId(), // 公司单位ID
-				null, // 特殊前缀值,没有传null
-				true, // 更新数据库流水号值
-				null);
+		// 合同编号改为手动输入,不再生成
+		// String contract_num = codeRuleService.createCode("CONTRACT_CODE", oasession.getUnit().getId(), // 公司单位ID
+		// 		null, // 特殊前缀值,没有传null
+		// 		true, // 更新数据库流水号值
+		// 		null);
 		String companyName = oasession.getCompanyName(); 
 		//contractInfo.setContract_number(StringUtil.getSeq().toString());
-		contractInfo.setContract_number(contract_num);
+		// contractInfo.setContract_number(contract_num); // 不再自动生成合同编号
 		contractInfo.setContract_entrying_operator_name(oasession.getName());
 		contractInfo.setContract_entrying_operator(oasession.getLoginID());
 		contractInfo.setSalesman(-oasession.getLoginID());
@@ -548,7 +549,7 @@ public class ContractFlowCustomAction  extends BpmBaseAction {
 		PrintWriter out = response.getWriter();
 		out.print(contractInfo.getUniversalid());
 	}
-	
+
 	public void viewContract(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		contractEntryService = this.getBean(ContractEntryService.class, "contractEntryService"); 
 		String formInsId = request.getParameter("universalid"); 

+ 2 - 2
src/main/contract/com/yw/contract/contract/dao/ContractEntryDaoImpl.java

@@ -412,8 +412,8 @@ public class ContractEntryDaoImpl extends BaseDao implements ContractEntryDao {
 			sql.append(" AND ec.universalid != " +info.getUniversalid()); 
 		}
 		if(info.getIsValid() != null){
-			sql.append(" AND ec.is_valid != 2");
-		} 
+			sql.append(" AND (ec.is_valid = 0 OR ec.is_valid = 1 OR ec.is_valid = 3)");
+		}
 		return jdbcTemplate.queryForObject(sql.toString(), Integer.class, new Object[] { info.getContract_number(), ContractConstant.CONTRACT_NOTDRAFT });
 	}
 

+ 19 - 5
src/main/webapp/yw/contract/contractFlowCustom/processContract.jsp

@@ -166,15 +166,14 @@
         
         function checkForm() {
             var rs = true;
-            /* var contract_number = $("#contract_number").val();
+			var contract_number = $("#contract_number").val();
             if (contract_number) {
                 validContractNumber(contract_number, function(flag) {
                     rs = flag ? checkFormMore() : false;
                 });
             } else {
                 rs = checkFormMore();
-            }  */
-            rs = checkFormMore();
+            }
             return rs;
         }
         
@@ -184,12 +183,17 @@
  			var rs = true;
 
 			// 检查各字段是否需要验证 (启动节点或在 table_fields 配置中)
+			var contract_number_required = (se == 1 || table_fields.indexOf(',contract_number,') > -1);
 			var contract_name_required = (se == 1 || table_fields.indexOf(',contract_name,') > -1);
 			var contract_type_required = (se == 1 || table_fields.indexOf(',contract_type,') > -1);
 			var salesman_required = (se == 1 || table_fields.indexOf(',salesman_name,') > -1);
 			var contract_money_required = (se == 1 || table_fields.indexOf(',contract_money,') > -1);
 			var supplierName_required = (se == 1 || table_fields.indexOf(',supplierName,') > -1);
 
+			if(contract_number_required){
+				rs = $.validate({name:"contractInfo.contract_number",model:[{type:"require",msg:"合同编号不能为空!"},
+				                                                 {type:"len",max:100,msg:"合同编号长度不能超过100!"}]}) && rs; 
+			}
 			if(contract_name_required){
 				rs = $.validate({name:"contractInfo.contract_name",model:[{type:"require",msg:"合同名称不能为空!"},
 						{type:"len",max:100,msg:"合同名称长度不能超过 100!"}]}) && rs;
@@ -464,10 +468,20 @@
                 <input type="hidden" id="applyDate" name="contractInfo.applyDate" value="${contractInfo.applyDate}"/>
                 ${contractInfo.applyDate}
             </td>
-            <td class="l-table-edit-text">合同编号: 
+            <td class="l-table-edit-text">合同编号
+            	<c:if test="${fn:contains(curTacheModel.table_fields, ',contract_number,') || curTacheModel.n_se eq 1}">
+                    <font color="red">*</font>:
+                </c:if> 
              </td> 
             <td class="l-table-edit-td" colspan="3">  
-                <input type="hidden" id="contract_number" name="contractInfo.contract_number" value="${contractInfo.contract_number }"/>${contractInfo.contract_number } 
+                <c:choose>
+                    <c:when test="${fn:contains(curTacheModel.table_fields, ',contract_number,') || curTacheModel.n_se eq 1}">
+                        <input type="text" id="contract_number" name="contractInfo.contract_number" value="${contractInfo.contract_number }"/> 
+                    </c:when>
+                    <c:otherwise>
+                        <input type="hidden" id="contract_number" name="contractInfo.contract_number" value="${contractInfo.contract_number }"/>${contractInfo.contract_number } 
+                    </c:otherwise>
+                </c:choose>
             </td>
         </tr> 
         <tr> 

+ 6 - 7
src/main/webapp/yw/contract/contractFlowCustom/startContract.jsp

@@ -128,15 +128,14 @@
         
         function checkForm() {
             var rs = true;
-            /* var contract_number = $("#contract_number").val();
+            var contract_number = $("#contract_number").val();
             if (contract_number) {
                 validContractNumber(contract_number, function(flag) {
                     rs = flag ? checkFormMore() : false;
                 });
             } else {
                 rs = checkFormMore();
-            } */ 
-            rs = checkFormMore();
+            }
             return rs;
         }
         
@@ -144,8 +143,8 @@
         	var mindate=$("#contract_startdate").val();
  			var maxdate=$("#contract_enddate").val();
  			var rs = true;
- 			/* rs = $.validate({name:"contractInfo.contract_number",model:[{type:"require",msg:"合同编号不能为空!"} && rs,
- 			                                                 {type:"len",max:20,msg:"合同编号长度不能超过20!"}]}) && rs; */
+ 			rs = $.validate({name:"contractInfo.contract_number",model:[{type:"require",msg:"合同编号不能为空!"},
+ 			                                                 {type:"len",max:100,msg:"合同编号长度不能超过100!"}]}) && rs;
  			rs = $.validate({name:"contractInfo.contract_name",model:[{type:"require",msg:"合同名称不能为空!"},
  			                                            {type:"len",max:100,msg:"合同名称长度不能超过100!"}]}) && rs;
  			rs = $.validate({name:"contractInfo.contract_type",model:[{type:"require",msg:"合同类型不能为空!"}]}) && rs;	
@@ -204,7 +203,7 @@
             var isExistContractNum = false; 
             $.ajax({ 
                 type: "POST", 
-                url: "contractEntry.do?task=isExistContractNumForFlow",  
+                url: "contractEntry.do?task=isExistContractNumForFlow",
                 data: { "contract_number": contract_number }, 
                 timeout: 10000, 
                 dataType: "json", 
@@ -399,7 +398,7 @@
             </td>
             <td class="l-table-edit-text">合同编号<font color="red">*</font>:</td>
             <td class="l-table-edit-td" colspan="3">
-            	<input type="hidden" id="contract_number" name="contractInfo.contract_number" value="${contractInfo.contract_number }"/>${contractInfo.contract_number } 
+            	<input type="text" id="contract_number" name="contractInfo.contract_number" value="${contractInfo.contract_number }"/> 
             </td>
         </tr> 
         <tr>