no message
							parent
							
								
									5189398d66
								
							
						
					
					
						commit
						771ce18c17
					
				| 
						 | 
					@ -126,6 +126,7 @@ import com.dev.energy.server.util.LocalizedMessage;
 | 
				
			||||||
import com.dev.energy.server.web.security.UserHolder;
 | 
					import com.dev.energy.server.web.security.UserHolder;
 | 
				
			||||||
import com.sun.mail.util.MailSSLSocketFactory;
 | 
					import com.sun.mail.util.MailSSLSocketFactory;
 | 
				
			||||||
import com.sun.org.apache.xpath.internal.operations.And;
 | 
					import com.sun.org.apache.xpath.internal.operations.And;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.log4j.Logger;
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author  dev
 | 
					 * @author  dev
 | 
				
			||||||
| 
						 | 
					@ -3706,42 +3707,43 @@ public class DefaultInventoryManager extends DefaultBaseManager implements Inven
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						/*输送线上的库存*/
 | 
				
			||||||
 | 
						private static List<Long> invIds =new ArrayList<Long>();
 | 
				
			||||||
	//添加整理库存
 | 
						//添加整理库存
 | 
				
			||||||
			public void createReceivingInventory(ReceivedRecord receivedRecord,Location dstloc) {
 | 
						public void createReceivingInventory(ReceivedRecord receivedRecord,Location dstloc) {
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
				ASNDetail ad=commonDao.load(ASNDetail.class, receivedRecord.getAsnDetail().getId());
 | 
					 | 
				
			||||||
				if(ad.getLotInfo()!=null
 | 
					 | 
				
			||||||
						&&ad.getLotInfo().getPropC2()!=null
 | 
					 | 
				
			||||||
						&&ad.getLotInfo().getPropC2().length()>0) {
 | 
					 | 
				
			||||||
					String hql=" from PlantLocation p where p.code='"+ad.getLotInfo().getPropC2()+"' "
 | 
					 | 
				
			||||||
							+ " and p.plantInfo.code='"+ad.getLotInfo().getPropC9()+"' and p.disabled=false";
 | 
					 | 
				
			||||||
					List<PlantLocation> list=commonDao.findByQuery(hql);
 | 
					 | 
				
			||||||
					if(list.size()>0) {
 | 
					 | 
				
			||||||
						ASN asn=commonDao.load(ASN.class, ad.getAsn().getId());
 | 
					 | 
				
			||||||
						PlantLocation  p=list.get(0);
 | 
					 | 
				
			||||||
						if(p.isBeRegister()) {
 | 
					 | 
				
			||||||
							ReceivingInventory  r=new ReceivingInventory();
 | 
					 | 
				
			||||||
							r.setBarCode(receivedRecord.getBarCode());
 | 
					 | 
				
			||||||
							r.setDescription(receivedRecord.getDescription());
 | 
					 | 
				
			||||||
							r.setItemKey(receivedRecord.getItemKey());
 | 
					 | 
				
			||||||
							r.setLocation(dstloc);
 | 
					 | 
				
			||||||
							r.setOperator(receivedRecord.getOperator());
 | 
					 | 
				
			||||||
							r.setReceiveDate(receivedRecord.getReceiveDate());
 | 
					 | 
				
			||||||
							r.setReceivedQuantity(receivedRecord.getReceivedQuantity());
 | 
					 | 
				
			||||||
							r.setReceivedQuantityMU(receivedRecord.getReceivedQuantityMU());
 | 
					 | 
				
			||||||
							r.setReceivedRecordId(receivedRecord.getId());
 | 
					 | 
				
			||||||
							r.setVolume(receivedRecord.getVolume());
 | 
					 | 
				
			||||||
							r.setWeight(receivedRecord.getWeight());
 | 
					 | 
				
			||||||
//							r.setStrBill1(ad.getLotInfo().getPropC7());
 | 
					 | 
				
			||||||
							r.setStrBill1(asn.getUserName());
 | 
					 | 
				
			||||||
							r.setStrBill2(ad.getStrBill7());
 | 
					 | 
				
			||||||
							r.setStrBill3(ad.getStrBill8());
 | 
					 | 
				
			||||||
							commonDao.store(r);
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							ASNDetail ad=commonDao.load(ASNDetail.class, receivedRecord.getAsnDetail().getId());
 | 
				
			||||||
 | 
							if(ad.getLotInfo()!=null
 | 
				
			||||||
 | 
									&&ad.getLotInfo().getPropC2()!=null
 | 
				
			||||||
 | 
									&&ad.getLotInfo().getPropC2().length()>0) {
 | 
				
			||||||
 | 
								String hql=" from PlantLocation p where p.code='"+ad.getLotInfo().getPropC2()+"' "
 | 
				
			||||||
 | 
										+ " and p.plantInfo.code='"+ad.getLotInfo().getPropC9()+"' and p.disabled=false";
 | 
				
			||||||
 | 
								List<PlantLocation> list=commonDao.findByQuery(hql);
 | 
				
			||||||
 | 
								if(list.size()>0) {
 | 
				
			||||||
 | 
									ASN asn=commonDao.load(ASN.class, ad.getAsn().getId());
 | 
				
			||||||
 | 
									PlantLocation  p=list.get(0);
 | 
				
			||||||
 | 
									if(p.isBeRegister()) {
 | 
				
			||||||
 | 
										ReceivingInventory  r=new ReceivingInventory();
 | 
				
			||||||
 | 
										r.setBarCode(receivedRecord.getBarCode());
 | 
				
			||||||
 | 
										r.setDescription(receivedRecord.getDescription());
 | 
				
			||||||
 | 
										r.setItemKey(receivedRecord.getItemKey());
 | 
				
			||||||
 | 
										r.setLocation(dstloc);
 | 
				
			||||||
 | 
										r.setOperator(receivedRecord.getOperator());
 | 
				
			||||||
 | 
										r.setReceiveDate(receivedRecord.getReceiveDate());
 | 
				
			||||||
 | 
										r.setReceivedQuantity(receivedRecord.getReceivedQuantity());
 | 
				
			||||||
 | 
										r.setReceivedQuantityMU(receivedRecord.getReceivedQuantityMU());
 | 
				
			||||||
 | 
										r.setReceivedRecordId(receivedRecord.getId());
 | 
				
			||||||
 | 
										r.setVolume(receivedRecord.getVolume());
 | 
				
			||||||
 | 
										r.setWeight(receivedRecord.getWeight());
 | 
				
			||||||
 | 
					//					r.setStrBill1(ad.getLotInfo().getPropC7());
 | 
				
			||||||
 | 
										r.setStrBill1(asn.getUserName());
 | 
				
			||||||
 | 
										r.setStrBill2(ad.getStrBill7());
 | 
				
			||||||
 | 
										r.setStrBill3(ad.getStrBill8());
 | 
				
			||||||
 | 
										commonDao.store(r);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						}			
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,7 @@ import java.util.Iterator;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
import java.util.Properties;
 | 
					import java.util.Properties;
 | 
				
			||||||
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import net.sf.json.JSONArray;
 | 
					import net.sf.json.JSONArray;
 | 
				
			||||||
import net.sf.json.JSONObject;
 | 
					import net.sf.json.JSONObject;
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,7 @@ import com.dev.energy.server.model.EntityFactory;
 | 
				
			||||||
import com.dev.energy.server.service.pojo.DefaultBaseManager;
 | 
					import com.dev.energy.server.service.pojo.DefaultBaseManager;
 | 
				
			||||||
import com.dev.energy.server.util.LocalizedMessage;
 | 
					import com.dev.energy.server.util.LocalizedMessage;
 | 
				
			||||||
import com.dev.energy.server.web.security.UserHolder;
 | 
					import com.dev.energy.server.web.security.UserHolder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.log4j.Logger;
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @author  dev
 | 
					 * @author  dev
 | 
				
			||||||
| 
						 | 
					@ -1524,9 +1526,8 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public   void allocateWaveDoc(List<Long> WaveDocIds) {
 | 
						public  void allocateWaveDoc(List<Long> WaveDocIds) {
 | 
				
			||||||
		for(Long id:WaveDocIds){
 | 
							for(Long id:WaveDocIds){
 | 
				
			||||||
			WaveDoc wd =this.load(WaveDoc.class, id);//波次单
 | 
								WaveDoc wd =this.load(WaveDoc.class, id);//波次单
 | 
				
			||||||
			if(wd.getAllocatedQuantity()==0){
 | 
								if(wd.getAllocatedQuantity()==0){
 | 
				
			||||||
| 
						 | 
					@ -1535,10 +1536,21 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
 | 
				
			||||||
				new String[] { "id"},new Object[] {wd.getId()});
 | 
									new String[] { "id"},new Object[] {wd.getId()});
 | 
				
			||||||
				if(PickTicketDetails.size()>0){
 | 
									if(PickTicketDetails.size()>0){
 | 
				
			||||||
					for(PickTicketDetail ptd :PickTicketDetails){
 | 
										for(PickTicketDetail ptd :PickTicketDetails){
 | 
				
			||||||
 | 
											StringBuffer sqlBuffer=new StringBuffer();
 | 
				
			||||||
 | 
											sqlBuffer.append(" from Inventory i where i.itemKey.item.id=:id and i.status='已入库' and i.location.type not in ('RECEIVE','SHIP') and i.quantity-i.queuedQuantity>0 "
 | 
				
			||||||
 | 
													+" order by ");
 | 
				
			||||||
 | 
											if (invIds.size()>0) {
 | 
				
			||||||
 | 
												sqlBuffer.append(" CASE  "
 | 
				
			||||||
 | 
														+"   WHEN i.id IN ("+invIds.stream()
 | 
				
			||||||
 | 
											               .map(String::valueOf)
 | 
				
			||||||
 | 
											               .collect(Collectors.joining(","))+") THEN 1 "
 | 
				
			||||||
 | 
														+"   ELSE 0 "
 | 
				
			||||||
 | 
														+" END, ");
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											sqlBuffer.append("i.itemKey.lotInfo.propC3,i.itemKey.lotInfo.propC1,i.quantity");
 | 
				
			||||||
						//分配库存
 | 
											//分配库存
 | 
				
			||||||
						List<Inventory> Inventorys = commonDao.findByQuery(
 | 
											List<Inventory> Inventorys = commonDao.findByQuery(
 | 
				
			||||||
						" from Inventory i where i.itemKey.item.id=:id and i.status='已入库' and i.location.type not in ('RECEIVE','SHIP') and i.quantity-i.queuedQuantity>0 "
 | 
											sqlBuffer.toString(),
 | 
				
			||||||
								+" order by i.itemKey.lotInfo.propC3,i.itemKey.lotInfo.propC1,i.quantity",
 | 
					 | 
				
			||||||
						new String[] { "id" },new Object[] { ptd.getItem().getId() });
 | 
											new String[] { "id" },new Object[] { ptd.getItem().getId() });
 | 
				
			||||||
						if (Inventorys.size() > 0) {
 | 
											if (Inventorys.size() > 0) {
 | 
				
			||||||
							double allocatedQuantity = 0;
 | 
												double allocatedQuantity = 0;
 | 
				
			||||||
| 
						 | 
					@ -1573,6 +1585,17 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
 | 
				
			||||||
									task.setItemKey(inventory.getItemKey());
 | 
														task.setItemKey(inventory.getItemKey());
 | 
				
			||||||
									task.setStorageDate(inventory.getStorageDate());
 | 
														task.setStorageDate(inventory.getStorageDate());
 | 
				
			||||||
									task.setSrcLoc(inventory.getLocation());
 | 
														task.setSrcLoc(inventory.getLocation());
 | 
				
			||||||
 | 
														if (inventory.getLocation().getStock()!=null) {
 | 
				
			||||||
 | 
															task.setStrBill7(inventory.getLocation().getStock().getLP());
 | 
				
			||||||
 | 
														}
 | 
				
			||||||
 | 
														String tItemCode=item.getCode().substring(0, 9);
 | 
				
			||||||
 | 
														String ptCode = ptd.getPickTicket().getCode();
 | 
				
			||||||
 | 
														char lastChar = ptCode.charAt(ptCode.length() - 1);
 | 
				
			||||||
 | 
														if (Character.isUpperCase(lastChar)) {
 | 
				
			||||||
 | 
											                //System.out.println("最后一位是大写字母");
 | 
				
			||||||
 | 
															task.setStrBill8(tItemCode+lastChar);
 | 
				
			||||||
 | 
											            } 
 | 
				
			||||||
 | 
														
 | 
				
			||||||
									task.setSOI(inventory.getSOI());
 | 
														task.setSOI(inventory.getSOI());
 | 
				
			||||||
									task.setPlanQuantity(allocateQty);
 | 
														task.setPlanQuantity(allocateQty);
 | 
				
			||||||
									task.setPlanQuantityMU(allocateQty);
 | 
														task.setPlanQuantityMU(allocateQty);
 | 
				
			||||||
| 
						 | 
					@ -1595,7 +1618,6 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
 | 
				
			||||||
				logger.info("无波次任务!"+"\n");
 | 
									logger.info("无波次任务!"+"\n");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}			
 | 
							}			
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	public   void allocatePlanAll(List<Long> WaveDocIds) {
 | 
						public   void allocatePlanAll(List<Long> WaveDocIds) {
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue