tntdc 1 year ago
parent
commit
4afb6e85fc

+ 66 - 0
adm/src/main/java/com/minpay/guomao/giveoutmanage/giveOutManageAction.java

@@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URLDecoder;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -59,6 +60,7 @@ import com.minpay.db.table.model.ApTransSaveHtml;
 import com.minpay.db.table.model.ApWarehouseDetail;
 import com.minpay.db.table.model.ApWarehouseDetailExample;
 import com.minpay.db.table.model.ApWarehouseStock;
+import com.minpay.db.table.model.ApWarehouseStockExample;
 import com.minpay.db.table.model.ImUser;
 import com.minpay.db.table.model.ImUserExample;
 import com.minpay.db.table.model.OwnApCompanyInfExample;
@@ -66,6 +68,7 @@ import com.minpay.db.table.model.PubApppar;
 import com.minpay.db.table.model.PubAppparExample;
 import com.minpay.db.table.model.PubAppparKey;
 import com.minpay.db.table.own.mapper.GiveoutManageMapper;
+import com.minpay.db.table.own.mapper.WarehouseInventoryMapper;
 import com.startup.minpay.frame.business.IMINAction;
 import com.startup.minpay.frame.business.MINHttpServletRequestContext;
 import com.startup.minpay.frame.business.res.MINActionResult;
@@ -177,6 +180,11 @@ public class giveOutManageAction implements IMINAction {
 	
 	/**批量删除已经到货的发运量*/
 	public final static String	BATCH_DEL_GIVEOUT_ARRIVED		= "batchDelGiveoutArrived";
+	
+	/**修改结算价*/
+	public final static String	UPDATE_ORDER_PRICE_BY_GIVE_OUT_DATA		= "updateOrderPriceByGiveOutData";
+	/**查询关联数据的stock数据*/
+	public final static String	QUERY_ORDERLIST_BY_GIVEOUTDATA		= "queryOrderListByGiveOutData";
 
 	/**
 	 * 查询发出量
@@ -1163,6 +1171,17 @@ public class giveOutManageAction implements IMINAction {
 		}
 	    //把品牌,规格,合同相同的合并重量
 		List<Map<String,String>> newList = new ArrayList<>();
+		//合同id
+		List<String> contractIdList = new ArrayList<>();
+		for(int x = 0 ; x < tableDataArray.size();x++){
+			Map<String, String> maps = (Map<String, String>) tableDataArray.get(x);
+			if(!contractIdList.contains(maps.get("contractId"))) {
+				contractIdList.add(maps.get("contractId"));
+			}
+		}
+		if(contractIdList.size() > 1) {
+			throw new MINBusinessException("勾选数据合同信息不一致,请联系管理员!");
+		}
 		
 		for(int x = 0 ; x < tableDataArray.size();x++){
 			Map<String, String> maps = (Map<String, String>) tableDataArray.get(x);
@@ -2230,5 +2249,52 @@ public class giveOutManageAction implements IMINAction {
 			return res;
 	}
 	
+	@MINAction(value = UPDATE_ORDER_PRICE_BY_GIVE_OUT_DATA,transaction = IMINTransactionEnum.CMT)
+	public MINActionResult updateOrderPriceByGiveOutData(
+			@MINParam(key = "stockIdListStr") String stockIdListStr,
+			@MINParam(key = "relPrice") String relPrice,
+			MINSession session) throws MINBusinessException{
+		//创建MODELANDVIEW对象,设定返回值
+		MINActionResult res = new MINActionResult();
+		String [] idArray = stockIdListStr.split(",");
+		List<String> list = Arrays.asList(idArray);
+		ApWarehouseStockExample apWarehouseStockExample = new ApWarehouseStockExample();
+		apWarehouseStockExample.createCriteria().andIdIn(list);
+		
+		ApWarehouseStock apWarehouseStock = new ApWarehouseStock();
+		apWarehouseStock.setRealPrice(relPrice);
+		Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApWarehouseStockMapper.class).updateByExampleSelective(apWarehouseStock, apWarehouseStockExample);
+		return res;
+	}
+	
+	@MINAction(value = QUERY_ORDERLIST_BY_GIVEOUTDATA,transaction = IMINTransactionEnum.CMT)
+	public MINActionResult queryOrderListByGiveOutData(@MINParam(key = "ids") String ids) throws MINBusinessException{
+		//创建MODELANDVIEW对象,设定返回值
+		MINActionResult res = new MINActionResult();
+		
+		String [] idArray = ids.split(",");
+		List<String> list = Arrays.asList(idArray);
+		if(list.size() == 0) {
+			throw new MINBusinessException("未选中数据");
+		}
+		ApGiveOutExample apGiveOutExample = new ApGiveOutExample();
+		apGiveOutExample.createCriteria().andIdIn(list);
+		List<ApGiveOut> apGiveOutList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(ApGiveOutMapper.class).selectByExample(apGiveOutExample);
+		List<String> stockIdList = new ArrayList<>();
+		for(ApGiveOut apGiveOut : apGiveOutList) {
+			stockIdList.add(apGiveOut.getStockId());
+		}
+		if(stockIdList.size() == 0) {
+			throw new MINBusinessException("选中数据未关联订单");
+		}
+		
+		Map<String, Object> stockMap = new HashMap<String, Object>();
+		stockMap.put("idList", stockIdList);
+		List<Map<String, String>> resList = Service.lookup(IMINDataBaseService.class).getMybatisMapper(WarehouseInventoryMapper.class)
+				.queryWarehouseInventoryII(stockMap, new MINRowBounds());
+		res.set(IMINBusinessConstant.F_PAGING_LAY, resList);
+		return res;
+	}
+	
 }	
 	

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

@@ -279,6 +279,13 @@
  	   	<if test="branchId != null and branchId != ''">
 			and ad.AWST_BRANCH_ID  = #{branchId,jdbcType=VARCHAR}
 		</if>
+		<if test="idList !=null">
+	    	and ad.AWST_ID in
+	    	<foreach item="item" index="index" collection="idList" open="("
+				separator="," close=")">
+				#{item}
+			</foreach>
+    	</if>
 		<if test="invoiceOrderList !=null">
 	    	and ad.AWST_ID in
 	    	<foreach item="invoiceOrder" index="index" collection="invoiceOrderList" open="("

+ 74 - 2
adm/src/main/webapp/admin/giveOutManage/giveoutManage.html

@@ -156,6 +156,9 @@
   				<button class="layui-btn left-bnt1 in-b"   id="printGiveOut">结算单打印
   				</button>
   				
+ 				<button class="layui-btn left-bnt1 in-b"   id="updatePrice">修改结算价
+  				</button>
+  				
   				<button class="layui-btn left-bnt1 in-b" id="closeOprate" status = "on">
 					<i class="layui-icon">&#xe602;</i> 操作栏靠右
 	 			</button>
@@ -213,6 +216,7 @@ if(!isEmpty(stockId)){
 	$("#onOrderInventoryDiv").hide();
 	$("#stockIdInventoryDiv").hide();
 	$("#printGiveOut").hide();
+	$("#updatePrice").hide();
 	$("#printChaMoneyOut").hide();
 	if((parseFloat(reaWeight))> 0 && !isEmpty(reaWeight)){//没有确认入库前可以新增
 		$("#selectGive").hide(); 
@@ -234,6 +238,7 @@ if(!isEmpty(stockId)){
 	$("#onOrderInventoryDiv").show();
 	$("#stockIdInventoryDiv").show();
 	$("#printGiveOut").show();
+	$("#updatePrice").show();
 	$("#printChaMoneyOut").show();
 }
 
@@ -276,7 +281,7 @@ if(!isEmpty(stockId)){
     		  return;
     	  }
 	      
-	      if(type === 'bar1'){debugger;
+	      if(type === 'bar1'){
 	    	setTempVal("chooseTableData", gloable_pm_id);
 	    	setTempVal("chooseTableDataCols", cols);
 	      	layer.open({
@@ -519,7 +524,7 @@ if(!isEmpty(stockId)){
 	      		});
 	    	}
 		});
-			table.on('checkbox(tableFilterOne)', function(obj){debugger;
+			table.on('checkbox(tableFilterOne)', function(obj){
 				  gloable_pm_id = checkBoxCache(obj,"agoId",gloable_pm_id,table_data);
 				  var checkWeight = 0;
 				  for (var i = 0; i < gloable_pm_id.length; i ++) {
@@ -808,6 +813,73 @@ if(!isEmpty(stockId)){
 	$(document).on('click','#printGiveOut',function(){
  		openMainTabPageParent(tabPageId+'-16', '打印', 'giveOutManage/printGiveOut.html?tabPageId='+tabPageId+'-16&contractId='+contractId+'&contractNo='+contractNo,'',tabPageId,null);
 	});
+	
+	$(document).on('click','#updatePrice',function(){
+		if(gloable_pm_id.length == 0){
+			layer.msg('请勾选修改的数据!', {icon: 5});
+    		return;
+		}
+		for(var i = 0 ; i < gloable_pm_id.length;i++){
+			if(gloable_pm_id[i].state != '02'){
+				layer.msg('第'+(i+1)+"条数据未入库,请入库后再修改结算价", {icon: 5});
+	    		return;
+			}
+		}
+		var cols2 =  [[ //表头
+		    	       {type:'numbers',title: '序号',width:'5%', sort: true}
+		    	       ,{field: 'fhDate', title: '发货日期',templet: function (d) {
+		    		    	  if(isEmpty(d.fhDate)){
+		    		    		  return ""; 
+		    		    	  }else{
+		    		    		  return  d.fhDate;
+		    		    	  }
+		    		    	  },width:"10%"}
+		    	       ,{field: 'consignee', title: '收货单位名称', width:"15%"}
+		    	       ,{field: 'shippingAddress', title: '发货地', width:"10%"}
+		    	       ,{field: 'station', title: '到站地', width:"10%"}
+		    	       ,{field: 'carNumber', title: '车号', width:"10%"}
+		    	       ,{field: 'caseNo', title: '箱号',width:"10%"}
+		    	       ,{field: 'cardNo', title: '编号', width:"10%"}
+		    	       ,{field: 'specName', title: '规格',width:"8%"}
+		    	       ,{field: 'weight', title: '发出量',width:"8%"}
+		    	       ,{field: 'fYwAY', title: '发运方式', width:"10%"}
+		    	      ,{field: 'abfName', title: '品牌',width:"10%"}
+		    	      ,{field: 'shidaoweight', title: '实到量',width:"10%"}
+		    	      ,{field: 'dhDate', title: '到货日期', templet: function (d) {
+		    	    	  if(isEmpty(d.dhDate)){
+		    	    		  return ""; 
+		    	    	  }else{
+		    	    		  return  d.dhDate;
+		    	    	  }
+		    	    	  },width:"10%"}
+		    	      ,{field: 'forwardingUnit', title: '发货单位名称', width:"10%"}
+		    	      ,{field: 'settlementPrice', title: '结算单价', width:"10%"}
+		    	      ,{field: 'transPrice', title: '运输单价', width:"10%"}
+		    	      ,{field: 'contractNo', title: '合同单号', width:"10%"}
+		    	      ,{field: 'extras', title: '杂费', width:"10%"}
+		    	      ,{field: 'escortFee', title: '押运费', width:"10%"}
+		    	      ,{field: 'railwayCost', title: '地方地铁费用', width:"10%"}
+		    	      ,{field: 'changeTrains', title: '中转信息费', width:"10%"}
+		    	      ,{field: 'region', title: '区域',width:"10%"}
+		    	      ,{field: 'payUnitDesc', title: '支付类型',width:"10%"}
+		    	      ,{field: 'remarks', title: '备注',width:"10%"}
+		    	      ,{field: 'createUser', title: '创建人',width:"10%"} 
+		    	    ]];
+		
+		setTempVal("chooseTableData", gloable_pm_id);
+    	setTempVal("chooseTableDataCols", cols2);
+    	layer.open({
+		      type: 2,
+		      title: '修改数据详情',
+		      shadeClose: true,
+		      // shade: true , 
+		      shade: 0.8,
+		      //maxmin: true, //开启最大化最小化按钮
+		      area: ['95%', '90%'],
+		      content: 'updateChooseTable.html?primaryKey=agoId'
+	  	});
+	});
+	
 	$(document).on('click','#printChaMoneyOut',function(){
  		openMainTabPageParent(tabPageId+'-17', '差额打印', 'advancePayment/editChaAdvance.html?tabPageId='+tabPageId+'-17','',tabPageId,null);
 	});

+ 153 - 0
adm/src/main/webapp/admin/giveOutManage/updateChooseTable.html

@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>选择要显示的列</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <script src="../../js/min-loader-next.js"></script>
+</head>
+
+<body>
+    <div style="margin-top: 20px;margin-left: 20px;min-height: calc(100vh - 70px);"> 
+       	<div class="shadow-content"  >
+       		<div class="layui-text">选中数据</div>
+			<table id="tableTestOne" lay-filter="tableFilterOne"></table>
+			<hr class="layui-border-red">
+			<div class="layui-text">关联订单</div>
+			<table id="tableStock" lay-filter="tableStockFilter"></table>
+			
+			<div class="layui-form-item box-button">
+		          <div class="layui-input-block">
+		              <button class="layui-btn" onclick = "updatePirce()">修改实际单价</button>
+		          </div>
+		    </div>
+		</div>
+    </div>
+
+    <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
+    <script>
+    
+	var table;
+	var chooseTableData = getTempVal("chooseTableData");
+    var chooseTableDataCols = getTempVal("chooseTableDataCols");
+    
+    var idArray = [];
+	for(var i = 0; i < chooseTableData.length; i ++) {
+		idArray.push(chooseTableData[i].agoId);
+	}
+    
+    var stockIdList = new Array();
+	layui.use('table', function(){
+		
+	    setTempVal("chooseTableData", null);
+		setTempVal("chooseTableDataCols", null);
+		
+		var primaryKey = getQueryString("primaryKey");
+		
+		table = layui.table;
+		table.render({
+			 id : 'tableTestOne'
+		    ,elem: '#tableTestOne'
+		    ,limit : chooseTableData.length
+		    ,data: chooseTableData
+		    ,page: false //开启分页
+		    ,cols: chooseTableDataCols
+		    ,even: true //开启隔行背景
+		});
+		
+		table.render({
+			 id : 'tableStock'
+		    ,elem: '#tableStock'
+		    ,limit:1000
+		    ,url: 'giveOutManageAction/queryOrderListByGiveOutData' //数据接口
+		    ,method: 'post'
+		    ,where:{MINView:"JSON", ids : idArray.join(",")}
+		    ,cols: [[ //表头
+              {type:'numbers',title: '序号',width:'5%', sort: true}
+		      ,{field: 'sellerName', title:'销售方', width:'15%'}
+		      ,{field: 'orderName', title: '订单名称', width:'15%'}
+		      ,{field: 'realPrice', title: '实际单价', width:'8%'}
+		      ,{field: 'warehouseName', title:'仓库名称', width:'8%'}
+		      ,{field: 'proName', title:'产品名称', width:'8%'}
+		      ,{field: 'spValue', title:'规格值', width:'8%'}
+		      ,{field: 'abfName', title:'品牌', width:'8%'}
+		      ,{field: 'weight', title:'重量', width:'8%'}
+		      ,{field: 'reaWeight', title:'明细总重量', width:'8%'}
+		      ,{field: 'entryTime', title:'出入库时间', width:'8%',templet : function (d) {
+		    	  if (isEmpty(d.entryTime)) {
+		    		  return '';
+		    	  } else {
+		    		  return d.entryTime;
+		    	  }
+		      }}
+		      ,{field: 'remarks', title:'备注',width:'8%'}
+		      ,{field: 'hwType', title:'货物形式',width:'8%'}
+		      ,{field: 'createTime', title: '创建日期',width:'14%'}
+		      ,{field: 'createUser', title: '创建人',width:'10%'}	   
+		    ]]
+		    ,done: function(res, curr, count){
+		    	console.log(res)
+		        for(var i = 0; i < res.data.length; i ++){
+		        	stockIdList.push(res.data[i].id);
+		        }
+		    	console.log(stockIdList)
+		    }
+		    ,even: true //开启隔行背景
+		  });
+	})
+	
+	function updatePirce(){
+		layer.prompt({title : "请输入实际单价",maxlength: 20},function(value, index, elem){
+			if(isEmpty(value)){
+				$.ErrorAlert('请输入实际单价!');
+	    		return;
+            }
+			var regPos = /^\d+(\.\d+)?$/; //非负浮点数
+	        var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
+	        if(!regPos.test(value) && !regNeg.test(value)){
+	        	$.ErrorAlert('请输入数字');
+                return;
+	        }
+      		//向服务端发送删除指令roleDelete
+      		$.request({
+				action : "giveOutManageAction/updateOrderPriceByGiveOutData",
+				data : {
+					stockIdListStr : stockIdList.join(","),
+					relPrice : value
+				},
+				success : function(resData) {
+					layer.close(index);
+					if (resData.MINStatus == 0) {
+						table.reload('tableStock', {
+					        where: {
+					        	ids : idArray.join(",")
+					        }
+				      	}); 
+						layer.alert('保存成功!',  function(){
+							 layer.close(layer.index);
+						}); 
+					} else {
+						layer.alert(resData.MINErrorMessage, {
+							icon: 5,
+							title: "提示"
+						}); 
+					}
+				},
+				error : function(data2){
+					layer.alert(data2.MINErrorMessage, {
+							icon: 5,
+							title: "提示"
+						}); 
+				}
+    		});
+		});
+	}
+  	
+    </script>
+
+</body>
+
+</html>