no message
							parent
							
								
									66a10e3165
								
							
						
					
					
						commit
						04de4e0122
					
				| 
						 | 
				
			
			@ -2,6 +2,7 @@ package com.dev.swms.server.service.picking.pojo;
 | 
			
		|||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.ObjectInputStream;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.text.SimpleDateFormat;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +22,8 @@ import org.apache.http.entity.StringEntity;
 | 
			
		|||
import org.apache.http.impl.client.DefaultHttpClient;
 | 
			
		||||
import org.apache.http.util.EntityUtils;
 | 
			
		||||
import org.hibernate.Query;
 | 
			
		||||
import org.hibernate.Session;
 | 
			
		||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 | 
			
		||||
 | 
			
		||||
import com.dev.swms.server.interfaces.ItemJobLauncher;
 | 
			
		||||
import com.dev.swms.server.model.base.BillType;
 | 
			
		||||
| 
						 | 
				
			
			@ -561,8 +564,9 @@ public class DefaultMasterBolManager extends DefaultBaseManager implements Maste
 | 
			
		|||
			 //扣减发货单及其明细BOL数量、包箱数量,增加发货单及其明细的发运数量
 | 
			
		||||
			detail.ship(shipQuantity*log.getPackageUnit().getConvertFigure());
 | 
			
		||||
			detail.setStorageDate(log.getStorageDate());
 | 
			
		||||
			commonDao.store(detail);
 | 
			
		||||
			//将库存转移 到中转区库位
 | 
			
		||||
			Inventory inv=findByInventory(log.getItemKey(),WarehouseHolder.getWarehouse(),pt.getDock(),log.getSrcLP()==null?null:log.getSrcLP(),log.getInventoryStatus(),log.getStorageDate(),log.getSOI());
 | 
			
		||||
			Inventory inv=findByInventorys(log.getItemKey(),WarehouseHolder.getWarehouse(),log.getSrcLoc(),log.getSrcLP()==null?null:log.getSrcLP(),log.getInventoryStatus(),log.getStorageDate(),log.getSOI());
 | 
			
		||||
			if(inv==null){
 | 
			
		||||
				throw new BusinessException("未找到对应库存信息!");
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -592,18 +596,52 @@ public class DefaultMasterBolManager extends DefaultBaseManager implements Maste
 | 
			
		|||
		pt.setUserTracking();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private Inventory findByInventory(ItemKey itemKey, Warehouse w,Location location, Stock LP, String status, 
 | 
			
		||||
	private Inventory findByInventorys(ItemKey itemKey, Warehouse w,Location location, Stock LP, String status, 
 | 
			
		||||
			Date storageDate, String soi){
 | 
			
		||||
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 | 
			
		||||
		if(soi==null){
 | 
			
		||||
			soi="";
 | 
			
		||||
		}
 | 
			
		||||
		String hql=" from Inventory inv "
 | 
			
		||||
		Session session = ((HibernateDaoSupport)this.commonDao).getSessionFactory().openSession();
 | 
			
		||||
		List<BigDecimal> list=null;
 | 
			
		||||
		try {
 | 
			
		||||
			String sql=" select ID from INVENTORY "
 | 
			
		||||
					+ "where "
 | 
			
		||||
					+ "QUANTITY>0 "
 | 
			
		||||
					+ "and ITEM_KEY_ID="+itemKey.getId()+" "
 | 
			
		||||
					+ "and WAREHOUSE_ID="+w.getId()+" "
 | 
			
		||||
					+ "and LOCATION_ID="+location.getId()+" "
 | 
			
		||||
					+ "and to_char(STORAGE_DATE,'yyyy-MM-dd')='"+sdf.format(storageDate)+"'  "
 | 
			
		||||
					+ "and SOI='"+soi+"' ";
 | 
			
		||||
			
 | 
			
		||||
			if(LP!=null){
 | 
			
		||||
				sql+=" and LP='"+LP.getLP()+"' ";
 | 
			
		||||
			}
 | 
			
		||||
			if(!StringUtils.isEmpty(status)){
 | 
			
		||||
				sql+=" and STATUS='"+status+"' ";
 | 
			
		||||
			}
 | 
			
		||||
			Query   query   =   session.createSQLQuery(sql); 
 | 
			
		||||
			list= (List<BigDecimal>)query.list();
 | 
			
		||||
			
 | 
			
		||||
		} catch (Exception e) {
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
			System.out.print("连接失败");
 | 
			
		||||
		}finally{
 | 
			
		||||
			session.close();
 | 
			
		||||
        } 
 | 
			
		||||
		
 | 
			
		||||
		if(!list.isEmpty()){
 | 
			
		||||
			Inventory inv=this.load(Inventory.class, list.get(0).longValue());
 | 
			
		||||
			return inv;
 | 
			
		||||
		}else{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		/*String hql=" from Inventory inv "
 | 
			
		||||
				+ "  where inv.quantity>0 "
 | 
			
		||||
				+ "  and inv.itemKey.id="+itemKey.getId()+" "
 | 
			
		||||
				+ "  and inv.warehouse.id="+w.getId()+" "
 | 
			
		||||
				+ "  and inv.location.id="+location.getId()+" "
 | 
			
		||||
				+ "  and to_char(inv.storageDate,'yyyy-MM-dd')='"+sdf.format(storageDate)+"' "
 | 
			
		||||
				//+ "  and to_char(inv.storageDate,'yyyy-MM-dd')='"+sdf.format(storageDate)+"' "
 | 
			
		||||
				+ "  and inv.SOI='"+soi+"' ";
 | 
			
		||||
		if(LP!=null){
 | 
			
		||||
			hql+=" and inv.LP.LP='"+LP.getLP()+"' ";
 | 
			
		||||
| 
						 | 
				
			
			@ -612,8 +650,9 @@ public class DefaultMasterBolManager extends DefaultBaseManager implements Maste
 | 
			
		|||
			hql+=" and inv.status='"+status+"' ";
 | 
			
		||||
		}
 | 
			
		||||
		List<Inventory> invList=commonDao.findByQuery(hql);
 | 
			
		||||
		
 | 
			
		||||
		if(!invList.isEmpty()){
 | 
			
		||||
			return invList.get(0);
 | 
			
		||||
		}*/
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue