tntdc 3 years ago
parent
commit
42b68c7044

+ 2 - 0
adm/src/main/java/com/minpay/db/table/own/mapper/OrderManageMapper.java

@@ -42,4 +42,6 @@ public interface OrderManageMapper extends  IMINMybatisEntityMapper {
 	List<Map<String, String>> selectorderStockInfo(Map<String, Object> map);
 
 	List<ApContractInf> selectApContractInf(Map<String, Object> contractMap, MINRowBounds rows);
+	
+	String selectTransferFlowSum(Map<String, Object> param);
 }

+ 49 - 0
adm/src/main/java/com/minpay/guomao/ordermanage/action/OrderManageAction.java

@@ -140,6 +140,9 @@ public class OrderManageAction implements IMINAction {
 	/**导出合同订单出入库(氧化铝,动力煤)*/
 	public final static String	ORDER_TOEXCELS		= "orderToexcels";
 	
+	/**传输数据查询*/
+	public final static String	QUERY_ORDER_TRANSFER		= "queryOrderTransfer";
+	
 	/**
 	 * 查询订单信息
 	 * orderId			订单ID
@@ -2386,4 +2389,50 @@ public class OrderManageAction implements IMINAction {
 		}
 		return response;
 	}
+
+	@MINAction(value = QUERY_ORDER_TRANSFER)
+	public MINActionResult queryOrderTransfer(@MINParam(key = "orderId") String orderId) throws MINBusinessException {
+		MINActionResult res = new MINActionResult();
+		ApOrderInf order = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
+		
+		Map<String, Object> param = new HashMap<>();
+		param.put("orderId", orderId);
+		// 已传输量
+		String transWeightNum = Service.lookup(IMINDataBaseService.class).getMybatisMapper(OrderManageMapper.class).selectTransferFlowSum(param);
+		// 总量
+		String stockWeightNum = Service.lookup(IMINDataBaseService.class).getMybatisMapper(OrderManageMapper.class).selectDetailStockSum(param);
+		List<String> notTypeList = new ArrayList<>();
+		notTypeList.add("02");
+		notTypeList.add("03");
+		// 查询商品数据
+		ApWarehouseStockExample example = new ApWarehouseStockExample();
+		example.createCriteria().andOrderIdEqualTo(orderId).andStartEqualTo("00").andTypeNotIn(notTypeList);
+		List<ApWarehouseStock> warehouseStockList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApWarehouseStockMapper.class).selectByExample(example);
+		List<String> standardIdList = new ArrayList<>();
+		for(ApWarehouseStock stock : warehouseStockList) {
+			if(!standardIdList.contains(stock.getStandardId())) {
+				standardIdList.add(stock.getStandardId());
+			}
+		}
+		ApProductSpecRelExample apProductSpecRelExample = new ApProductSpecRelExample();
+		apProductSpecRelExample.createCriteria().andSpecNoIn(standardIdList);
+		List<ApProductSpecRel> apProductSpecRelList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductSpecRelMapper.class).selectByExample(apProductSpecRelExample);
+		List<String> productIdList = new ArrayList<>();
+		for(ApProductSpecRel spec : apProductSpecRelList) {
+			if(!productIdList.contains(spec.getProductId())) {
+				productIdList.add(spec.getProductId());
+			}
+		}
+		ApProductInfExample apProductInfExample = new ApProductInfExample();
+		apProductInfExample.createCriteria().andIdIn(productIdList);
+		List<ApProductInf> apProductInfList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductInfMapper.class).selectByExample(apProductInfExample);
+		
+		// 返回数据
+		res.set("order", order);
+		res.set("transWeightNum", transWeightNum);
+		res.set("stockWeightNum", stockWeightNum);
+		res.set("remainingWeightNum", CommonUtil.subtract(stockWeightNum, transWeightNum, 4));
+		res.set("apProductInfList", apProductInfList);
+		return res;
+	}
 }

+ 316 - 301
adm/src/main/java/com/minpay/guomao/transManage/TransManageAction.java

@@ -10,10 +10,13 @@ import java.util.UUID;
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.logging.LogFactory;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.min.util.DateUtil;
 import com.minpay.common.service.IPublicService;
+import com.minpay.common.util.Base64;
 import com.minpay.common.util.CommonUtil;
 import com.minpay.common.util.HttpPostUtil;
 import com.minpay.db.table.mapper.ApCompanyInfMapper;
@@ -29,6 +32,7 @@ import com.minpay.db.table.model.ApProductInf;
 import com.minpay.db.table.model.ApTransferFlow;
 import com.startup.minpay.frame.business.IMINAction;
 import com.startup.minpay.frame.business.res.MINActionResult;
+import com.startup.minpay.frame.constant.IMINTransactionEnum;
 import com.startup.minpay.frame.exception.MINBusinessException;
 import com.startup.minpay.frame.service.base.IMINDataBaseService;
 import com.startup.minpay.frame.service.base.Service;
@@ -40,6 +44,7 @@ import net.sf.json.JSONObject;
 
 @MINComponent
 public class TransManageAction implements IMINAction{
+	private static org.apache.commons.logging.Log logger = LogFactory.getLog(TransManageAction.class);
 	
 	/**供应商传输 */
 	public final static String SUPPLIER_TRANSMISSION = "supplierTransmission";
@@ -64,17 +69,16 @@ public class TransManageAction implements IMINAction{
 	 * @throws MINBusinessException
 	 * @throws IOException 
 	 */
-	@MINAction(value = SUPPLIER_TRANSMISSION,session = false)
+	@MINAction(value = SUPPLIER_TRANSMISSION,session = false, transaction=IMINTransactionEnum.CMT)
 	public MINActionResult supplierTransmission(
 			HttpServletRequest request
 			) throws MINBusinessException, IOException{
 		MINActionResult res = new MINActionResult();
 		
-		int count = 0;
 		String GUID = request.getParameter("GUID");
 		String HEADER = request.getParameter("HEADER");
-		System.out.println(HEADER);
-		
+		logger.info("GUID:"+GUID);
+		logger.info("HEADER:"+HEADER);
 		//获取当前时间
 		String currentTime = DateUtil.getCurrentDateTimeString();
 		res.set("GUID", GUID);
@@ -100,10 +104,10 @@ public class TransManageAction implements IMINAction{
 				}
 				//统一社会信用代码---税号
 				String TAXNUMXL = CommonUtil.objToString(jsonHeader.get("TAXNUMXL"));
-				if(CommonUtil.isEmpty(TAXNUMXL)){
+				/*if(CommonUtil.isEmpty(TAXNUMXL)){
 					throw new MINBusinessException("TAXNUMXL不可为空!");
-				}
-				if(TAXNUMXL.length() > 50){
+				}*/
+				if(TAXNUMXL != null && TAXNUMXL.length() > 50){
 					throw new MINBusinessException("TAXNUMXL长度太长!");
 				}
 				
@@ -161,7 +165,7 @@ public class TransManageAction implements IMINAction{
 					companyInfo.setId(id);
 					//修改时间
 					companyInfo.setModifyTime(currentTime);
-					count = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).updateByPrimaryKeySelective(companyInfo);
+					Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).updateByPrimaryKeySelective(companyInfo);
 					
 				}else{
 					//不存在--新增
@@ -172,7 +176,7 @@ public class TransManageAction implements IMINAction{
 					companyInfo.setProjectCode("00001");
 					//部门
 					companyInfo.setBranchId("100002|100005|100197");
-					count = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).insertSelective(companyInfo);
+					Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).insertSelective(companyInfo);
 				}
 			}
 			
@@ -180,15 +184,13 @@ public class TransManageAction implements IMINAction{
 			e.printStackTrace();
 			res.set("STATUS", "E");
 			res.set("MESSAGE", "失败");
+			logger.info("status:error   message:"+e.getMessage());
+			return res;
 		}
 		
-		if(count == 1){
-			res.set("STATUS", "S");
-			res.set("MESSAGE", "成功");
-		}else{
-			res.set("STATUS", "E");
-			res.set("MESSAGE", "失败");
-		}
+		res.set("STATUS", "S");
+		res.set("MESSAGE", "成功");
+		logger.info("status : success");
 		return res;
 	}
 	
@@ -200,115 +202,125 @@ public class TransManageAction implements IMINAction{
 	 * @return
 	 * @throws MINBusinessException
 	 */
-	@MINAction(value = CUSTOMER_TRANSMISSION,session = false)
+	@MINAction(value = CUSTOMER_TRANSMISSION,session = false, transaction = IMINTransactionEnum.CMT)
 	public MINActionResult customerTransmission(
 			HttpServletRequest request
 			) throws MINBusinessException{
 		MINActionResult res = new MINActionResult();
 		
-		int count = 0;
 		String GUID = request.getParameter("GUID");
 		String HEADER = request.getParameter("HEADER");
+		logger.info("action:customerTransmission");
+		logger.info("GUID:"+GUID);
+		logger.info("HEADER:"+HEADER);
 		res.set("GUID", GUID);
 		//获取当前日期
 		String currentTime = DateUtil.getCurrentDateTimeString();
 		try {
-			JSONObject jsonHeader = JSONObject.fromObject(HEADER);
-			//供应商编号----ERP客商编码
-			String PARTNER = CommonUtil.objToString(jsonHeader.get("PARTNER"));
-			if(CommonUtil.isEmpty(PARTNER)){
-				throw new MINBusinessException("PARTNER不可为空!");
-			}
-			if(PARTNER.length() > 20){
-				throw new MINBusinessException("PARTNER长度太长!");
-			}
-			//供应商描述---客户名称
-			String NAME_ORG1 = CommonUtil.objToString(jsonHeader.get("NAME_ORG1"));
-			if(CommonUtil.isEmpty(NAME_ORG1)){
-				throw new MINBusinessException("NAME_ORG1不可为空!");
-			}
-			if(NAME_ORG1.length() > 30){
-				throw new MINBusinessException("NAME_ORG1长度太长!");
-			}
-			//统一社会信用代码---税号
-			String ZZ_TAXNUM = CommonUtil.objToString(jsonHeader.get("ZZ_TAXNUM"));
-			if(CommonUtil.isEmpty(ZZ_TAXNUM)){
-				throw new MINBusinessException("ZZ_TAXNUM不可为空!");
-			}
-			if(ZZ_TAXNUM.length() > 50){
-				throw new MINBusinessException("ZZ_TAXNUM长度太长!");
-			}
-			//简称
-			String ZYLZD1 = CommonUtil.objToString(jsonHeader.get("ZYLZD1"));
-			if(!CommonUtil.isEmpty(ZYLZD1)){
-				if(ZYLZD1.length() > 30){
-					throw new MINBusinessException("ZYLZD1长度太长!");
+			JSONArray jsonHeaderArray = JSONArray.parseArray(HEADER);
+			for(Object object : jsonHeaderArray) {
+				Map jsonHeader = (Map)object;
+				//供应商编号----ERP客商编码
+				String PARTNER = CommonUtil.objToString(jsonHeader.get("PARTNER"));
+				if(CommonUtil.isEmpty(PARTNER)){
+					throw new MINBusinessException("PARTNER不可为空!");
 				}
-			}
-			//客户首字母
-			String ZYLZD2 = CommonUtil.objToString(jsonHeader.get("ZYLZD2"));
-			if(!CommonUtil.isEmpty(ZYLZD2)){
-				if(ZYLZD2.length() > 20){
-					throw new MINBusinessException("ZYLZD2长度太长!");
+				if(PARTNER.length() > 20){
+					throw new MINBusinessException("PARTNER长度太长!");
+				}
+				//供应商描述---客户名称
+				String NAME_ORG1 = CommonUtil.objToString(jsonHeader.get("NAME_ORG1"));
+				if(CommonUtil.isEmpty(NAME_ORG1)){
+					throw new MINBusinessException("NAME_ORG1不可为空!");
+				}
+				if(NAME_ORG1.length() > 30){
+					throw new MINBusinessException("NAME_ORG1长度太长!");
+				}
+				//统一社会信用代码---税号
+				String ZZ_TAXNUM = CommonUtil.objToString(jsonHeader.get("ZZ_TAXNUM"));
+				/*if(CommonUtil.isEmpty(ZZ_TAXNUM)){
+					throw new MINBusinessException("ZZ_TAXNUM不可为空!");
+				}*/
+				if(ZZ_TAXNUM != null && ZZ_TAXNUM.length() > 50){
+					throw new MINBusinessException("ZZ_TAXNUM长度太长!");
+				}
+				//简称
+				String ZYLZD1 = CommonUtil.objToString(jsonHeader.get("ZYLZD1"));
+				if(!CommonUtil.isEmpty(ZYLZD1)){
+					if(ZYLZD1.length() > 30){
+						throw new MINBusinessException("ZYLZD1长度太长!");
+					}
+				}
+				//客户首字母
+				String ZYLZD2 = CommonUtil.objToString(jsonHeader.get("ZYLZD2"));
+				if(!CommonUtil.isEmpty(ZYLZD2)){
+					if(ZYLZD2.length() > 20){
+						throw new MINBusinessException("ZYLZD2长度太长!");
+					}
+				}
+				//系统内外
+				String ZYLZD3 = CommonUtil.objToString(jsonHeader.get("ZYLZD3"));
+				//客户类型 MM-采购  SD--销售
+				//String ZYLZD4 = CommonUtil.objToString(jsonHeader.get("ZYLZD4"));
+				//查询客户是否存在
+				ApCompanyInfExample example = new ApCompanyInfExample();
+				example.createCriteria().andErpCodeEqualTo(PARTNER).andStateEqualTo("00");
+				List<ApCompanyInf> list =	Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).selectByExample(example);
+				
+				ApCompanyInf companyInfo = new ApCompanyInf();
+				//ERP客商编码
+				companyInfo.setErpCode(PARTNER);
+				//客户名称
+				companyInfo.setName(NAME_ORG1);
+				//税号
+				companyInfo.setDutyParagraph(ZZ_TAXNUM);
+				//简称
+				companyInfo.setShortName(ZYLZD1);
+				//客户首字母
+				companyInfo.setInitial(ZYLZD2);
+				//系统内外	TODO 需做处理
+				//系统内外
+				if("内".equals(ZYLZD3)) {
+					companyInfo.setType("00");
+				} else {
+					companyInfo.setType("01");
+				}
+				/*if("MM".equals(ZYLZD4)){
+					companyInfo.setBuyType("00");
+				}else if("SD".equals(ZYLZD4)){
+					companyInfo.setBuyType("01");
+				}*/
+				companyInfo.setBuyType("02");
+				//存在---做修改
+				if(list.size() > 0){
+					String id = list.get(0).getId();
+					companyInfo.setId(id);
+					//修改时间
+					companyInfo.setModifyTime(currentTime);
+					Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).updateByPrimaryKeySelective(companyInfo);
+				}else{
+					//不存在--新增
+					String id = Service.lookup(IPublicService.class).getSequence("AP_CUSTOMER_INF_ID");
+					companyInfo.setId(id);
+					//部门
+					companyInfo.setBranchId("100002|100005|100197");
+					companyInfo.setProjectCode("00001");
+					//创建时间
+					companyInfo.setCreateTime(currentTime);
+					Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).insertSelective(companyInfo);
 				}
-			}
-			//系统内外
-			String ZYLZD3 = CommonUtil.objToString(jsonHeader.get("ZYLZD3"));
-			//客户类型 MM-采购  SD--销售
-			String ZYLZD4 = CommonUtil.objToString(jsonHeader.get("ZYLZD4"));
-			//查询客户是否存在
-			ApCompanyInfExample example = new ApCompanyInfExample();
-			example.createCriteria().andErpCodeEqualTo(PARTNER).andStateEqualTo("00");
-			List<ApCompanyInf> list =	Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).selectByExample(example);
-			
-			ApCompanyInf companyInfo = new ApCompanyInf();
-			//ERP客商编码
-			companyInfo.setErpCode(PARTNER);
-			//客户名称
-			companyInfo.setName(NAME_ORG1);
-			//税号
-			companyInfo.setDutyParagraph(ZZ_TAXNUM);
-			//简称
-			companyInfo.setShortName(ZYLZD1);
-			//客户首字母
-			companyInfo.setInitial(ZYLZD2);
-			//系统内外	TODO 需做处理
-			companyInfo.setType(ZYLZD3);
-			if("MM".equals(ZYLZD4)){
-				companyInfo.setBuyType("00");
-			}else if("SD".equals(ZYLZD4)){
-				companyInfo.setBuyType("01");
-			}
-			//存在---做修改
-			if(list.size() > 0){
-				String id = list.get(0).getId();
-				companyInfo.setId(id);
-				//修改时间
-				companyInfo.setModifyTime(currentTime);
-				count = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).updateByPrimaryKeySelective(companyInfo);
-			}else{
-				//不存在--新增
-				String id = Service.lookup(IPublicService.class).getSequence("AP_CUSTOMER_INF_ID");
-				companyInfo.setId(id);
-				//部门
-				companyInfo.setBranchId("100002|100005|100197");
-				companyInfo.setProjectCode("00001");
-				//创建时间
-				companyInfo.setCreateTime(currentTime);
-				count = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApCompanyInfMapper.class).insertSelective(companyInfo);
 			}
 		} catch (Exception e) {
+			e.printStackTrace();
 			res.set("STATUS", "E");
 			res.set("MESSAGE", "失败");
+			logger.info("status:error   message:"+e.getMessage());
+			return res;
 		}
 		
-		if(count == 1){
-			res.set("STATUS", "S");
-			res.set("MESSAGE", "成功");
-		}else{
-			res.set("STATUS", "E");
-			res.set("MESSAGE", "失败");
-		}
+		res.set("STATUS", "S");
+		res.set("MESSAGE", "成功");
+		logger.info("status : success");
 		return res;
 	}
 	
@@ -337,13 +349,7 @@ public class TransManageAction implements IMINAction{
 	public MINActionResult purchaseOrderTransmission(
 			@MINParam(key ="orderId") String orderId,
 			@MINParam(key ="erpPostingDate") String erpPostingDate,
-			@MINParam(key ="transferNum") String transferNum,
-			@MINParam(key ="preSettlement") String preSettlement,
-			@MINParam(key ="realPrice") String realPrice,
-			@MINParam(key ="actualTotal") String actualTotal,
-			@MINParam(key ="preTotal") String preTotal,
-			@MINParam(key ="aoiTransferredNum") String aoiTransferredNum,
-			@MINParam(key ="aoiRemainingTransNum") String aoiRemainingTransNum
+			@MINParam(key ="tableListStr") String tableListStr
 			) throws MINBusinessException{
 		ApOrderInf order = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
 		String contractId = order.getContractId();
@@ -354,21 +360,7 @@ public class TransManageAction implements IMINAction{
 		if(CommonUtil.isEmpty(erpPostingDate)){
 			throw new MINBusinessException("ERP过账日期不可为空!");
 		}
-		//查询铝锭产品信息  --上海铝锭
-		ApProductInf productInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductInfMapper.class).selectByPrimaryKey("O100000073");
-		if(productInf == null){
-			throw new MINBusinessException("获取产品信息失败!");
-		}
-		//获取ERP物料编码
-		String MATNR = productInf.getErpCode();
-		if(CommonUtil.isEmpty(MATNR)){
-			throw new MINBusinessException("请先维护产品的ERP物料编码!");
-		}
-		//获取单位换算比例
-		String Z_RATIO = productInf.getUnitRatio();
-		if(CommonUtil.isEmpty(Z_RATIO)){
-			throw new MINBusinessException("请先维护产品的单位换算比例!");
-		}
+
 		MINActionResult res = new MINActionResult();
 		Map<Object, Object> requestBody = new HashMap<>();
 		String GUID = UUID.randomUUID().toString().replaceAll("-", "");
@@ -387,19 +379,36 @@ public class TransManageAction implements IMINAction{
 		//采购组织
 		hederMap.put("EKORG","2405");
 		//采购组
+		if(CommonUtil.isEmpty(contractInf.getPurchaseTeam())) {
+			throw new MINBusinessException("合同采购组未维护,请先在合同编辑中维护采购组!");
+		}
 		hederMap.put("EKGRP",contractInf.getPurchaseTeam());
 		//公司代码
 		hederMap.put("BUKRS","2405");
 		//凭证类型
 		hederMap.put("BSART", "C001");
 		//订单名称
+		if(CommonUtil.isEmpty(order.getName())) {
+			throw new MINBusinessException("订单名称不可为空!");
+		}
 		hederMap.put("Z_DSPT_NO", order.getName());
 		//法务合同号
+		if(CommonUtil.isEmpty(contractInf.getLegalContractNo())) {
+			throw new MINBusinessException("合同法务合同号未维护,请先在合同编辑中填写!");
+		}
 		hederMap.put("ZZCONTRACTCODE", contractInf.getLegalContractNo());
 		//ERP客户编码
+		if(CommonUtil.isEmpty(companyInf.getErpCode())) {
+			throw new MINBusinessException("客户暂无ERP编码!");
+		}
 		hederMap.put("KUNNR", companyInf.getErpCode());
 		//单据日期
+		if(CommonUtil.isEmpty(erpPostingDate)) {
+			throw new MINBusinessException("请选择单据日期!");
+		}
 		hederMap.put("AUDAT", erpPostingDate);
+		// 客户名称
+		hederMap.put("NAME1", companyInf.getName());
 		//合同类型长单---Y 其他--N
 		if("00".equals(contractInf.getContractType())){
 			hederMap.put("Z_FLAG","Y");
@@ -408,63 +417,83 @@ public class TransManageAction implements IMINAction{
 		}
 		List<Map<String,String>> list = new ArrayList<>();
 		hederMap.put("item", list);
-		Map<String,String> itemMap = new HashMap<>();
-		//行号
-		itemMap.put("POSNR", "1");
-		//物料编号
-		itemMap.put("MATNR",MATNR);
-		//物料描述
-		itemMap.put("ARKTX", "");
-		//本次传输数量
-		itemMap.put("MENGE",transferNum);
-		//单位换算比例
-		itemMap.put("Z_RATIO",Z_RATIO);
-		//单价有实际单价传实际单价,无实际单价,传预结算单价
-		if(CommonUtil.compare(preSettlement, "0") == 1){
-			itemMap.put("Z_PRICE", preSettlement);
-		}else{
-			itemMap.put("Z_PRICE",realPrice);
+		JSONArray tableList = JSONArray.parseArray(tableListStr);
+		for(int i = 0; i < tableList.size(); i ++) {
+			Map data = (Map)tableList.get(i);
+			Map<String,String> itemMap = new HashMap<>();
+			ApProductInf productInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductInfMapper.class).selectByPrimaryKey(data.get("product").toString());
+			//行号
+			itemMap.put("POSNR", i+1+"");
+			//物料编号
+			if(CommonUtil.isEmpty(productInf.getErpCode())) {
+				throw new MINBusinessException(productInf.getName()+"未维护ERP物料编号,请在牌价管理中编辑对应物料编号!");
+			}
+			itemMap.put("MATNR",productInf.getErpCode());
+			//物料描述
+			itemMap.put("ARKTX", "");
+			//本次传输数量
+			if(data.get("weight") == null || CommonUtil.isEmpty(data.get("weight").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写传输重量!");
+			}
+			itemMap.put("MENGE",data.get("weight").toString());
+			//单位换算比例
+			if(CommonUtil.isEmpty(productInf.getUnitRatio())) {
+				throw new MINBusinessException(productInf.getName()+"未维护单位换算比例,请在牌价管理中编辑对应单位换算比例!");
+			}
+			itemMap.put("Z_RATIO",productInf.getUnitRatio());
+			// 单价
+			if(data.get("price") == null || CommonUtil.isEmpty(data.get("price").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写价格!");
+			}
+			itemMap.put("Z_PRICE", data.get("price").toString());
+			//总金额 
+			if(data.get("amount") == null || CommonUtil.isEmpty(data.get("amount").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写总金额!");
+			}
+			itemMap.put("Z_VALUE", data.get("amount").toString());
+			//税码
+			itemMap.put("MWSKZ","J3");
+			//工厂
+			itemMap.put("WERKS","2405");
+			//库存地点
+			itemMap.put("LGORT","A001");
+			list.add(itemMap);
 		}
-		//总金额 有实际结算总价传实际结算总价,无实际结算总价,传预结算总价
-		if(CommonUtil.compare(preTotal, "0") == 1){
-			itemMap.put("Z_VALUE", preTotal);
+		
+		//调用
+		String url = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_URL");
+		String user = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_USER");
+		String pass = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_PASS");
+		System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(requestBody));
+		String result = HttpPostUtil.sendPostRequest(url+"LDDZSW/MM858", requestBody, user, pass);
+		System.out.println(result);
+		//{"GUID":"17d342743c474a1ca22c7e56e5ed3337","RETURN":[{"STATUS":"S","MESSAGE":" [采购订单创建成功] [订单审批成功] [订单收货成功]","Z_DSPY_NO":"DC22-0607-WXGL01","EBELN":4500010225}]}
+		JSONObject resultJson = JSONObject.fromObject(result);
+		//SAP销售订单号
+		net.sf.json.JSONArray returnObject = resultJson.getJSONArray("RETURN");
+		
+		//获取订单信息
+		ApOrderInf orderInfo = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
+		//获取ERP单号
+		String erpNo = orderInfo.getErpNo();
+		//SAP销售订单号
+		Map EBELNMap = (Map)(returnObject.get(0));
+		String EBELN = EBELNMap.get("EBELN").toString();
+		//ERP单号为空
+		if(!CommonUtil.isEmpty(erpNo)){
+			//erp单号
+			orderInfo.setErpNo(erpNo+"/"+EBELN);
 		}else{
-			itemMap.put("Z_VALUE",actualTotal);
+			//erp单号
+			orderInfo.setErpNo(EBELN);
 		}
-		//税码
-		itemMap.put("MWSKZ","J3");
-		//工厂
-		itemMap.put("WERKS","2405");
-		//库存地点
-		itemMap.put("LGORT","A001");
-		list.add(itemMap);
-		try {
-			//调用
-			String url = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_URL");
-			String user = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_USER");
-			String pass = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_PASS");
-			System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(requestBody));
-			String result = HttpPostUtil.sendPostRequest(url+"CGFH/MM858", requestBody, user, pass);
-			System.out.println(result);
-			//SAP销售订单号
-			String VBELN = "";
-			//获取订单信息
-			ApOrderInf orderInfo = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
-			//获取ERP单号
-			String erpNo = orderInfo.getErpNo();
-			//ERP单号为空
-			if(!CommonUtil.isEmpty(erpNo)){
-				//erp单号
-				orderInfo.setErpNo(erpNo+"/"+VBELN);
-			}else{
-				//erp单号
-				orderInfo.setErpNo(VBELN);
-			}
-			
-			//修改时间
-			orderInfo.setModifyTime(TIMESTAMP);
-			//修改订单
-			Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).updateByPrimaryKeySelective(orderInfo);
+		
+		//修改时间
+		orderInfo.setModifyTime(TIMESTAMP);
+		//修改订单
+		Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).updateByPrimaryKeySelective(orderInfo);
+		for(int i = 0; i < tableList.size(); i ++) {
+			Map data = (Map)tableList.get(i);
 			//生成订单传输流水
 			String flowId = Service.lookup(IPublicService.class).getSequence("AP_TRANST_ORDER_FLOW_ID");
 			ApTransferFlow flow = new ApTransferFlow();
@@ -477,33 +506,26 @@ public class TransManageAction implements IMINAction{
 			//erp过账日期
 			flow.setErpDate(erpPostingDate);
 			//已传输数量
-			flow.setTransferredNum(aoiTransferredNum);
+			flow.setTransferredNum("");
 			//本次传输数量
-			flow.setTransferNum(aoiTransferredNum);
+			flow.setTransferNum(data.get("weight").toString());
 			//剩余传输数量
-			flow.setRemainingTransNum(aoiRemainingTransNum);
+			flow.setRemainingTransNum("");
 			//预结算单价
-			flow.setPrePrice(preSettlement);
+			flow.setPrePrice("");
 			//实际单价
-			flow.setRealPrice(realPrice);
+			flow.setRealPrice(data.get("price").toString());
 			//预结算总价
-			flow.setPreTotal(preTotal);
+			flow.setPreTotal("");
 			//实际结算总价
-			flow.setRealTotal(actualTotal);
+			flow.setRealTotal(data.get("amount").toString());
 			//erp单号
-			flow.setErpNo(VBELN);
+			flow.setErpNo(EBELN);
 			//创建时间
 			flow.setCreateTime(TIMESTAMP);
 			//创建人		TODO
 			Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApTransferFlowMapper.class).insertSelective(flow);
-		} catch (Exception e) {
-			e.printStackTrace();
 		}
-		
-		
-		
-		
-		
 		return res;
 	}
 	
@@ -516,7 +538,6 @@ public class TransManageAction implements IMINAction{
 	 * @param buyerNameAll
 	 * @param erpPostingDate
 	 * @param contractType
-	 * @param transferNum
 	 * @param preSettlement
 	 * @param realPrice
 	 * @param actualTotal
@@ -528,15 +549,8 @@ public class TransManageAction implements IMINAction{
 	@MINAction(value = SALE_ORDER_TRANSMISSION,session = false)
 	public MINActionResult saleOrderTransmission(
 			@MINParam(key ="orderId") String orderId,
-			@MINParam(key ="buyerNameAll") String buyerNameAll,
 			@MINParam(key ="erpPostingDate") String erpPostingDate,
-			@MINParam(key ="transferNum") String transferNum,
-			@MINParam(key ="preSettlement") String preSettlement,
-			@MINParam(key ="realPrice") String realPrice,
-			@MINParam(key ="actualTotal") String actualTotal,
-			@MINParam(key ="preTotal") String preTotal,
-			@MINParam(key ="aoiTransferredNum") String aoiTransferredNum,
-			@MINParam(key ="aoiRemainingTransNum") String aoiRemainingTransNum
+			@MINParam(key ="tableListStr") String tableListStr
 			) throws MINBusinessException{
 		ApOrderInf order = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
 		String contractId = order.getContractId();
@@ -551,27 +565,7 @@ public class TransManageAction implements IMINAction{
 		if(CommonUtil.isEmpty(erpPostingDate)){
 			throw new MINBusinessException("ERP过账日期不可为空!");
 		}
-		//查询铝锭产品信息  --上海铝锭
-		ApProductInf productInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductInfMapper.class).selectByPrimaryKey("O100000073");
-		if(productInf == null){
-			throw new MINBusinessException("获取产品信息失败!");
-		}
-		//获取ERP物料编码
-		String MATNR = productInf.getErpCode();
-		if(CommonUtil.isEmpty(MATNR)){
-			throw new MINBusinessException("请先维护产品的ERP物料编码!");
-		}
-		//获取单位换算比例
-		String Z_RATIO = productInf.getUnitRatio();
-		if(CommonUtil.isEmpty(Z_RATIO)){
-			throw new MINBusinessException("请先维护产品的单位换算比例!");
-		}
-		if(CommonUtil.isEmpty(aoiTransferredNum)){
-			throw new MINBusinessException("已传输数量不可为空!");
-		}
-		if(CommonUtil.isEmpty(aoiRemainingTransNum)){
-			throw new MINBusinessException("剩余传输数量不可为空!");
-		}
+		
 		MINActionResult res = new MINActionResult();
 		Map<Object, Object> requestBody = new HashMap<>();
 		String GUID = UUID.randomUUID().toString().replaceAll("-", "");
@@ -595,15 +589,28 @@ public class TransManageAction implements IMINAction{
 		hederMap.put("SPART","10");
 		//订单类型
 		hederMap.put("AUART","Z040");
+		if(CommonUtil.isEmpty(orderName)){
+			throw new MINBusinessException("订单名称不可为空!");
+		}
 		//电商系统单号
 		hederMap.put("Z_DSPT_NO", orderName);
 		//法务合同号
+		//法务合同号
+		if(CommonUtil.isEmpty(legalContractNo)) {
+			throw new MINBusinessException("合同法务合同号未维护,请先在合同编辑中填写!");
+		}
 		hederMap.put("BSTNK", legalContractNo);
 		//ERP客户编码
+		if(CommonUtil.isEmpty(buyerErpCode)) {
+			throw new MINBusinessException("客户暂无ERP编码!");
+		}
 		hederMap.put("KUNNR", buyerErpCode);
 		//客户名称
-		hederMap.put("NAME1", buyerNameAll);
+		hederMap.put("NAME1", companyInf.getName());
 		//单据日期
+		if(CommonUtil.isEmpty(erpPostingDate)) {
+			throw new MINBusinessException("请选择单据日期!");
+		}
 		hederMap.put("AUDAT", erpPostingDate);
 		//合同类型长单---Y 其他--N
 		if("00".equals(contractType)){
@@ -613,61 +620,82 @@ public class TransManageAction implements IMINAction{
 		}
 		List<Map<String,String>> list = new ArrayList<>();
 		hederMap.put("item", list);
-		Map<String,String> itemMap = new HashMap<>();
-		//行号
-		itemMap.put("POSNR", "1");
-		//物料编号
-		itemMap.put("MATNR",MATNR);
-		//物料描述
-		itemMap.put("ARKTX", "");
-		//本次传输数量
-		itemMap.put("KWMENG",transferNum);
-		//单位换算比例
-		itemMap.put("Z_RATIO",Z_RATIO);
-		//单价有实际单价传实际单价,无实际单价,传预结算单价 
-		if(CommonUtil.compare(preSettlement, "0") == 1){
-			itemMap.put("Z_PRICE", preSettlement);
-		}else{
-			itemMap.put("Z_PRICE",realPrice);
+		JSONArray tableList = JSONArray.parseArray(tableListStr);
+		for(int i = 0; i < tableList.size(); i ++) {
+			Map data = (Map)tableList.get(i);
+			Map<String,String> itemMap = new HashMap<>();
+			ApProductInf productInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApProductInfMapper.class).selectByPrimaryKey(data.get("product").toString());
+			
+			//行号
+			itemMap.put("POSNR", i+1+"");
+			//物料编号
+			if(CommonUtil.isEmpty(productInf.getErpCode())) {
+				throw new MINBusinessException(productInf.getName()+"未维护ERP物料编号,请在牌价管理中编辑对应物料编号!");
+			}
+			itemMap.put("MATNR", productInf.getErpCode());
+			//物料描述
+			itemMap.put("ARKTX", "");
+			//本次传输数量
+			if(data.get("weight") == null || CommonUtil.isEmpty(data.get("weight").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写传输重量!");
+			}
+			itemMap.put("KWMENG", data.get("weight").toString());
+			//单位换算比例
+			if(CommonUtil.isEmpty(productInf.getUnitRatio())) {
+				throw new MINBusinessException(productInf.getName()+"未维护单位换算比例,请在牌价管理中编辑对应单位换算比例!");
+			}
+			itemMap.put("Z_RATIO", productInf.getUnitRatio());
+			// 单价
+			if(data.get("price") == null || CommonUtil.isEmpty(data.get("price").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写价格!");
+			}
+			itemMap.put("Z_PRICE", data.get("price").toString());
+			//总金额 
+			if(data.get("amount") == null || CommonUtil.isEmpty(data.get("amount").toString())) {
+				throw new MINBusinessException("第"+(i+1)+"行数据未填写总金额!");
+			}
+			itemMap.put("Z_VALUE", data.get("amount").toString());
+			//工厂
+			itemMap.put("WERKS","2405");
+			//库存地点
+			itemMap.put("LGORT","A001");
+			list.add(itemMap);
 		}
-		//总金额 有实际结算总价传实际结算总价,无实际结算总价,传预结算总价
-		if(CommonUtil.compare(preTotal, "0") == 1){
-			itemMap.put("Z_VALUE", preTotal);
+		
+		
+		String url = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_URL");
+		String user = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_USER");
+		String pass = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_PASS");
+		//调用
+		System.out.println(JSON.toJSONString(requestBody));
+		String result = HttpPostUtil.sendPostRequest(url+"LDDZSW/SD418", requestBody, user, pass);
+		System.out.println("result:======"+result);
+		//{"GUID":"142d8a14bd2c43cda8e037e0d492c14b","RETURN":[{"STATUS":"S","MESSAGE":" [销售订单创建成功]","Z_DSPY_NO":"DX22-1107-TK01","VBELN":"0020003034"}]}
+		JSONObject resultJson = JSONObject.fromObject(result);
+		//SAP销售订单号
+		net.sf.json.JSONArray returnObject = resultJson.getJSONArray("RETURN");
+		//获取订单信息
+		ApOrderInf orderInfo = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
+		//获取ERP单号
+		String erpNo = orderInfo.getErpNo();
+		Map VBELNMap = (Map)(returnObject.get(0));
+		String VBELN = VBELNMap.get("VBELN").toString();
+		//ERP单号为空
+		if(!CommonUtil.isEmpty(erpNo)){
+			//erp单号
+			orderInfo.setErpNo(erpNo+"/"+VBELN);
 		}else{
-			itemMap.put("Z_VALUE",actualTotal);
+			//erp单号
+			orderInfo.setErpNo(VBELN);
 		}
-		//工厂
-		itemMap.put("WERKS","2405");
-		//库存地点
-		itemMap.put("LGORT","A001");
-		list.add(itemMap);
-		try {
-			String url = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_URL");
-			String user = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_USER");
-			String pass = Service.lookup(IPublicService.class).getSysParValue("TRANSFER_ORDER_PASS");
-			//调用
-			System.out.println(JSON.toJSONString(requestBody));
-			String result = HttpPostUtil.sendPostRequest(url+"XSFH/SD418", requestBody, user, pass);
-			System.out.println("result:======"+result);
-			//SAP销售订单号
-			String VBELN = "";
-			//获取订单信息
-			ApOrderInf orderInfo = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).selectByPrimaryKey(orderId);
-			//获取ERP单号
-			String erpNo = orderInfo.getErpNo();
-			//ERP单号为空
-			if(!CommonUtil.isEmpty(erpNo)){
-				//erp单号
-				orderInfo.setErpNo(erpNo+"/"+VBELN);
-			}else{
-				//erp单号
-				orderInfo.setErpNo(VBELN);
-			}
-			
-			//修改时间
-			orderInfo.setModifyTime(TIMESTAMP);
-			//修改订单
-			Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).updateByPrimaryKeySelective(orderInfo);
+		
+		//修改时间
+		orderInfo.setModifyTime(TIMESTAMP);
+		//修改订单
+		Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApOrderInfMapper.class).updateByPrimaryKeySelective(orderInfo);
+		
+		for(int i = 0; i < tableList.size(); i ++) {
+			Map data = (Map)tableList.get(i);
 			//生成订单传输流水
 			String flowId = Service.lookup(IPublicService.class).getSequence("AP_TRANST_ORDER_FLOW_ID");
 			ApTransferFlow flow = new ApTransferFlow();
@@ -680,43 +708,30 @@ public class TransManageAction implements IMINAction{
 			//erp过账日期
 			flow.setErpDate(erpPostingDate);
 			//已传输数量
-			flow.setTransferredNum(aoiTransferredNum);
+			flow.setTransferredNum("");
 			//本次传输数量
-			flow.setTransferNum(aoiTransferredNum);
+			flow.setTransferNum(data.get("weight").toString());
 			//剩余传输数量
-			flow.setRemainingTransNum(aoiRemainingTransNum);
+			flow.setRemainingTransNum("");
 			//预结算单价
-			flow.setPrePrice(preSettlement);
+			flow.setPrePrice("");
 			//实际单价
-			flow.setRealPrice(realPrice);
+			flow.setRealPrice(data.get("price").toString());
 			//预结算总价
-			flow.setPreTotal(preTotal);
+			flow.setPreTotal("");
 			//实际结算总价
-			flow.setRealTotal(actualTotal);
+			flow.setRealTotal(data.get("amount").toString());
 			//erp单号
 			flow.setErpNo(VBELN);
 			//创建时间
 			flow.setCreateTime(TIMESTAMP);
 			//创建人		TODO
 			Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApTransferFlowMapper.class).insertSelective(flow);
-			
-		} catch (Exception e) {
-			e.printStackTrace();
-			
 		}
-		
-		
-		
-		
-		
 		return res;
 	}
 	
 	public static void main(String[] args) {
-		String header = "[{'EKORG':'2405','LIFNR':'0010010867','NAME1':'DTceshi47','TAXNUMXL':'1234648646416341AV','LAND1':'CN','ORT01':'120100','ORT02':'','EXTRA1':'DTCESHI47','EXTRA2':'DT','EXTRA3':'鍐?','EXTRA4':'MM','EXTRA5':''},{'EKORG':'2405','LIFNR':'0010010908','NAME1':'娴嬭瘯渚涘簲鍟嗛摑鐢?0919','TAXNUMXL':'9876543234567','LAND1':'CN','ORT01':'','ORT02':'','EXTRA1':'閾濈數001','EXTRA2':'QWE','EXTRA3':'鍐?','EXTRA4':'MM','EXTRA5':''}]";
-		JSONArray array = JSONArray.parseArray(header);
-		for(Object object : array) {
-			System.out.println(object.toString());
-		}
+		System.out.println("Basic " + Base64.encode(("zzsoaplddzsw:SpicLdTtK9xEM3").getBytes()));
 	}
 }

+ 8 - 0
adm/src/main/resources/com/minpay/db/table/own/mapper/OrderManageMapper.xml

@@ -384,6 +384,14 @@
 		</foreach>
     </if>
   </select>
+  <select id="selectTransferFlowSum" resultType="String" parameterType="java.util.Map">
+  	select 
+  		cast(ROUND(IFNULL(SUM(ATF_TRANSFER_NUM),'0.00'),4) as char) transNum 
+  	from 
+  		ap_transfer_flow 
+  	where 
+  		ATF_ORDER_ID = #{orderId}
+  </select>
   <sql id="Base_Column_List">
     ACI_ID, ACI_NAME, ACI_TYPE, ACI_CONTRACT_TYPE, ACI_BUYER_ID, ACI_SELLER_ID, ACI_CONTRACT_NO, 
     ACI_BUYER_NO, ACI_SELLER_NO, ACI_PRICING_TYPE, ACI_PRICING_START, ACI_PRICING_END, 

+ 8 - 5
adm/src/main/webapp/WEB-INF/config.properties

@@ -6,13 +6,16 @@
 #dataSource.url=jdbc:mysql://123.138.111.28:3506/guomaotest?useUnicode=true&characterEncoding=UTF8&autoReconnect=true
 #dataSource.username=root
 #dataSource.password=123456
-#dataSource.url=jdbc:mysql://127.0.0.1:3306/guomao?useUnicode=true&characterEncoding=UTF8&autoReconnect=true
+#dataSource.url=jdbc:mysql://106.12.253.71:3306/guomaotest?useUnicode=true&characterEncoding=UTF8&autoReconnect=true
 #dataSource.username=root
-#dataSource.password=12345
+#dataSource.password=Keao@2022
 #shengchan
-dataSource.url=jdbc:mysql://rm-bp1fic3mnw98q3149to.mysql.rds.aliyuncs.com:3306/guomaodb?useUnicode=true&characterEncoding=UTF8
-dataSource.username=guomaouser
-dataSource.password=Aa111111
+#dataSource.url=jdbc:mysql://rm-bp1fic3mnw98q3149to.mysql.rds.aliyuncs.com:3306/guomaodb?useUnicode=true&characterEncoding=UTF8
+#dataSource.username=guomaouser
+#dataSource.password=Aa111111
+dataSource.url=jdbc:mysql://172.16.128.210:3306/guomaodb?useUnicode=true&characterEncoding=UTF8
+dataSource.username=root
+dataSource.password=123456
 
 
 config.MINDebug=false

+ 10 - 0
adm/src/main/webapp/WEB-INF/log4j.properties

@@ -25,6 +25,16 @@ log4j.appender.XN.MaxBackupIndex=20
 log4j.appender.XN.layout=org.apache.log4j.PatternLayout  
 log4j.appender.XN.layout.ConversionPattern=FLSID:%X{FID} %d{ISO8601} %c %M:  %-5p - %m%n
 
+
+log4j.logger.com.minpay.guomao.transManage.TransManageAction = DEBUG, consume
+log4j.appender.consume=org.apache.log4j.FileAppender
+log4j.appender.consume.Threshold=debug
+log4j.appender.consume.File=/home/soft/transManage/transManage.log
+log4j.appender.consume.MaxFileSize= 20480KB
+log4j.appender.consume.MaxBackupIndex=20
+log4j.appender.consume.layout=org.apache.log4j.PatternLayout
+log4j.appender.consume.layout.ConversionPattern=FLSID:%X{FID} %d %p [%c] - %m%n
+
 #log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender  
 #log4j.appender.logfile.File=/app/logs/mq_consumer.log  
 #log4j.appender.logfile.datePattern='.'yyyy-MM-dd'.'  

+ 2 - 2
adm/src/main/webapp/admin/futurescontractManage/addfuturespc.html

@@ -594,10 +594,10 @@
 			data.field.hWType = hWType;
 			//法务合同号
 		    var aciLegalContractNo = $("#aciLegalContractNo").val();
-		    if(isEmpty(aciLegalContractNo)){
+		    /* if(isEmpty(aciLegalContractNo)){
 		    	$.ErrorAlert('法务合同号不能为空!');
 	    		return;
-		    }
+		    } */
 		    var purchaseTeam = $("select[name='purchaseTeam']").val();
 		    //采购
 		    if(type == '00'){

+ 4 - 4
adm/src/main/webapp/admin/futurescontractManage/editfuturespc.html

@@ -559,11 +559,11 @@
                     return '请输入不为0的数字';
                   }
         	},
-        	aciLegalContractNo: function(value) {
+        	/* aciLegalContractNo: function(value) {
         		if(isEmpty(value)){
 		    		return '请输入法务合同号';
                 }
-        	}
+        	} */
           });
           //监听提交
   		form.on('submit(demo1)', function(data) {
@@ -600,10 +600,10 @@
 			 var hWType = $("select[name='hWType']").val();
 			 data.field.hWType = hWType;
 			 var aciLegalContractNo = $("#aciLegalContractNo").val();
-			 if(isEmpty(aciLegalContractNo)){
+			 /* if(isEmpty(aciLegalContractNo)){
 			    	$.ErrorAlert('法务合同号不能为空!');
 		    		return;
-			    }
+			 } */
 			 //采购组
 		     var purchaseTeam = $("select[name='aciPurchaseTeam']").val();
 		    //采购

+ 5 - 5
adm/src/main/webapp/admin/longcontractManage/addlongpc.html

@@ -152,7 +152,7 @@
 				<td>
 					<input type="tel" name="aciLegalContractNo" id="aciLegalContractNo" maxlength="35" lay-verify="aciLegalContractNo"   autocomplete="off" placeholder="请输入法务合同号" class="layui-input">
 				</td>
-				<th id = "team">*采购组:</th>
+				<th id = "team">采购组:</th>
 				<td id = "teamA">
 					<div class="layui-input-inline" id="purchaseTeam">
 					</div>
@@ -824,19 +824,19 @@
 		    }
 		    //法务合同号
 		    var aciLegalContractNo = $("#aciLegalContractNo").val();
-		    if(isEmpty(aciLegalContractNo)){
+		    /* if(isEmpty(aciLegalContractNo)){
 		    	$.ErrorAlert('法务合同号不能为空!');
 	    		return;
-		    }
+		    } */
 		    //采购组
 		    var purchaseTeam = $("select[name='purchaseTeam']").val();
 		    //采购
-		    if(type == '00'){
+		    /* if(type == '00'){
 		    	if(isEmpty(purchaseTeam)){
 		    		$.ErrorAlert('请选择采购组!');
 		    		return;
 		    	}
-		    }
+		    } */
 		    data.field.purchaseTeam = purchaseTeam;
   			var valueStr ="";
 			var getData = transfer1.getData('111');

+ 6 - 6
adm/src/main/webapp/admin/longcontractManage/editlongpc.html

@@ -141,7 +141,7 @@
 				<td>
 					<input type="tel" name="aciLegalContractNo" id="aciLegalContractNo" maxlength="35" lay-verify="aciLegalContractNo"   autocomplete="off" placeholder="请输入法务合同号" class="layui-input">
 				</td>
-				<th id = "team">*采购组:</th>
+				<th id = "team">采购组:</th>
 				<td id = "teamA">
 					<div class="layui-input-inline" id="aciPurchaseTeam">
 					</div>
@@ -974,20 +974,20 @@
 	    		return;
 		    }
 		    //法务合同号
-		    var aciLegalContractNo = $("#aciLegalContractNo").val();
-		    if(isEmpty(aciLegalContractNo)){
+		     var aciLegalContractNo = $("#aciLegalContractNo").val();
+		    /* if(isEmpty(aciLegalContractNo)){
 		    	$.ErrorAlert('法务合同号不能为空!');
 	    		return;
-		    }
+		    } */
 		    //采购组
 		    var purchaseTeam = $("select[name='aciPurchaseTeam']").val();
 		    //采购
-		    if(type == '00'){
+		    /* if(type == '00'){
 		    	if(isEmpty(purchaseTeam)){
 			    	$.ErrorAlert('请选择采购组!');
 		    		return;
 			    }
-		    }
+		    } */
 		    data.field.purchaseTeam = purchaseTeam;
   			$.request({
   				action : 'LongContractAction/longpcEdit',

+ 3 - 1
adm/src/main/webapp/admin/orderManage/orderCD.html

@@ -322,6 +322,7 @@
 // 				      ,{field: 'createTime', title: '创建时间',width:"10%"}
 					  ,{field: 'editDate', title: '日期',width:"10%"}
 				      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+				      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 				      ,{field: 'operate', title: '操作',width:"8%", toolbar: '#barDemoOne', fixed: 'right'}	   
 				    ]];
 	
@@ -355,6 +356,7 @@
 					      ,{field: 'createTime', title: '创建时间',width:"10%"}
 					      ,{field: 'editDate', title: '日期',width:"10%"}
 					      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+					      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 					      ,{field: 'operate', title: '操作',width:"15%", toolbar: '#barDemoOne', fixed: 'right'}	   
 					]]
 		    ,done: function(res, curr, count){
@@ -809,7 +811,7 @@
     	      shadeClose: true,
     	      shade: 0.8,
     	      limit:99,
-    	      area: ['40%', '90%'],
+    	      area: ['80%', '90%'],
     	      content: 'transferDetail.html'
     	});
   	}

+ 3 - 1
adm/src/main/webapp/admin/orderManage/orderQH.html

@@ -264,6 +264,7 @@
 // 				      ,{field: 'createTime', title: '创建时间',width:"10%"}
 					  ,{field: 'editDate', title: '日期',width:"10%"}
 				      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+				      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 				      ,{field: 'operate', title: '操作',width:"8%", toolbar: '#barDemoOne', fixed: 'right'}	   
 				    ]];
 	var table;
@@ -298,6 +299,7 @@
 // 		      ,{field: 'createTime', title: '创建时间',width:"10%"}
 			  ,{field: 'editDate', title: '日期',width:"10%"}
 		      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+		      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 		      ,{field: 'operate', title: '操作',width:"15%", toolbar: '#barDemoThree', fixed: 'right'}	   
 		    ]]
 		    ,done: function(res, curr, count){
@@ -629,7 +631,7 @@
     	      shadeClose: true,
     	      shade: 0.8,
     	      limit:99,
-    	      area: ['40%', '90%'],
+    	      area: ['80%', '90%'],
     	      content: 'transferDetail.html'
     	});
   	}

+ 3 - 1
adm/src/main/webapp/admin/orderManage/orderXH.html

@@ -287,6 +287,7 @@
 // 				      ,{field: 'createTime', title: '创建时间',width:"10%"}
 					  ,{field: 'editDate', title: '日期',width:"10%"}
 				      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+				      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 				      ,{field: 'operate', title: '操作',width:"8%", toolbar: '#barDemoOne', fixed: 'right'}	   
 				    ]];
 	
@@ -322,6 +323,7 @@
 		      ,{field: 'conEndDate', title: '合同结束时间',width:"10%",templet: function (d) { return isEmpty(d.conEndDate)?'':d.conEndDate;}}
 			  ,{field: 'editDate', title: '日期',width:"10%"}
 		      ,{field: 'orderStateDesc', title: '订单状态',width:"10%"}
+		      ,{field: 'aoiErpNo', title: 'erp编号',width:"10%"}
 		      ,{field: 'operate', title: '操作',width:"20%", toolbar: '#barDemoTwo', fixed: 'right'}	   
 		    ]]
 		    ,done: function(res, curr, count){
@@ -554,7 +556,7 @@
     	      shadeClose: true,
     	      shade: 0.8,
     	      limit:99,
-    	      area: ['40%', '90%'],
+    	      area: ['80%', '90%'],
     	      content: 'transferDetail.html'
     	});
   	}

+ 171 - 22
adm/src/main/webapp/admin/orderManage/transferDetail.html

@@ -36,7 +36,7 @@
 			</div>
 		</div>
 	</div>
-	<div class="layui-form-item">
+	<!-- <div class="layui-form-item">
 		<div class="layui-inline">
 			<label class="layui-form-label">*本次传输数量:</label>
 			<div class="layui-input-inline">
@@ -67,14 +67,26 @@
 				<input type="tel" name="preTotal" maxlength="5" id="preTotal"  disabled="disabled" autocomplete="off"  class="layui-input">
 			</div>
 		</div>
-	</div>
+	</div> -->
+	<div class="a-lowerpart">
+		<div class="a-lowerpart-title">传输明细</div>
+			<div class="shadow-content">
+			<table id="tableTest" lay-filter="tableFilter"></table>
+		</div> 	
+    </div>
       <div class="layui-form-item box-button">
           <div class="layui-input-block">
               <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
           </div>
       </div>
     </form>
-      <script src="../../js/min-loader-next.js"></script>
+    <script type="text/html" id="barDemo">
+        <a class="f12-blue ml0-4" lay-event="add"   lay-filter="add" >添加</a>
+        <a class="f12-red2 ml0-4" lay-event="delete"   lay-filter="delete" >删除</a>
+	</script>
+	<script type="text/html" id="productSelect">
+	</script>
+    <script src="../../js/min-loader-next.js"></script>
     <script>
     //反现
     	//实际单价
@@ -83,9 +95,12 @@
        var conType;
        // 订单id
        var orderId;
-       layui.use('form', function(){
+       // table的index
+       var index = 0;
+       var apProductInfList;
+       layui.use(['form', 'table'], function(){
     	    var rowData = layui.sessionData("ROW_DATA").NOW_ROW;
-    	    layui.each(rowData, function(index, item){ 
+    	    /* layui.each(rowData, function(index, item){ 
     	    	$("#"+index+"").val(item);
     	    })
     	    //获取剩余传输数量
@@ -96,28 +111,154 @@
     	    if(isEmpty(aoiRemainingTransNum)){
     	    	$("#aoiRemainingTransNum").val(detailStockNum);
     	    }
-    	    //获取实际单价
-    	    realPrice = rowData.realPrice;
+    	    
     	    //有实际单价,赋值为预估价
     	    if(realPrice > 0){
     	    	$("#preSettlement").val(realPrice);
-    	    }
+    	    } */
+    	  	//获取实际单价
+    	    realPrice = rowData.realPrice;
     	    conType = rowData.conType;
     	    orderId = rowData.orderId;
-    	}); 
+    	    $.request({
+				action : 'OrderManageAction/queryOrderTransfer',
+				data :  {orderId: orderId} ,
+				success : function(data) {
+					$("#aoiTransferredNum").val(data.transWeightNum);
+					$("#aoiRemainingTransNum").val(data.remainingWeightNum);
+					apProductInfList = data.apProductInfList;
+					
+					var appendJs = '<select name="product" lay-ignore onchange="productChange(this)" index={{d.trid}}>\n';
+					for(var i = 0; i < apProductInfList.length; i++){
+						appendJs += '<option value="'+apProductInfList[i].id+'" {{(d.product==\''+apProductInfList[i].id+'\')?\'selected\':\'\'}}>'+apProductInfList[i].name+'</option>\n';
+					}
+					appendJs += '</select>';
+					console.log(appendJs);
+					$("#productSelect").html(appendJs);
+					
+					
+					//创建一行参数
+					var tableData = new Array();
+					var data1 = {
+									"trid":index,
+									"product":apProductInfList[0].id,
+									"weight":data.remainingWeightNum,
+									"ratio":apProductInfList[0].unitRatio,
+									"price" : realPrice,
+									"amount":accMul(data.remainingWeightNum, realPrice, 2)
+								};
+					tableData.push(data1);
+					table = layui.table;
+					table.render({
+						id : 'tableTest'
+						,elem: '#tableTest'
+						,data : tableData
+						,limit:1000
+						,cols : [[ //表头
+			 		        {type:'numbers',title:  '序号',width:'5%'}
+							,{field : 'product', title: '物料', width:"12%", templet: '#productSelect'}
+							,{field : 'ratio', title: '单位换算比例', width:"10%"}
+							,{field : 'weight', title: '传输量', width:"8%",edit: 'text',style:'background-color: #FAFAD2;'}
+							,{field : 'price', title: '单价', width:"10%",edit: 'text',style:'background-color: #FAFAD2;'}
+							,{field : 'amount', title: '总金额', width:"12%", edit: 'text',style:'background-color: #FAFAD2;'}
+							,{field : 'operate', title: '操作', width: "15%", toolbar: '#barDemo',fixed: 'right'}
+						]]
+						,page: false
+						,done: function(res, curr, count){
+						}
+						,even: true //开启隔行背景
+					});
+					table.on('edit(tableFilter)', function(obj){
+						if(obj.field == 'price' || obj.field == 'weight') {
+							obj.data.amount = accMul(obj.data.price, obj.data.weight, 2);
+						}
+						// 更换数据
+						var oldData =  table.cache["tableTest"];
+						for (var i = 0; i < oldData.length; i++) {
+							if (oldData[i].trid == obj.data.trid) {
+								oldData[i] = obj.data;
+								break;
+							}
+						}
+						// 重载
+						table.reload('tableTest',{
+							data : oldData
+						});
+					});
+					table.on('tool(tableFilter)', function(obj){
+						var data = obj.data;
+						//删除tr
+						if(obj.event == 'delete'){
+							var oldData =  table.cache["tableTest"];
+							if(oldData.length == 1){
+								layer.msg('已经是最后一个了,无法再次删除!', {icon: 5});
+								return;
+							}
+							for (var i = 0; i < oldData.length; i++) {
+								if (oldData[i].trid == data.trid) {
+									oldData.splice(i,1);
+									break;
+								}
+							}
+							table.reload('tableTest',{
+								data : oldData
+							});
+						}
+						if(obj.event == 'add'){
+							var id = ++index;
+							console.log(id)
+							var oldData =  table.cache["tableTest"];
+							var data1 = {
+											"trid":id,
+											"product":apProductInfList[0].id,
+											"weight":"0",
+											"ratio":apProductInfList[0].unitRatio,
+											"price" : realPrice,
+											"amount":accMul(data.remainingWeightNum, realPrice, 2)
+										};
+							oldData.push(data1);
+							table.reload('tableTest',{
+								data : oldData
+							});
+						}
+					})
+				},
+				error : function(data) {
+					 $.ErrorAlert(data.msg);
+				}
+			});
+    	});
+       function productChange(t){
+			var oldData =  table.cache["tableTest"];
+			for (var i = 0; i < oldData.length; i++) {
+				if (oldData[i].trid == $(t).attr("index")) {
+					oldData[i].product = $(t).val();
+					for(let o of apProductInfList) {
+						if(o.id == oldData[i].product) {
+							oldData[i].ratio = o.unitRatio;
+							break;
+						}
+					}
+					break;
+				}
+			}
+			// 重载
+			table.reload('tableTest',{
+				data : oldData
+			});
+       }
     	
        layui.use('laydate', function(){
-   		var laydate = layui.laydate;
-   		var layer = layui.layer;
-   		var j=layui.jquery;
-   	   	j("#erpPostingDate").val(getCurrentDate());
-   		laydate.render({
-               elem: '#erpPostingDate'// input里时间的Id
-               ,format:'yyyyMMdd'
-               ,type: 'datetime'
-       		,trigger: 'click'
-   	    });
-
+	   		var laydate = layui.laydate;
+	   		var layer = layui.layer;
+	   		var j=layui.jquery;
+	   	   	$("#erpPostingDate").val(getCurrentDate());
+	   		laydate.render({
+	               elem: '#erpPostingDate'// input里时间的Id
+	               ,format:'yyyyMMdd'
+	               ,type: 'datetime'
+	       		,trigger: 'click'
+	   	    });
    		})
     layui.use(['form', 'layedit', 'laydate'], function() {
             var form = layui.form,
@@ -155,7 +296,11 @@
             	if(conType == '00'){//采购
 	            	 $.request({
 						action : 'TransManageAction/purchaseOrderTransmission',
-						data :  data.field ,
+						data :  {
+							erpPostingDate: $("#erpPostingDate").val(),
+							orderId: orderId,
+							tableListStr: JSON.stringify(table.cache["tableTest"])
+						},
 						success : function(data) {
 							 layer.alert('操作成功!',  function(){
 								 window.parent.location.reload(); 
@@ -170,7 +315,11 @@
             	}else if(conType == '01'){//销售
             	     $.request({
      					action : 'TransManageAction/saleOrderTransmission',
-     					data :  data.field ,
+     					data :  {
+							erpPostingDate: $("#erpPostingDate").val(),
+							orderId: orderId,
+							tableListStr: JSON.stringify(table.cache["tableTest"])
+						},
      					success : function(data) {
      						 layer.alert('保存成功!',  function(){
      			                 window.parent.location.reload(); 

+ 1 - 1
adm/src/main/webapp/layui/css/layui.css

@@ -653,7 +653,7 @@ a cite{font-style: normal; *cursor:pointer;}
 
 .layui-form-item{margin-bottom: 15px; clear: both; *zoom: 1;}
 .layui-form-item:after{content:'\20'; clear: both; *zoom: 1; display: block; height:0;}
-.layui-form-label{position: relative; float: left; display: block; padding: 9px 15px;  width: 80px; font-weight: 400; line-height: 20px; text-align: right;}
+.layui-form-label{position: relative; float: left; display: block; padding: 9px 15px;  width: 140px; font-weight: 400; line-height: 20px; text-align: right;}
 .layui-form-label-col{display: block; float: none; padding: 9px 0; line-height: 20px; text-align: left;}
 .layui-form-item .layui-inline{margin-bottom: 5px; margin-right: 10px;}
 .layui-input-block, .layui-input-inline{position: relative;}