tudc %!s(int64=3) %!d(string=hai) anos
pai
achega
b37ee7ec3e

+ 4 - 0
adm/.gitignore

@@ -25,6 +25,10 @@ target/
 *.iml
 *.ipr
 
+### eclipse ###
+.metadata/
+.settings/
+
 ### NetBeans ###
 nbproject/private/
 build/*

+ 61 - 44
adm/src/main/java/com/minpay/guomao/datamanage/action/PriceManageAction.java

@@ -276,7 +276,6 @@ public class PriceManageAction implements IMINAction {
 	
 	/**
 	 * 修改价格
-	 * @param fapResult
 	 * @param specsId				价格编号
 	 * @param area					地区
 	 * @param type					价格类别
@@ -284,44 +283,71 @@ public class PriceManageAction implements IMINAction {
 	 * @param price					价格
 	 * @param session
 	 * @return
-	 * @throws MINBusinessException
-	 * @throws ParseException 
+	 * @throws Exception 
 	 */
 	@MINAction(value = MODIFY_PRICE, transaction = IMINTransactionEnum.CMT)
 	public MINActionResult modifyPrice(
-			MINHttpServletRequestContext fapResult,
-			@MINParam(key ="aeiId") String aeiId,
-			@MINParam(key ="specNo") String specNo,
-			@MINParam(key ="area") String area,
-			@MINParam(key ="type") String type,
-			@MINParam(key ="date") String date,
-			@MINParam(key ="price") String price,
+			@MINParam(key ="dates") String dates,
+			@MINParam(key ="specsId") String specsId,
+			@MINParam(key ="cjPrice") String cjPrice,
+			@MINParam(key ="ncPrice") String ncPrice,
+			@MINParam(key ="shPrice") String shPrice,
+			@MINParam(key ="hlPrice") String hlPrice,
 			MINSession session
-			) throws MINBusinessException, ParseException {
+			) throws Exception {
 		MINActionResult res = new MINActionResult();
 		//获取当前系统时间
 		String nowTime = DateUtil.getCurrentDateTimeString();
 		//获取操作员信息
 		User user = session.getUser();
-		//查询此商品当前日期是否维护价格
-		ApPriceInfExample apiEx = new ApPriceInfExample();
-		String date1 = date.replaceAll(":", "").replaceAll("-", "").replaceAll(" ", "");
-		apiEx.createCriteria().andSpecsIdEqualTo(specNo).andDateEqualTo(date1)
-				.andIdNotEqualTo(aeiId).andTypeEqualTo(type).andAreaEqualTo(area)
-				.andBranchIdEqualTo(user.getBranchId());
-		List<ApPriceInf> apiList = Service.lookup(IMINDataBaseService.class)
-						.getMybatisMapper(ApPriceInfMapper.class)
-						.selectByExample(apiEx);
-		if(apiList.size() > 0){
-			throw new MINBusinessException("此商品规格已经添加过此类型价格,请勿重复添加!"+"当前日期:"+date); 
-		}
 		
-		ApPriceInf aei = new ApPriceInf();
-		aei.setId(aeiId);				//公司编号
-		aei.setSpecsId(specNo);			//产品规格编号
-		aei.setArea(area);				//地区
-		aei.setType(type);				//价格类别
-		aei.setDate(date.replaceAll(":", "").replaceAll("-", "").replaceAll(" ", ""));	//时间
+		String[] priceType = {"00", "01", "06", "07"};
+		String[] priceList = {ncPrice, cjPrice, shPrice, hlPrice};
+		for (int i = 0; i < priceType.length; i++) {
+			ApPriceInfExample priceInfExample = new ApPriceInfExample();
+			priceInfExample.createCriteria()
+			.andDateEqualTo(dates.replaceAll("-", ""))
+			.andSpecsIdEqualTo(specsId)
+			.andStateEqualTo("00")
+			.andTypeEqualTo(priceType[i]);
+			
+			ApPriceInf priceInf = new ApPriceInf();
+			priceInf.setPrice(priceList[i]);
+			priceInf.setModifyUser(user.getId());
+			priceInf.setModifyUser(nowTime);
+			
+			int num = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApPriceInfMapper.class).updateByExampleSelective(priceInf, priceInfExample);
+			if (num > 1) {
+				throw new MINBusinessException("价格修改异常!");
+			// 没有则创建	
+			} else if (num == 0) {
+				//获取主键id
+				String priceId = Service.lookup(IPublicService.class).getSequence("AP_PRICE_INF_ID");
+				priceInf.setId(priceId);
+				priceInf.setSpecsId(specsId);		//产品规格编号
+				priceInf.setArea("00");				//地区
+				priceInf.setType(priceType[i]);				//价格类别
+				priceInf.setDate(dates.replaceAll("-", ""));				//时间
+				// 合同月信息
+				setHTY(priceInf);
+				priceInf.setState("00");				//状态
+				priceInf.setCreateTime(nowTime);		//当前时间
+				priceInf.setCreateUser(user.getId());//获取用户id
+				priceInf.setBranchId(user.getBranchId());//部门
+				Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApPriceInfMapper.class).insert(priceInf);
+			}
+		}
+		// 记录日志
+		String logInfo = "操作员:" + user.getName() + ",编辑"+dates+"的价格,南储价:" + ncPrice + "长江价:" + cjPrice + "上海有色网价:" + shPrice + "沪铝当月结算价:" + hlPrice;
+		Service.lookup(ILogService.class).logging(session, logInfo);
+		return res;
+	}
+	
+	private void setHTY(ApPriceInf priceInf) throws Exception{
+		String date1 = priceInf.getDate();
+		if (CommonUtil.isEmpty(date1)) {
+			throw new MINBusinessException("未设置日期信息!");
+		}
 		//获取日期的后两位
 		String lastTwoDates = date1.substring(date1.length()-2,date1.length());
 		//获取月份
@@ -332,31 +358,22 @@ public class PriceManageAction implements IMINAction {
 			//获取上一个月
 			String newDate = DateUtil.dateAddMonth(date1,-1);
 			String lastMonth = newDate.substring(4, 6);
-			aei.setHty(lastMonth+"26~"+month+"25");
-			aei.setYear(year);
+			priceInf.setHty(lastMonth+"26~"+month+"25");
+			priceInf.setYear(year);
 		}else{//大于26
 			//往后加一个月
 			String newDate = DateUtil.dateAddMonth(date1,1);
 			String nextMonth = newDate.substring(4,6);
-			aei.setHty(month+"26~"+nextMonth+"25");
+			priceInf.setHty(month+"26~"+nextMonth+"25");
 			if("12".equals(month)){
-				aei.setYear(newDate.substring(0, 4));//下一年
+				priceInf.setYear(newDate.substring(0, 4));//下一年
 			}else{
-				aei.setYear(year);
+				priceInf.setYear(year);
 			}
 		}
-		aei.setPrice(price);			//价格
-		aei.setModifyTime(nowTime);		//获取当前时间
-		aei.setModifyUser(user.getId());//获取当前用户id
-		Service.lookup(IMINDataBaseService.class)
-					.getMybatisMapper(ApPriceInfMapper.class)
-					.updateByPrimaryKeySelective(aei);
-		// 记录日志
-		String logInfo = "操作员:" + user.getName() + ",编辑价格类型 :"+type+",价格:"+price;
-		Service.lookup(ILogService.class).logging(session, logInfo);
-		return res;
 	}
 	
+	
 	/**
 	 * 删除价格
 	 * @param aeiId

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

@@ -6,6 +6,7 @@
 		SELECT 
 		 AEI_DATE		'dates',
 		 ASR_VALUE		'spValue',
+		 AEI_SPECS_ID   'specsId',
 		cast(ROUND(SUM(CASE WHEN AEI_TYPE = '00' THEN AEI_PRICE ELSE 0 END),2) as char) 'ncPrice',
 		cast(ROUND(SUM(CASE WHEN AEI_TYPE = '01' THEN AEI_PRICE ELSE 0 END),2) as char) 'cjPrice',
 		cast(ROUND(SUM(CASE WHEN AEI_TYPE = '06' THEN AEI_PRICE ELSE 0 END),2) as char) 'shPrice',

+ 59 - 129
adm/src/main/webapp/admin/priceManage/editPrice.html

@@ -11,126 +11,70 @@
 </head>
 
 <body class="body-content">
-<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
-    </fieldset>
-<form class="layui-form" action="javascript:void(0)" id = "form2">
-	<div class="layui-form-item">
-			<div class="layui-form-item" style="display: none">
-	            <label class="layui-form-label">ID:</label>
-	            <div class="layui-input-block">
-	                <input type="text" id = "aeiId" name="aeiId" autocomplete="off"class="layui-input" >
-	            </div>
-	        </div>
-    </div>
-    
-    <div class="layui-form-item">
+	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
+	<form class="layui-form" action="javascript:void(0)" id = "form2">
+	    <div class="layui-form-item">
 			<div class="layui-inline">
-				<label class="layui-form-label">*产品名称:</label>
-			    <div class="layui-input-inline">
-			    	<input type="text" name="apiName" onclick = "addPro()" id ="apiName" lay-verify="apiName" autocomplete="off" placeholder="请选择产品"  class="layui-input">
-			    </div>
-			</div>
-			
-			<!-- <div class="layui-inline">
-				<label class="layui-form-label">规格:</label>
-			    <div class="layui-input-inline">
-			    	<input type="text" name="arName" maxlength="30" id ="arName" lay-verify="arName" autocomplete="off"   class="layui-input" disabled="disabled">
-			        <input type="hidden" name="arId" maxlength="30" id ="arId" lay-verify="arId" autocomplete="off" class="layui-input">
-			    </div>
-			</div> -->
-			
+			      <label class="layui-form-label">*日期:</label>
+			      <div class="layui-input-inline">
+			        <input type="text" class="layui-input" id="date" name="date" readonly placeholder="请选择日期">
+			      </div>
+		    </div>
 			<div class="layui-inline">
 				<label class="layui-form-label">*规格值:</label>
 			    <div class="layui-input-inline">
-			    	<input type="text" name="value" maxlength="30" id ="value" lay-verify="value" autocomplete="off"   class="layui-input" disabled="disabled">
-			    	<input type="hidden" name="specNo" maxlength="30" id ="specNo" lay-verify="specNo" autocomplete="off" class="layui-input">
+			    	<input type="text" name="specNo" id ="specNo" readonly autocomplete="off" class="layui-input">
 			    </div>
 			</div>
 		</div>
-	
-	<div class="layui-form-item">
-		<div class="layui-inline">
-	        	<label class="layui-form-label">*地区:</label>
-	        	<div class="layui-input-inline" id ="area">
-        	</div>
-        </div>
-		<div class="layui-inline">
-	        	<label class="layui-form-label">*类型:</label>
-	        	<div class="layui-input-inline" id ="type">
-        	</div>
-        </div>
-	</div>
-	
-	<div class="layui-form-item">
-		<div class="layui-inline">
-		      <label class="layui-form-label">*日期:</label>
-		      <div class="layui-input-inline">
-		        <input type="text" class="layui-input" id="date" name="date" lay-verify="date" placeholder="请选择日期">
-		      </div>
-	    </div>	    
-		<div class="layui-inline">
-			<label class="layui-form-label">*价格(元):</label>
-			<div class="layui-input-inline">
-				<input type="tel" name="price" maxlength="10" id="price" lay-verify="price" autocomplete="off" placeholder="请输入价格" class="layui-input">
-			</div>
-		</div>
- 	</div>
 		
-		<input type="hidden" name="id"  id ='id'>
-      <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>
+		<div class="layui-form-item">
+			<div class="layui-inline">
+				<label class="layui-form-label">*长江价(元):</label>
+				<div class="layui-input-inline">
+					<input type="tel" name="cjPrice" maxlength="10" id="cjPrice" lay-verify="price" autocomplete="off" placeholder="请输入长江价" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">*南储价(元):</label>
+				<div class="layui-input-inline">
+					<input type="tel" name="ncPrice" maxlength="10" id="ncPrice" lay-verify="price" autocomplete="off" placeholder="请输入南储价" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">*上海有色网价(元):</label>
+				<div class="layui-input-inline">
+					<input type="tel" name="shPrice" maxlength="10" id="shPrice" lay-verify="price" autocomplete="off" placeholder="请输入上海有色网价" class="layui-input">
+				</div>
+			</div>
+			<div class="layui-inline">
+				<label class="layui-form-label">*沪铝结算价元):</label>
+				<div class="layui-input-inline">
+					<input type="tel" name="hlPrice" maxlength="10" id="hlPrice" lay-verify="price" autocomplete="off" placeholder="请输入沪铝结算价" class="layui-input">
+				</div>
+			</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>
     <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
     <script>
-	    layui.use('laydate', function(){
-			var laydate = layui.laydate;
-			//日期范围
-			laydate.render({
-			    elem: '#date'
-			   ,trigger: 'click'
-			});
-		})
-    	    var rowData = layui.sessionData("ROW_DATA").NOW_ROW;
-    	    layui.each(rowData, function(index, item){ 
-    	    	$("#"+index+"").val(item);
-    	    	initSelect('type', "PRICE_TYPE", "type",rowData.type, true);
-	    		initSelect('area', "AREA_TYPE", "area",rowData.area, true);
-    	    });
-       
       layui.use(['form', 'layedit', 'laydate','layer'], function() {
-          var form = layui.form,
-          layer = layui.layer,
-          layedit = layui.layedit,
-          laydate = layui.laydate;
+          var form = layui.form;
+          var editPriceInf = getTempVal("editPriceInf");
+          
+          $("#date").val(editPriceInf.dates);
+          $("#specNo").val(editPriceInf.spValue);
+          $("#cjPrice").val(editPriceInf.cjPrice);
+          $("#ncPrice").val(editPriceInf.ncPrice);
+          $("#shPrice").val(editPriceInf.shPrice);
+          $("#hlPrice").val(editPriceInf.hlPrice);
+          
           form.verify({
-        	  apiName: function(value) {
-          		if(isEmpty(value)){
-  		    		return '请选择产品名称!';
-                  }
-          	},
-          	value: function(value) {
-          		if(isEmpty(value)){
-  		    		return '请选择规格!';
-                  }
-          	},
-          	area: function(value) {
-          		if(isEmpty(value)){
-  		    		return '请选择地区!';
-                  }
-          	},
-          	type: function(value) {
-          		if(isEmpty(value)){
-  		    		return '请选择类型!';
-                  }
-          	},
-          	date :function(value) {
-          		if(isEmpty(value)){
-  		    		return '请选择日期!';
-                  }
-          	},
           	price:function(value) {
           		if(isEmpty(value)){
   		    		return '请输入价格!';
@@ -142,13 +86,18 @@
           });
           //监听提交
   		form.on('submit(demo1)', function(data) {
+  			editPriceInf.cjPrice = $("#cjPrice").val();
+  			editPriceInf.ncPrice = $("#ncPrice").val();
+  			editPriceInf.shPrice = $("#shPrice").val();
+  			editPriceInf.hlPrice = $("#hlPrice").val();
+  			
   			$.request({
   				action : 'PriceManageAction/modifyPrice',
-  				data :  data.field,
+  				data :  editPriceInf,
   				success : function(data){
         			if (data.MINStatus == 0) {
         				layui.use(['layer'], function(){
-        					layer.msg('添加成功!', {
+        					layer.msg('操作成功!', {
        						  icon: 1,
        						  time: 1000 //2秒关闭(如果不配置,默认是3秒)
        						}, function(){
@@ -171,25 +120,6 @@
   			});	
   		})
      })
-     
-     function showPro(arId, proName,arName,arValue){
-    		$("#specNo").val(arId);			//规格编号
-        	$("#apiName").val(proName);		//产品名称
-        	$("#value").val(arValue);		//规格值
-		
-	     } 
-	
-	function addPro(){
-		layer.open({
-    	      type: 2,
-    	      title: '选择产品',
-    	      shadeClose: true,
-    	      shade: 0.8,
-    	      //maxmin: true, //开启最大化最小化按钮
-    	   	  area: ['80%', '90%'],
-    	   	content: '../purchaplanmanage/selectPro.html'
-    	});
-   	}
     </script>
 
 </body>

+ 7 - 20
adm/src/main/webapp/admin/priceManage/priceManage.html

@@ -81,7 +81,6 @@
     <!--操作功能-->
     <script type="text/html" id="barDemo">
 		<a class="f12-blue ml0-4" lay-event="edit">编辑</a>
-		<a class="f12-red2 ml0-4" lay-event="delete">删除</a>
    </script>
    
 <script>
@@ -163,11 +162,12 @@
 		    ,page: true //开启分页
 		    ,cols: [[ //表头
    		       {type:'numbers',title: '序号',width:"5%"}   
-   		      ,{field: 'dates', title: '日期', width:"19%"}
-   		      ,{field: 'cjPrice', title: '长江价',width:"19%"}
-   		      ,{field: 'ncPrice', title: '南储价', width:"19%"}
-   		      ,{field: 'shPrice', title: '上海有色网价',width:"19%"}
-   		      ,{field: 'hlPrice', title: '沪铝结算价',width:"19%"}
+   		      ,{field: 'dates', title: '日期', width:"15%"}
+   		      ,{field: 'cjPrice', title: '长江价',width:"15%"}
+   		      ,{field: 'ncPrice', title: '南储价', width:"15%"}
+   		      ,{field: 'shPrice', title: '上海有色网价',width:"15%"}
+   		      ,{field: 'hlPrice', title: '沪铝结算价',width:"15%"}
+   		   	  ,{field: 'operate', title: '操作', width:"20%", toolbar: '#barDemo',fixed:'right'}
 		    ]]
 		    ,done: function(res, curr, count){
 		        var avgPriceList = res.avgPriceList;
@@ -316,21 +316,8 @@
 	    
 	  //编辑
 	  	function editDetail(data) {
-		    var params = {};
-	    	params.columnNumber = 2; //每行显示两个字段
-		    // 寄存当前数据
-		    layui.sessionData("ROW_DATA", {key:"NOW_ROW", value:data});
+	    	setTempVal("editPriceInf", data);
 		    openMainTabPageParent('050004-02', '编辑价格', 'priceManage/editPrice.html', '', '050004', loadAA);
-	    	/* layer.open({
-	    	      type: 2,
-	    	      title: '编辑',
-	    	      shadeClose: true,
-	    	      // shade: true , 
-	    	      shade: 0.8,
-	    	      //maxmin: true, //开启最大化最小化按钮
-	    	      area: ['75%', '84%'],
-	    	      content: 'editPrice.html' ,
-	    	}); */
 	  	}  
 	  
 	  	//重置