ouyj hai 2 semanas
pai
achega
1962df5983

+ 32 - 0
src/main/bpm/com/yw/bpm/client/action/BpmClientUpdateBizAction.java

@@ -1,13 +1,20 @@
 package com.yw.bpm.client.action;
 
+import com.yw.core.session.OASession;
+import com.yw.core.utils.MsgManager;
+import com.yw.eu.base.message.model.Message;
+import com.yw.eu.base.user.model.Group;
 import org.springframework.context.ApplicationContext;
 
 import com.yw.bpm.flow.dao.FlowModelDao;
+import com.yw.contract.contract.model.ContractInfo;
+import com.yw.contract.contract.service.ContractEntryService;
 import com.yw.core.clientImpl.model.ResultVo;
 import com.yw.core.clientImpl.service.RequestAbs;
 import com.yw.core.session.AppSession;
 import com.yw.core.utils.RegisterCodeImpl;
 import com.yw.core.utils.StringUtil;
+
 import net.sf.json.JSONObject;
 
 /**
@@ -36,6 +43,7 @@ public class BpmClientUpdateBizAction extends RequestAbs {
 		String flowIns_id = json.getString("fix_flowInsId");// 流程实例id
 		String formInsId = json.getString("fix_formInsId");// 表单实例id
 		String formId = json.getString("fix_formId");// 流程表单id
+		Long unitId = json.getLong("unitId");// 流程表单id
 
 		FlowModelDao bpmFlowModelDao = (FlowModelDao) cxt.getBean("bpmFlowModelDao");
 		;
@@ -46,6 +54,30 @@ public class BpmClientUpdateBizAction extends RequestAbs {
 			if (!StringUtil.isEmpty(formId) && !"0".equals(formId)) {
 				// 1.流程办理成功更新 业务表单是否有效状态重新更新为1
 				bpmFlowModelDao.updateBizValid(flowIns_id, formInsId, formId, 1);
+				OASession oasession = new OASession();
+				oasession.setUnit(new Group());
+				oasession.getUnit().setId(unitId);
+				if("200002".equals(formId)){	//合同
+					//用formInsId找到合同数据,如果合同类型为1的时候,则为销售合同, 然后给用户发消息,提示流程已办结,到合同档案或者我的合同里面进行同步销售订单
+					try {
+						ContractEntryService contractEntryService = (ContractEntryService) cxt.getBean("contractEntryService");
+						ContractInfo contractInfo = contractEntryService.toEditContractEntry(StringUtil.strToLong(formInsId), oasession);
+						
+						if(contractInfo != null && contractInfo.getContract_type() != null && contractInfo.getContract_type() == 1) {
+							// 销售合同(contract_type=1),发送站内消息提醒
+							String content = "您的销售合同《" + contractInfo.getContract_name() + "》流程已办结,请到合同档案或我的合同中进行同步销售订单操作。";
+							Message message = new Message();
+							message.setContent(content);
+							message.setReadUsers(user_id);
+							message.setTitle(content);
+							message.setSendUser(new Long(1));
+							MsgManager.sendMessage(message, true);
+						}
+					} catch (Exception e) {
+						e.printStackTrace();
+						System.out.println("发送销售合同同步提醒消息异常:" + e.getMessage());
+					}
+				}
 				rv.setReturnCode("1");
 				rv.setReturnMsg("执行成功!");
 				rv.setReturnParams("{}");

+ 16 - 6
src/main/contract/com/yw/contract/common/sync/mes/MesCommonHelper.java

@@ -462,11 +462,16 @@ public class MesCommonHelper  extends MesHelper{
         }
     }
     
-    public JSONObject getPurchases(int pageNum, int pageSize, String purchaseName) throws Exception {
+    public JSONObject getPurchases(int pageNum, int pageSize, String purchaseName, String vendorCode) throws Exception {
         Map<String, Object> dats = new HashMap<>();
         dats.put("pageNum", pageNum);
         dats.put("pageSize", pageSize);
-        dats.put("purchaseName", purchaseName);
+        if (!StringUtil.isEmpty(purchaseName)) {
+            dats.put("purchaseName", purchaseName);
+        }
+        if (!StringUtil.isEmpty(vendorCode)) {
+            dats.put("vendorCode", vendorCode);
+        }
         Request request = getRequest(SyncConstant.PURCHASE_URL, dats);
         try {
             OkHttpClient client = new OkHttpClient().newBuilder().build();
@@ -476,7 +481,7 @@ public class MesCommonHelper  extends MesHelper{
                     String resp = response.body().string();
                     int isResp = checkResp(resp);
                     if(isResp == 0){
-                        return getMaterial(pageNum, pageSize, purchaseName);
+                        return getPurchases(pageNum, pageSize, purchaseName, vendorCode);
                     }
                     return new JSONObject(resp);
                 }else{
@@ -493,11 +498,16 @@ public class MesCommonHelper  extends MesHelper{
         return null;
     }
 
-    public JSONObject getItemrecpts(int pageNum, int pageSize, String recptName) throws Exception {
+    public JSONObject getItemrecpts(int pageNum, int pageSize, String recptName, String vendorCode) throws Exception {
         Map<String, Object> dats = new HashMap<>();
         dats.put("pageNum", pageNum);
         dats.put("pageSize", pageSize);
-        dats.put("recptName", recptName);
+        if (!StringUtil.isEmpty(recptName)) {
+            dats.put("recptName", recptName);
+        }
+        if (!StringUtil.isEmpty(vendorCode)) {
+            dats.put("vendorCode", vendorCode);
+        }
         Request request = getRequest(SyncConstant.ITEMRECPT_URL, dats);
         try {
             OkHttpClient client = new OkHttpClient().newBuilder().build();
@@ -507,7 +517,7 @@ public class MesCommonHelper  extends MesHelper{
                     String resp = response.body().string();
                     int isResp = checkResp(resp);
                     if(isResp == 0){
-                        return getItemrecpts(pageNum, pageSize, recptName);
+                        return getItemrecpts(pageNum, pageSize, recptName, vendorCode);
                     }
                     return new JSONObject(resp);
                 }else{

+ 2 - 0
src/main/contract/com/yw/contract/contract/action/ContractEntryAction.java

@@ -1433,7 +1433,9 @@ public class ContractEntryAction extends ContractFlowAction {
 	private String toSelectMaterialForContract(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		ApplicationContext cxt = AppSession.getApplicationContext();
 		String checkValue = request.getParameter("checkValue");
+		String contractType = request.getParameter("contractType");
 		request.setAttribute("checkValue", checkValue);
+		request.setAttribute("contractType", contractType);
 		contractPurchaseService = (ContractPurchaseService) cxt.getBean("contractPurchaseService"); 
 		List<ContractPurchaseDetail> purchaseDetailList = contractPurchaseService.getDetailListForPurchase();
 		request.setAttribute("purchaseList", purchaseDetailList);

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

@@ -33,7 +33,8 @@ public class ContractEntryDaoImpl extends BaseDao implements ContractEntryDao {
 	public List<ContractInfo> contractEntryList(int p, int pSize, ParameterHelper ph, ContractInfo info, IAppSession oasession) throws Exception {
 		StringBuffer sb = new StringBuffer("SELECT ec.universalid, ec.contract_number,ec.firstparty_name,ec.secondparty_name,ec.contract_name,ec.contract_type,ec.contract_signdate,"
 				+ " ec.contract_type,tu1.name AS duty_man_name,tu2.name AS salesman_name," + "tg.GROUPNAME AS duty_department_name ,ed.dname AS contract_type_name, ec.au_state, ec.flow_id,"
-				+ " ec.execute_state,ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,a.v_ins_sub_name,ec.order_number "
+				+ " ec.execute_state,ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,ec.process_id,ec.contract_entrying_date,"
+				+ "ec.purchase_id,ec.purchase_number,a.v_ins_sub_name,ec.order_number,ec.contract_money,ec.initiator "
 				+ " FROM contract ec LEFT JOIN t_user tu1 ON ec.duty_man=tu1.UNIVERSALID " + "LEFT JOIN t_user tu2 ON ec.salesman=tu2.UNIVERSALID "
 				+ " LEFT JOIN t_group tg ON ec.duty_department=tg.UNIVERSALID " + "LEFT JOIN contract_data_dictionary ed ON ec.contract_type=ed.dvalue "
 				+ " AND ed.parentid = (SELECT universalid FROM contract_data_dictionary WHERE dvalue = '" + ContractConstant.CONTRACT_TYPE + "' AND group_root_id=" + oasession.getUnit().getId() + ")"

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

@@ -31,7 +31,7 @@ public class ContractListDaoImpl extends BaseDao implements ContractListDao {
 				+ "AND ec.contract_status='0' AND ec.duty_man LIKE ?  AND ec.isdraft = '0' " + "AND ec.unit_id=" + oasession.getUnit().getId() + " AND (ec.l_form_ins_id is null or ec.is_valid = 1) ORDER BY ec.contract_entrying_date DESC ";*/
 		String sql = "SELECT ec.universalid, ec.contract_number,ec.firstparty_name,ec.secondparty_name,ec.contract_name,ec.contract_type,ec.contract_signdate,"
 				+ " ec.contract_type, ec.au_state, ec.flow_id, ec.execute_state,ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,"
-				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number, "
+				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number,ec.contract_money,ec.initiator, "
 				+ " tu1.name AS duty_man_name,tu2.name AS salesman_name,tg.GROUPNAME AS duty_department_name ,ed.dname AS contract_type_name "
 				+ " FROM contract ec LEFT JOIN t_user tu1 ON ec.duty_man=tu1.UNIVERSALID "
 				+ " LEFT JOIN t_user tu2 ON ec.salesman=tu2.UNIVERSALID " + "LEFT JOIN t_group tg ON ec.duty_department=tg.UNIVERSALID "
@@ -115,7 +115,7 @@ public class ContractListDaoImpl extends BaseDao implements ContractListDao {
 				+ " )  AND ed.is_valid = '1' " + "WHERE 1=1 AND ec.contract_status='0'  AND ec.isdraft = '0' ");*/
 		StringBuffer bf = new StringBuffer("SELECT ec.universalid, ec.contract_number,ec.firstparty_name,ec.secondparty_name,ec.contract_name,ec.contract_type,ec.contract_signdate,"
 				+ " ec.contract_type, ec.au_state, ec.flow_id, ec.execute_state,ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,"
-				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number, "
+				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number,ec.contract_money,ec.initiator, "
 				+ " tu1.name AS duty_man_name,tu2.name AS salesman_name,tg.GROUPNAME AS duty_department_name ,ed.dname AS contract_type_name  " 
 				+ " FROM contract ec LEFT JOIN t_user tu1 ON ec.duty_man=tu1.UNIVERSALID " + "LEFT JOIN t_user tu2 ON ec.salesman=tu2.UNIVERSALID "
 				+ " LEFT JOIN t_group tg ON ec.duty_department=tg.UNIVERSALID " + "LEFT JOIN contract_data_dictionary ed ON ec.contract_type=ed.dvalue "

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

@@ -28,8 +28,8 @@ public class ContractMyLaunchDaoImpl extends BaseDao implements ContractMyLaunch
 				+ " ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,ec.process_id,ec.contract_entrying_date "*/
 		String sql = "SELECT ec.universalid, ec.contract_number,ec.firstparty_name,ec.secondparty_name,ec.contract_name,ec.contract_type,ec.contract_signdate,"
 				+ " ec.contract_type, ec.au_state, ec.flow_id, ec.execute_state,ec.supplier_code,ec.supplier_name,ec.l_form_ins_id,ec.l_form_ins_id,ec.flow_ins_id, ec.is_valid,"
-				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number, "
-				+ " tu1.name AS duty_man_name,tu2.name AS salesman_name, tg.GROUPNAME AS duty_department_name ,ed.dname AS contract_type_name "  
+				+ " ec.process_id,ec.contract_entrying_date,ec.purchase_id,ec.purchase_number,ec.order_number,ec.contract_money,ec.initiator, "
+				+ " tu1.name AS duty_man_name,tu2.name AS salesman_name, tg.GROUPNAME AS duty_department_name ,ed.dname AS contract_type_name "
 				+ " FROM contract ec LEFT JOIN t_user tu1 ON ec.duty_man=tu1.UNIVERSALID "
 				+ " LEFT JOIN t_user tu2 ON ec.salesman=tu2.UNIVERSALID " + "LEFT JOIN t_group tg ON ec.duty_department=tg.UNIVERSALID "
 				+ " LEFT JOIN contract_data_dictionary ed ON ec.contract_type=ed.dvalue " + "WHERE ec.contract_number LIKE ? AND ec.contract_name LIKE ? AND ec.contract_type LIKE ? "

+ 16 - 0
src/main/webapp/yw/contract/contractEntryList.jsp

@@ -59,6 +59,22 @@
 										name : 'secondparty_name',
 										width : 200
 									},
+									{
+										display : '合同金额',
+										name : 'contract_money',
+										width : 120,
+										render : function(row) {
+											if(row.contract_money) {
+												return '¥' + parseFloat(row.contract_money).toFixed(2);
+											}
+											return '';
+										}
+									},
+									{
+										display : '录入日期',
+										name : 'contract_entrying_date',
+										width : 110
+									},
 									/* {
 										display : '签约人',
 										name : 'duty_man_name',

+ 99 - 3
src/main/webapp/yw/contract/contractFlowCustom/js/contract.js

@@ -24,6 +24,15 @@
 		$(cloneObj).find("input.priceTax").attr("name", "contractMaterialList[" + index + "].priceTax").val(row.priceTax || 0);
 		$(cloneObj).find("input.purchaseId").attr("name", "contractMaterialList[" + index + "].purchaseId").val(row.purchaseId);
 		$(cloneObj).find("input.purchaseNumber").attr("name", "contractMaterialList[" + index + "].purchaseNumber").val(row.purchaseNumber);
+		
+		// 如果是销售合同(contract_type=1),隐藏采购申请单编号输入框,但保留删除图标
+		var contractType = $("#contract_type").val();
+		if (contractType == '1') {
+			$(cloneObj).find("input.purchaseNumber").hide();
+		} else {
+			$(cloneObj).find("input.purchaseNumber").show();
+		}
+		
 		$("#firstPoint").before(cloneObj); 
 	}
 	
@@ -37,8 +46,61 @@
 // 监听合同类型变化,动态调整需方和供方的显示
 function initContractTypeListener() {
 	$("#contract_type").on('change', function() {
-		var contractType = $(this).val();
-		adjustPartyDisplay(contractType);
+		var oldContractType = $(this).data('last-value'); // 获取之前的合同类型
+		var newContractType = $(this).val();
+		
+		// 如果合同类型发生变化,检查是否需要清理物料
+		if (oldContractType !== newContractType) {
+			// 切换到销售合同时,检查是否有来自采购申请单的物料
+			if (newContractType == '1') {
+				var invalidMaterials = [];
+				$(".startTr1").not(".hide").each(function(i, v) {
+					var purchaseId = $(v).find("input.purchaseId").val();
+					var purchaseNumber = $(v).find("input.purchaseNumber").val();
+					// 排除空值、null字符串、0等无效值
+					if ((purchaseId && purchaseId !== 'null' && purchaseId !== '0' && purchaseId !== 'undefined') || 
+					    (purchaseNumber && purchaseNumber !== 'null' && purchaseNumber !== 'undefined')) {
+						invalidMaterials.push(v);
+					}
+				});
+					
+				if (invalidMaterials.length > 0) {
+					$.ligerDialog.confirm(
+						'检测到已选择的物料中有 ' + invalidMaterials.length + ' 条来自采购申请单的数据,销售合同不允许使用采购申请单物料,是否清除这些不符合要求的物料?',
+						function(yes) {
+							if (yes) {
+								// 只清除不符合要求的物料行
+								$(invalidMaterials).remove();
+								addMaterialIdAndName();
+								calculateTotalPrice();
+								updateContractMoneyState();
+								checkAndRemovePaymentInfo();
+								// 更新采购申请单编号的显示状态
+								updatePurchaseNumberVisibility(newContractType);
+								updateMaterialTableHeader(newContractType);
+								$.ligerDialog.success('已清除 ' + invalidMaterials.length + ' 条不符合要求的物料');
+								// 用户确认后,更新last-value为新值
+								$("#contract_type").data('last-value', newContractType);
+							} else {
+								// 用户取消,恢复原来的合同类型,不更新last-value
+								$("#contract_type").val(oldContractType || '');
+							}
+						}
+					);
+					// 等待用户确认后再继续,先不执行后续操作
+					return;
+				}
+			}
+		}
+		
+		// 更新最后的合同类型值
+		$(this).data('last-value', newContractType);
+		
+		adjustPartyDisplay(newContractType);
+		// 同时更新物料行中采购申请单编号的显示状态
+		updatePurchaseNumberVisibility(newContractType);
+		// 更新表头显示
+		updateMaterialTableHeader(newContractType);
 	});
 }
 
@@ -85,6 +147,38 @@ function adjustPartyDisplay(contractType, preserveValues) {
 	}
 }
 
+// 更新物料行中采购申请单编号的显示状态
+function updatePurchaseNumberVisibility(contractType) {
+	$(".startTr1").not(".hide").each(function(i, v) {
+		if (contractType == '1') {
+			// 销售合同:隐藏采购申请单编号输入框
+			$(v).find("input.purchaseNumber").hide();
+		} else {
+			// 其他合同:显示采购申请单编号输入框
+			$(v).find("input.purchaseNumber").show();
+		}
+	});
+}
+
+// 更新物料表格表头显示
+function updateMaterialTableHeader(contractType) {
+	// 找到物品信息区域的表格表头
+	var materialTable = $("#firstDiv .l-table-edit-new");
+	if (materialTable.length > 0) {
+		var headerCells = materialTable.find("th");
+		// 采购申请单编号是第9列(索引8)
+		if (headerCells.length >= 9) {
+			if (contractType == '1') {
+				// 销售合同:清空采购申请单编号列的文字,但保留单元格占位
+				$(headerCells[8]).text("");
+			} else {
+				// 其他合同:恢复采购申请单编号列的文字
+				$(headerCells[8]).text("采购申请单编号");
+			}
+		}
+	}
+}
+
 //为添加的行填充name及id
 function addMaterialIdAndName() {
 //物品信息tr
@@ -266,12 +360,14 @@ function material_search(){
 		$.ligerDialog.warn('请先选择供应商!');
 		return;
 	} */
+	// 获取合同类型
+	var contractType = $("#contract_type").val() || "";
 	var obj = window.top;
 	obj.$.ligerDialog.open({
 		title : '选择物料',
 		width : 1100,
 		height : 380,
-		url : 'contractEntry.do?task=toSelectMaterialForContract&checkbox=true',
+		url : 'contractEntry.do?task=toSelectMaterialForContract&checkbox=true&contractType=' + contractType,
 		buttons : [ {
 			text : '确定',
 			onclick : f_importOKMaterial

+ 20 - 0
src/main/webapp/yw/contract/contractFlowCustom/processContract.jsp

@@ -41,6 +41,12 @@
         	// 初始化合同类型监听器
         	initContractTypeListener();
         	
+        	// 设置初始合同类型值,用于后续变化检测
+        	var initialContractType = $("#contract_type").val();
+        	if (initialContractType) {
+        		$("#contract_type").data('last-value', initialContractType);
+        	}
+        	
         	if (se != 1) {    
         		 $("#addBuyInfo").remove();
                  $(".substract1").remove();
@@ -57,6 +63,13 @@
                          $(v).after($(v).val());
                      }
                  });
+                 
+                 // 非发起环节:根据合同类型隐藏采购申请单编号列和输入框
+                 var contractType = $("#contract_type").val();
+                 if(contractType == '1') {
+                     updateMaterialTableHeader(contractType);
+                     updatePurchaseNumberVisibility(contractType);
+                 }
         	}else{
         		// 发起环节:根据当前合同类型初始化需方供方显示(保留原有值)
         		var contractType = $("#contract_type").val();
@@ -68,6 +81,12 @@
         		addPayIdAndName();
         		updateContractMoneyState(); 
         		initPriceForProcess();
+        		
+        		// 如果是销售合同,初始化时隐藏采购申请单编号列和输入框
+        		if(contractType == '1') {
+        			updateMaterialTableHeader(contractType);
+        			updatePurchaseNumberVisibility(contractType);
+        		}
         	}
         	
              
@@ -549,6 +568,7 @@
 				    </c:when>
                     <c:otherwise>
                     	${contractInfo.contract_type_name }
+						<input id="contract_type" name="contractInfo.contract_type" type="hidden" value="${contractInfo.contract_type }"/>
 				    </c:otherwise>
                 </c:choose>
 			</td> 

+ 11 - 0
src/main/webapp/yw/contract/contractFlowCustom/startContract.jsp

@@ -29,6 +29,17 @@
         	// 初始化合同类型监听器
         	initContractTypeListener();
         	
+        	// 设置初始合同类型值,用于后续变化检测
+        	var initialContractType = $("#contract_type").val();
+        	if (initialContractType) {
+        		$("#contract_type").data('last-value', initialContractType);
+        	}
+        	
+        	// 根据当前合同类型初始化表头显示
+        	if (initialContractType == '1') {
+        		updateMaterialTableHeader(initialContractType);
+        	}
+        	
         	$("#contract_signdate").ligerDateEditor({ showTime: false,  labelAlign: 'left'});
         	loadTypeTree("selectUserButton1",{type:"singleuser",tab:"1,3,8",backId:"salesman",backName:"salesman_name"});
         	loadTypeTree("selectDeptButton",{type:"singledept",tab:"1",backId:"duty_department",backName:"duty_department_name"});

+ 6 - 0
src/main/webapp/yw/contract/contractFlowCustom/viewContract.jsp

@@ -45,6 +45,11 @@
                          $(v).after($(v).val());
                      }
                  });
+                var contractType = $("#contract_type").val();
+                if(contractType == '1') {
+                    updateMaterialTableHeader(contractType);
+                    updatePurchaseNumberVisibility(contractType);
+                }
         	}else{
         		addMaterialIdAndName();
         		addPayIdAndName();
@@ -429,6 +434,7 @@
     <br> 
 	<!-- 存储公司名称,用于销售合同时对调需方供方 -->
 	<input id="companyName" name="companyName" value="${contractInfo.firstparty_name}" type="hidden"/>
+    <input id="contract_type" name="contractInfo.contract_type" type="hidden" value="${contractInfo.contract_type }"/>
 </form>
 </body>
 </html>

+ 48 - 0
src/main/webapp/yw/contract/contractMyLaunchList.jsp

@@ -65,6 +65,22 @@
 										name : 'secondparty_name',
 										width : 200
 									},
+									{
+										display : '合同金额',
+										name : 'contract_money',
+										width : 120,
+										render : function(row) {
+											if(row.contract_money) {
+												return '¥' + parseFloat(row.contract_money).toFixed(2);
+											}
+											return '';
+										}
+									},
+									{
+										display : '录入日期',
+										name : 'contract_entrying_date',
+										width : 110
+									},
 									/* {
 										display : '合同类型',
 										name : 'contract_type_name',
@@ -188,6 +204,22 @@
 										name : 'secondparty_name',
 										width : 200
 									},
+									{
+										display : '合同金额',
+										name : 'contract_money',
+										width : 120,
+										render : function(row) {
+											if(row.contract_money) {
+												return '¥' + parseFloat(row.contract_money).toFixed(2);
+											}
+											return '';
+										}
+									},
+									{
+										display : '录入日期',
+										name : 'contract_entrying_date',
+										width : 110
+									},
 									/* {
 										display : '合同类型',
 										name : 'contract_type_name',
@@ -310,6 +342,22 @@
 										name : 'secondparty_name',
 										width : 200
 									},
+									{
+										display : '合同金额',
+										name : 'contract_money',
+										width : 120,
+										render : function(row) {
+											if(row.contract_money) {
+												return '¥' + parseFloat(row.contract_money).toFixed(2);
+											}
+											return '';
+										}
+									},
+									{
+										display : '录入日期',
+										name : 'contract_entrying_date',
+										width : 110
+									},
 									/* {
 										display : '合同类型',
 										name : 'contract_type_name',

+ 27 - 5
src/main/webapp/yw/contract/selectMaterialForContract.jsp

@@ -23,11 +23,24 @@ $(document).ready(function(){
 	if('${checkValue}' != "" && typeof ('${checkValue}') != "undefined"){
 		checkValue = '${checkValue}'.split(",");
 	}
-	// 默认选择采购申请
-	$(".mes_search").hide();
-	$(".pur_search").show();
-	$("#dataSource").val("2");
-	initPurchaseDetailList();
+	// 如果合同类型为销售合同(contract_type=1),隐藏采购申请相关UI
+	var contractType = '${contractType}';
+	if(contractType == '1') {
+		// 销售合同:隐藏物料来源选择、采购申请搜索区域和采购申请表格
+		$(".mes_search").show();
+		$(".pur_search").hide();
+		$("#dataSource").val("1"); // 设置为MES系统
+		$("#dataSource").parent().parent().hide(); // 隐藏整个物料来源选择行
+		$("#contractEntryGrid").show();
+		$("#purMaterialGrid").hide();
+		initMaterialList();
+	} else {
+		// 采购合同或其他:默认显示采购申请
+		$(".mes_search").hide();
+		$(".pur_search").show();
+		$("#dataSource").val("2");
+		initPurchaseDetailList();
+	}
 });
 
 function loadMaterialList(params) { 
@@ -134,6 +147,15 @@ function f_getCheckValue() {
 }
 
 function toggleDataSource() {
+	// 如果是销售合同,不允许切换数据源
+	var contractType = '${contractType}';
+	if(contractType == '1') {
+		$.ligerDialog.warn('销售合同只能从MES系统选择物料!');
+		// 恢复为MES系统
+		$("#dataSource").val("1");
+		return;
+	}
+	
 	grid = null;
     var source = $("#dataSource").val();
     if (source == "2") {

+ 29 - 9
src/main/webapp/yw/master1_contract/contractEntryList.jsp

@@ -5,6 +5,8 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 <title>合同档案</title>
+<link href="/shares/js/yw/master1/liger/skins/ynet/css/ligerui-all.css"
+	  rel="stylesheet" type="text/css" />
 <link href="/shares/css/yw/master1/reset.css" rel="stylesheet"
 	type="text/css" />
 <script
@@ -82,7 +84,25 @@
 // 									+ '(' + arr.contract_number + ')</p>';
 							html += '<p><img src="/shares/images/master1/rw_ico_menu.png" width="17" height="15"  /> '+ arr.contract_name
 								+ '(' + arr.contract_number + ') </p>';
-							html += '<p class="mar5">' + ss + '</p>';
+							// 在一行内显示需方/供方、金额、发起人、日期
+							var infoParts = [];
+							if(arr.contract_type == 1 && arr.firstparty_name) {
+								infoParts.push('需方:' + arr.firstparty_name);
+							} else if(arr.contract_type == 2 && arr.secondparty_name) {
+								infoParts.push('供方:' + arr.secondparty_name);
+							}
+							if(arr.contract_money) {
+								infoParts.push('¥' + parseFloat(arr.contract_money).toFixed(2));
+							}
+							if(arr.initiator) {
+								infoParts.push(arr.initiator);
+							}
+							if(ss) {
+								infoParts.push(ss);
+							}
+							if(infoParts.length > 0) {
+								html += '<p class="mar5" style="color:#666;font-size:12px;">' + infoParts.join(' | ') + '</p>';
+							}
 							html += '</div>';
 							//html += '</a>';
 							html += '<div class="tr_rw_btn_new fr" style="width:500px;" >';
@@ -221,19 +241,19 @@
 		if (window.confirm("确定要同步该销售合同到MES吗?")){ 
 			$.ligerDialog.waitting('正在同步到MES,请稍候...');
 			var param={'universalid':id};
-			sendAsyncAjax(param,"MTContractEntryAction.do?task=syncSaleOrderToMes",'json',syncSaleOrderProcess);
+			sendAsyncAjax(param,"contractEntry.do?task=syncSaleOrderToMes",'json',syncSaleOrderProcess);
 		}
 	}
 
 	function syncSaleOrderProcess(data){
-		$.ligerDialog.closeWaitting();
+		$.ligerDialog.closeWaitting(); 
 		search();
-		if(data.success!=null){
-			$.ligerDialog.success(data.success);
-		}else if(data.error!=null){
-			$.ligerDialog.error(data.error);
-		}else{
-			$.ligerDialog.error("同步失败!");
+		if(data.success!=null){ 
+			addInfo(data.success);
+		}else if(data.error!=null){ 
+			addError(data.error);
+		}else{ 
+			addError("同步失败!");
 		}
 	}
 </script>

+ 27 - 9
src/main/webapp/yw/master1_contract/contractMyLaunchList.jsp

@@ -99,7 +99,25 @@ function searchByKword(s) {
 							html += '【'+au_state_str+'】'
 						}
 						html += '</p>';
-						html += '<p class="mar5">' + ss + '</p>';
+						// 在一行内显示需方/供方、金额、发起人、日期
+						var infoParts = [];
+						if(arr.contract_type == 1 && arr.firstparty_name) {
+							infoParts.push('需方:' + arr.firstparty_name);
+						} else if(arr.contract_type == 2 && arr.secondparty_name) {
+							infoParts.push('供方:' + arr.secondparty_name);
+						}
+						if(arr.contract_money) {
+							infoParts.push('¥' + parseFloat(arr.contract_money).toFixed(2));
+						}
+						if(arr.initiator) {
+							infoParts.push(arr.initiator);
+						}
+						if(ss) {
+							infoParts.push(ss);
+						}
+						if(infoParts.length > 0) {
+							html += '<p class="mar5" style="color:#666;font-size:12px;">' + infoParts.join(' | ') + '</p>';
+						}
 						html += '</div>';
 						html += '</a>';
 						html += '<div class="tr_rw_btn_new fr" style="width:500px;">';
@@ -337,19 +355,19 @@ function syncSaleOrderToMes(id){
 	if (window.confirm("确定要同步该销售合同到MES吗?")){ 
 		$.ligerDialog.waitting('正在同步到MES,请稍候...');
 		var param={'universalid':id};
-		sendAsyncAjax(param,"MTContractEntryAction.do?task=syncSaleOrderToMes",'json',syncSaleOrderProcess);
+		sendAsyncAjax(param,"contractEntry.do?task=syncSaleOrderToMes",'json',syncSaleOrderProcess);
 	}
 }
 
 function syncSaleOrderProcess(data){
-	$.ligerDialog.closeWaitting();
+	$.ligerDialog.closeWaitting(); 
 	search();
-	if(data.success!=null){
-		$.ligerDialog.success(data.success);
-	}else if(data.error!=null){
-		$.ligerDialog.error(data.error);
-	}else{
-		$.ligerDialog.error("同步失败!");
+	if(data.success!=null){ 
+		addInfo(data.success);
+	}else if(data.error!=null){ 
+		addError(data.error);
+	}else{ 
+		addError("同步失败!");
 	}
 }
 </script>