Compare commits

...

4 Commits

Author SHA1 Message Date
暴炳林 2bb9b34925 no message 2024-12-26 16:01:42 +08:00
暴炳林 ac1bef2026 no message 2024-12-26 16:00:03 +08:00
暴炳林 9b8be78c1b Revert "no message"
This reverts commit 771ce18c17.
2024-12-26 11:24:20 +08:00
暴炳林 771ce18c17 no message 2024-12-26 11:24:02 +08:00
10 changed files with 4805 additions and 2 deletions

View File

@ -429,4 +429,7 @@ public interface InventoryManager extends BaseManager{
@Transactional @Transactional
void createReceivingInventory(ReceivedRecord receivedRecord,Location dstloc); void createReceivingInventory(ReceivedRecord receivedRecord,Location dstloc);
/** 查询所有在输送线上的库存*/
@Transactional
List<Long> selectSSXInventory();
} }

View File

@ -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
@ -3743,5 +3744,14 @@ public class DefaultInventoryManager extends DefaultBaseManager implements Inven
} }
} }
public List<Long> selectSSXInventory() {
// TODO 自动生成的方法存根
String sql=" select inv.id from INVENTORY inv "
+" left join LOCATION loc on inv.LOCATION_ID=loc.ID "
+" left join STOCK sto on loc.stock=sto.ID "
+" right join (select containerCode from agvtask "
+" where status='ATWORK') agv on agv.containerCode=sto.REMARK ";
List<Long> ids= jdbcManager.getListLong(sql);
return ids;
}
} }

View File

@ -0,0 +1,210 @@
package com.dev.swms.server.service.picking.allocate;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.transaction.annotation.Transactional;
import com.dev.swms.server.model.abstractEntity.AbstractMoveDoc;
import com.dev.swms.server.model.abstractEntity.AbstractMoveDocDetail;
import com.dev.swms.server.model.base.BillType;
import com.dev.swms.server.model.base.Item;
import com.dev.swms.server.model.base.LotInfo;
import com.dev.swms.server.model.base.Structure;
import com.dev.swms.server.model.base.PackageUnit;
import com.dev.swms.server.model.inventory.AgvTask;
import com.dev.swms.server.model.inventory.ProcessDocBOMDetail;
import com.dev.swms.server.model.inventory.Task;
import com.dev.swms.server.model.rules.PickItemRule;
import com.dev.swms.server.model.shipping.PickTicket;
import com.dev.swms.server.model.shipping.PickTicketDetail;
import com.dev.energy.server.service.BaseManager;
/**
* @author dev
*/
@Transactional(readOnly = true)
public interface AutoAllocator1 extends BaseManager {
/**
*
* @param pickTicketDetails
*/
@Transactional
String preAllocate(List<Long> pickTicketId);
@Transactional(readOnly = false)
String preAllocatePO(List<Long> pickTicketId);
@Transactional(readOnly = false)
String preAllocateDate(Date beginDate,Date endDate);
/**
*
* @param pickTicketDetails
*/
@Transactional
void preAllocate(Collection<PickTicketDetail> pickTicketDetails);
/**
*
* @param pickTicketDetails
*/
@Transactional
void unPreAllocate(Collection<PickTicketDetail> pickTicketDetails);
/**
*
* @param detail
* @param quantity
*/
@Transactional
void unPreAllocate(PickTicketDetail detail, Double quantity);
/**
*
* @param company
* @param billType
* @param itemPickType
* @param item
* @param packageUnit
* @param lotInfo
* @param quantity
* @param abcType
* @return
*/
List<PickItemRule> getPickItemRules(Structure company,BillType billType,String itemPickType,
Item item,PackageUnit packageUnit,LotInfo lotInfo,double quantity,String abcType);
/**
*
* @param moveDoc
* @return
*/
@Transactional
void unallocate(AbstractMoveDoc moveDoc);
@Transactional
void unallocate(AbstractMoveDoc moveDoc,List<PickTicketDetail> details);
/**
*
* @param bomDetail
* @param quantity
*/
@Transactional
void preAllocate(ProcessDocBOMDetail bomDetail, Double quantity);
/**
*
* @param bomDetail
* @param quantity
*/
@Transactional
void unPreAllocate(ProcessDocBOMDetail bomDetail, Double quantity);
/**
*
* @param pickTicketDetail
* @param inventories
*/
@Transactional
void manualAllocate(AbstractMoveDocDetail moveDocDetail, Map inventories);
/**
* ()
* @param ids
* @param type
*/
@Transactional
String allocate(Long pickTicketId, Long waveDocId, Long moveDocId, Collection<AbstractMoveDocDetail> details);
/**
* ()
* @param ids
* @param type
*/
@Transactional
String allocateDetail(AbstractMoveDocDetail detail);
//波次分配
@Transactional
void allocateWaveDoc(List<Long> WaveDocIds);
//波次分配
@Transactional
void allocatePlanAll(List<Long> WaveDocIds);
//波次分配
@Transactional
void newallocateWaveDoc(List<Long> WaveDocIds);
//订单明细分配
//自动创波,ddq1=3#不良品区,ddq2=3#焊接件区,ddq3=3#货架区,ddq4=3#料箱区,ddq5=7#3楼普通库,
//ddq6=7#4楼普通库,ddq7=7#地堆区,ddq8=#堆垛库,ddq9=8#化学品区
@Transactional
List<Task> allocatePickticketDetail(List<Long> ids,int qty,boolean ddq,boolean ddq1,
boolean ddq2,boolean ddq3,boolean ddq4,boolean ddq5,boolean ddq6,boolean ddq7,
boolean ddq8,boolean ddq9,String noLoc);
//按明细分配
@Transactional
void allocatePickticketDetail(List<Long> ids);
//取消分配
@Transactional
void cancelallocate(List<Long> WaveDocIds);
@Transactional
void cancelallocateTaskAgv(List<Long> WaveDocIds);
@Transactional
void cancelPickticket(List<Long> pickIds);
@Transactional
void cancelPickticketDetail(List<Long> pickIds);
//按task取消分配
@Transactional
void cancelTask(List<Long> pickIds);
@Transactional
void shuaxinPick(PickTicket pt);
//料箱出库回传
@Transactional
void returnAGV(List<Long> robotJobIds,String containerCode);
@Transactional
void returnAGV(String code,Boolean takeAwayFlag,List<String> robotJobIds);
//人工呼叫AGV
@Transactional
void artificialAGV(List<Long> ids);
@Transactional
void initializationLabel(long waveDocId);
@Transactional
void callAGV(long waveDocId);
@Transactional
void allautoWaveDetail(List<Long> ids);
@Transactional
String allocatePickticket(PickTicket pt);
//自动下发创波任务
void initiandcallAGV(long waveDocId,List<Long> lxq,List<Long> hjq,List<Long> lkq);
//杂单下发AGV任务
@Transactional
void issueAGV0();
//生成AGV任务平均分配到工作站
@Transactional
void issuedAgvTask(List<Long> ids);
//刷新波次
void shuaXinWaveDoc(long waveDocId);
@Transactional
void taskIssuedAgv(List<Long> ids);
//加急单生成出库任务
@Transactional
void addPickTicketTask(Long asnid,Long userId);
}

View File

@ -0,0 +1,23 @@
package com.dev.swms.server.service.shipping;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import com.dev.swms.server.model.inventory.Inventory;
import com.dev.swms.server.model.inventory.Stock;
import com.dev.swms.server.model.rules.WaveRule;
import com.dev.swms.server.model.shipping.Prewave;
import com.dev.swms.server.model.shipping.WaveDoc;
import com.dev.energy.server.service.BaseManager;
public interface WaveDocManager1 extends BaseManager {
//自动创波,ddq1=3#不良品区,ddq2=3#焊接件区,ddq3=3#货架区,ddq4=3#料箱区,ddq5=7#3楼普通库,
//ddq6=7#4楼普通库,ddq7=7#地堆区,ddq8=#堆垛库,ddq9=8#化学品区
@Transactional
void hotWaveDoc(Date date1,Date date2 ,Integer lxqQty,Integer longtiem,Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode
,boolean ddq1,boolean ddq2,boolean ddq3,boolean ddq4,boolean ddq5,boolean ddq6,boolean ddq7,boolean ddq8,boolean ddq9,Integer taskqty,boolean beUrgent);
}

View File

@ -0,0 +1,447 @@
package com.dev.swms.server.service.shipping.pojo;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;
import com.dev.energy.server.exception.BusinessException;
import com.dev.energy.server.model.EntityFactory;
import com.dev.energy.server.service.pojo.DefaultBaseManager;
import com.dev.swms.server.model.base.Item;
import com.dev.swms.server.model.base.ShiXiao;
import com.dev.swms.server.model.inventory.Inventory;
import com.dev.swms.server.model.inventory.Task;
import com.dev.swms.server.model.inventory.TaskType;
import com.dev.swms.server.model.shipping.PickTicketDetail;
import com.dev.swms.server.model.shipping.WaveDoc;
import com.dev.swms.server.service.base.ItemManager;
import com.dev.swms.server.service.interfaceLog.JdbcManager;
import com.dev.swms.server.service.inventory.InventoryManager;
import com.dev.swms.server.service.picking.allocate.AutoAllocator;
import com.dev.swms.server.service.picking.allocate.AutoAllocator1;
import com.dev.swms.server.service.sequence.BussinessCodeManager;
import com.dev.swms.server.service.shipping.PickTicketManager;
import com.dev.swms.server.service.shipping.WaveDocManager1;
import com.dev.swms.server.utils.TimeNumberUtils;
public class DefaultWaveDocManager1 extends DefaultBaseManager implements
WaveDocManager1 {
private static Logger logger = Logger.getLogger(DefaultWaveDocManager.class);
private final PickTicketManager pickTicketManager;
protected final AutoAllocator1 autoAllocator;
protected final InventoryManager inventoryManager;
protected final ItemManager itemManager;
protected final BussinessCodeManager bussinessCodeManager;
protected final JdbcManager jdbcManager;
protected static Date hotWaveDate=new Date();//波次创建,判断不能同时新建
protected static boolean hotWave=true;//波次创建,判断不能同时新建
public DefaultWaveDocManager1(PickTicketManager pickTicketManager, AutoAllocator1 autoAllocator,
InventoryManager inventoryManager, ItemManager itemManager,BussinessCodeManager bussinessCodeManager,JdbcManager jdbcManager) {
this.pickTicketManager = pickTicketManager;
this.autoAllocator = autoAllocator;
this.inventoryManager = inventoryManager;
this.itemManager=itemManager;
this.bussinessCodeManager = bussinessCodeManager;
this.jdbcManager = jdbcManager;
}
@Override
public void hotWaveDoc(Date date1,Date date2 ,Integer longtiem,Integer lxqQty,Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode
,boolean ddq1,boolean ddq2,boolean ddq3,boolean ddq4,boolean ddq5,boolean ddq6,boolean ddq7,boolean ddq8,boolean ddq9,Integer taskQty,boolean beUrgent) {
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
Date date=new Date();
logger.info(date);
// 1000*60*20,小于20分钟。
/*if(!hotWave&&date.getTime()-hotWaveDate.getTime()<1200000) {
throw new BusinessException("其它人正在创建波次,请稍后");
}*/
hotWave=false;
List<Long> PickTicketDetailIds=null;
List<Long> taskids=new ArrayList<Long>();
List<Long> lxtaskids=new ArrayList<Long>();//料箱区任务
List<Long> hjtaskids=new ArrayList<Long>();//货架区任务
List<Long> lktaskids=new ArrayList<Long>();//立库区任务
//库存料号id
String hqlinv1="select i.itemKey.item.id from Inventory i where i.location.type='存货' "
+ " and i.status='已入库' and i.quantity-i.queuedQuantity>0 and i.counPlan is null "
+ " ";
String hqlmave=" ";//不入波的LOC
List<String> hqllist=commonDao.findByQuery("select pl.code from PlantLocation pl where pl.disabled=0 and pl.beWave=0");
if(hqllist.size()>0) {
hqlmave="";
for(String sh:hqllist) {
hqlmave=hqlmave+"'"+sh+"',";
}
if(hqlmave.length()>4)
hqlmave=hqlmave.substring(0, hqlmave.length()-1);
}
// String hqlmaveloc=" ";//优先入波的LOC
// List<String> hqllist1=commonDao.findByQuery("select pl.code from PlantLocation pl where pl.disabled=0 and pl.bePriorityWave=1");
// if(hqllist1.size()>0) {
// hqlmaveloc="";
// for(String sh:hqllist1) {
// hqlmaveloc=hqlmaveloc+"'"+sh+"',";
// }
// if(hqlmaveloc.length()>4)
// hqlmaveloc=hqlmaveloc.substring(0, hqlmaveloc.length()-1);
// }
if(beUrgent) {
//加急单
taskids=beUrgentTaks(date1, date2, longtiem, lxqQty, hjqQty, lkqQty, ddq, pickCode, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9, taskQty, beUrgent,hqlmave);
}else {
//根据工单号生成任务
if(pickCode!=null&&pickCode.length()>0){
String[] strings=pickCode.split("\n");
String code="";
for(int i=0;i<strings.length;i++) {
String str=strings[i].trim();
if(str!=null&&!str.equals("")) {
code+="'"+str+"',";
}
}
if(code.length()>1) {
code=code.substring(0, code.length()-1);
}
String hql="select ptd.id from PickTicketDetail ptd where 1=1 and ptd.pickTicket.billType.name='工单出库' and "
+ " ptd.orderQuantity>=ptd.allocatedQuantity and ptd.pickedQuantity=0 and ptd.shippedQuantity=0 "
+ " and ptd.pickTicket.status ='OPEN' and ptd.newLotInfo.propC2 not in("+hqlmave+") "
+ " and (ptd.strBill6 is null or ptd.strBill6='' ) "; //and pt.allocatedQuantity=pt.pickedQuantity
if(code.length()>0) {
hql+=" and ptd.pickTicket.code in("+code+")";
}
hql+=" order by ptd.pickTicket.orderDate, ptd.pickTicket.code,ptd.item.code ";
PickTicketDetailIds = commonDao.findByQuery(hql);
}else{
//未分配完成的订单明细
String sql2=" select ptd.id from PickTicketDetail ptd "
+ " where 1=1 and ptd.newLotInfo.propC2 not in("+hqlmave+") "
+ " and ptd.pickTicket.billType.name='工单出库' ";
if(date1==null){
sql2+=" and CONVERT(varchar(100),ptd.pickTicket.orderDate, 23)<='"+sdf.format(date2)+"' ";
}else{
sql2+= " and CONVERT(varchar(100),ptd.pickTicket.orderDate, 23)>='"+sdf.format(date1)+"' ";
sql2+= " and CONVERT(varchar(100),ptd.pickTicket.orderDate, 23)<='"+sdf.format(date2)+"' ";
}
sql2+= " and ptd.orderQuantity>=ptd.allocatedQuantity "
+ " and ptd.pickedQuantity=0 and ptd.shippedQuantity=0 "
+ " and (ptd.strBill6 is null or ptd.strBill6='' ) "
+ " and (ptd.waveDoc.id is null ) "
+ " and ptd.pickTicket.status ='OPEN' " //,'PICKUP','CHECK'
+ " and ptd.item.id in("+hqlinv1+") "
+ " order by ptd.SOI desc,ptd.pickTicket.orderDate, ptd.pickTicket.code ,ptd.item.code ";
PickTicketDetailIds = commonDao.findByQuery(sql2);
}
if(PickTicketDetailIds.size()>0){
//根据条件查询任务行数
//料箱区
long lxqsx=0;
List<Task> lxqTasks=new ArrayList<Task>();
if(lxqQty!=null&&lxqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 2L);//料箱区
lxqsx=(long)loc.getNumber()*lxqQty*longtiem;
}
//货架区
long hjqsx=0;
List<Task> hjqTasks=new ArrayList<Task>();
if(hjqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 3L);//货架区
hjqsx=(long)loc.getNumber()*hjqQty*longtiem;//货架区总数
}
//立库区
long lkqsx=0;
List<Task> lkqTasks=new ArrayList<Task>();
if(lkqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 4L);//立库区
lkqsx=(long)loc.getNumber()*lkqQty*longtiem;
}
long number=lxqsx+hjqsx+lkqsx;
int jyq=0;//平均数
if(lxqsx>0&&lxqQty>0) {
jyq=(int)lxqsx/lxqQty;
}
if(jyq==0&&hjqQty>0) {
jyq=(int)hjqsx/hjqQty;
}
jyq=taskQty;
// logger.info("3---"+new Date());
if(number>0){
//查询加急单号,需要优先分配
String hql2="select ptd.id from PickTicketDetail ptd where ptd.SOI is not null and ptd.SOI <>'' ";
hql2+= " and ptd.orderQuantity>=ptd.allocatedQuantity "
+ " and ptd.pickTicket.billType.name='工单出库' "
+ " and ptd.pickedQuantity=0 and ptd.shippedQuantity=0 "
+ " and (ptd.strBill6 is null or ptd.strBill6='' ) "
+ " and (ptd.waveDoc.id is null ) "
+ " and ptd.newLotInfo.propC2 not in("+hqlmave+")"
+ " and ptd.pickTicket.status ='OPEN' "
+ " and ptd.item.id in("+hqlinv1+") "
+ " order by ptd.SOI desc,ptd.pickTicket.orderDate, ptd.pickTicket.code,ptd.item.code ";
List<Long> pdisd= commonDao.findByQuery(hql2);
boolean bd=true;//是否满足波次行数
// logger.info("4---"+new Date());
for(Long pid:pdisd) {
List<Long> pids=new ArrayList<Long>();
pids.add(pid);
autoAllocator.allocatePickticketDetail(pids,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,hqlmave);//明细分配
// logger.info("5---"+new Date());
List<Object> objs=commonDao.findByQuery("select t.id,t.srcLoc.zone.id from Task t where t.movedQuantityMU=0 and t.pickTicketDetail.id="+pid);
//查询统计总任务数、料箱区任务数、货架区任务、堆垛库任务
// logger.info("6---"+new Date());
if(objs.size()>0) {
for(Object obj:objs) {
Object [] str=(Object [])obj;
String tid=str[0].toString();
String zoneName=str[1].toString();
if(zoneName.equals("1763")) {
lxtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1765")){
hjtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1766")){
lktaskids.add(Long.parseLong(tid));
}
taskids.add(Long.parseLong(tid));
}
}
// logger.info("7---"+new Date());
if(lxqsx>0&&lxqsx<=lxtaskids.size()) {
bd=false;
break;
}else if(hjqsx>0&&hjqsx<=hjtaskids.size()){
bd=false;
break;
}else if(lkqsx>0&&lkqsx<=lktaskids.size()){
bd=false;
break;
}
}
if(bd) {
Long ptsid=null;//最后一个明细id
for(Long pid:PickTicketDetailIds) {
// logger.info("8---"+new Date());
List<Long> pids=new ArrayList<Long>();
ptsid=pid;
pids.add(pid);
autoAllocator.allocatePickticketDetail(pids,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,hqlmave);//明细分配
List<Object> objs=commonDao.findByQuery("select t.id,t.srcLoc.zone.id from Task t where t.movedQuantityMU=0 and t.pickTicketDetail.id="+pid);
//查询统计总任务数、料箱区任务数、货架区任务、堆垛库任务
// logger.info("9---"+new Date());
if(objs.size()>0) {
for(Object obj:objs) {
Object [] str=(Object [])obj;
String tid=str[0].toString();
String zoneName=str[1].toString();
if(zoneName.equals("1763")) {
lxtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1765")){
hjtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1766")){
lktaskids.add(Long.parseLong(tid));
}
taskids.add(Long.parseLong(tid));
}
}
// logger.info("10---"+new Date());
if(lxqsx>0&&lxqsx<=lxtaskids.size()) {
bd=false;
break;
}else if(hjqsx>0&&hjqsx<=hjtaskids.size()){
bd=false;
break;
}else if(lkqsx>0&&lkqsx<=lktaskids.size()){
bd=false;
break;
}
}
//将最后一个工单明细全部分配完成
if(ptsid!=null) {
PickTicketDetail ptdd= commonDao.load(PickTicketDetail.class, ptsid);
if(ptdd!=null) {
List<Long> picklists= commonDao.findByQuery("select p.id from PickTicketDetail p where p.pickTicket.id="+ptdd.getPickTicket().getId()
+" and p.orderQuantity>0 and p.allocatedQuantity=0 and p.newLotInfo.propC2 not in("+hqlmave+") order by p.item.code ");
if(picklists.size()>0) {
autoAllocator.allocatePickticketDetail(picklists,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,hqlmave);//明细分配
List<Long> objs=commonDao.findByQuery("select t.id from Task t where t.movedQuantityMU=0 "
+ " and t.planQuantity>0 and t.pickTicketDetail.pickTicket.id="+ptdd.getPickTicket().getId()+" ");
// taskids.addAll(ts);
if(objs.size()>0) {
for(Long tids:objs) {
if(!taskids.contains(tids)) {
taskids.add(tids);
}
}
}
}
}
}
}
}else {
autoAllocator.allocatePickticketDetail(PickTicketDetailIds,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,hqlmave);//明细分配
if(PickTicketDetailIds.size()>0) {
String robotJobId=StringUtils.strip(PickTicketDetailIds.toString(),"[]");
String sql1=" select "
+ " t.id from Task t "
+ " where 1=1 ";
sql1+= " and t.planQuantity>t.movedQuantityMU "
+ " and t.pickTicketDetail.id in ("+robotJobId+") "
+ " and t.waveDoc.id is null "
+ " order by t.id ";
taskids= commonDao.findByQuery(sql1);
}
}
}
}
List<Long> ids =new ArrayList<Long>();
List<Long> Tasks =null;
// logger.info("18---"+new Date());
//指定出库单创建波次
if(pickCode!=null&&pickCode.length()>0){
String sql="";
if(PickTicketDetailIds.size()==0) {
throw new BusinessException(pickCode+"无可以拣货明细!");
}
String robotJobId=StringUtils.strip(PickTicketDetailIds.toString(),"[]");
sql+="select t.id from Task t "
+ " where 1=1 "
+ " and t.pickTicketDetail.id in ("+robotJobId+") "
+ " and t.planQuantity>t.movedQuantityMU "
+ " and t.waveDoc.id is null "
+ " order by t.id ";
Tasks = commonDao.findByQuery(sql);
}else{
Tasks=taskids;
}
if(Tasks.size()>0){
pickTicketManager.addTaskToWaveDocDetail(Tasks, date1, date2, longtiem, lxqQty, hjqQty, lkqQty, ddq9, pickCode, taskQty);
}
try {
hotWave=true;
hotWaveDate=sdf.parse("2023-02-02");
} catch (ParseException e) {
hotWave=true;
}
}
public List<Long> beUrgentTaks(Date date1,Date date2 ,Integer longtiem,Integer lxqQty,Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode
,boolean ddq1,boolean ddq2,boolean ddq3,boolean ddq4,boolean ddq5,boolean ddq6,boolean ddq7,boolean ddq8,boolean ddq9,Integer taskQty,
boolean beUrgent,String noLoc) {
List<Long> taskids=new ArrayList<Long>();
List<Long> lxtaskids=new ArrayList<Long>();//料箱区任务
List<Long> hjtaskids=new ArrayList<Long>();//货架区任务
List<Long> lktaskids=new ArrayList<Long>();//立库区任务
//料箱区
long lxqsx=0;
List<Task> lxqTasks=new ArrayList<Task>();
if(lxqQty!=null&&lxqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 2L);//料箱区
lxqsx=(long)loc.getNumber()*lxqQty*longtiem;
}
//货架区
long hjqsx=0;
List<Task> hjqTasks=new ArrayList<Task>();
if(hjqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 3L);//货架区
hjqsx=(long)loc.getNumber()*hjqQty*longtiem;//货架区总数
}
//立库区
long lkqsx=0;
List<Task> lkqTasks=new ArrayList<Task>();
if(lkqQty>0){
ShiXiao loc=this.load(ShiXiao.class, 4L);//立库区
lkqsx=(long)loc.getNumber()*lkqQty*longtiem;
}
long number=lxqsx+hjqsx+lkqsx;//总行数
String hql2="select ptd.id from PickTicketDetail ptd where ptd.pickTicket.equatedQuantity in('U','X','H') ";
hql2+= " and ptd.orderQuantity>=ptd.allocatedQuantity "
+ " and ptd.pickTicket.billType.name='工单出库' "
+ " and ptd.pickedQuantity=0 and ptd.shippedQuantity=0 "
+ " and (ptd.strBill6 is null or ptd.strBill6='' ) "
+ " and ptd.newLotInfo.propC2 not in('SL55') "
+ " and (ptd.waveDoc.id is null ) "
+ " and ptd.pickTicket.status ='OPEN' "
+ " order by ptd.SOI desc,ptd.pickTicket.orderDate, ptd.pickTicket.code,ptd.item.code ";
List<Long> pdisd= commonDao.findByQuery(hql2);
boolean bd=true;//是否满足波次行数
Long ptsid=null;//最后一个明细id
for(Long pid:pdisd) {
List<Long> pids=new ArrayList<Long>();
ptsid=pid;
pids.add(pid);
autoAllocator.allocatePickticketDetail(pids,taskQty,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,noLoc);//明细分配
List<Object> objs=commonDao.findByQuery("select t.id,t.srcLoc.zone.id from Task t where t.movedQuantityMU=0 and t.pickTicketDetail.id="+pid);
//查询统计总任务数、料箱区任务数、货架区任务、堆垛库任务
if(objs.size()>0) {
for(Object obj:objs) {
Object [] str=(Object [])obj;
String tid=str[0].toString();
String zoneName=str[1].toString();
if(zoneName.equals("1763")) {
lxtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1765")){
hjtaskids.add(Long.parseLong(tid));
}else if(zoneName.equals("1766")){
lktaskids.add(Long.parseLong(tid));
}
taskids.add(Long.parseLong(tid));
}
}
if(lxqsx>0&&lxqsx<=lxtaskids.size()) {
bd=false;
break;
}else if(hjqsx>0&&hjqsx<=hjtaskids.size()){
bd=false;
break;
}else if(lkqsx>0&&lkqsx<=lktaskids.size()){
bd=false;
break;
}
}
//将最后一个工单明细全部分配完成
if(ptsid!=null) {
PickTicketDetail ptdd= commonDao.load(PickTicketDetail.class, ptsid);
if(ptdd!=null) {
List<Long> picklists= commonDao.findByQuery("select p.id from PickTicketDetail p where p.pickTicket.id="+ptdd.getPickTicket().getId()
+" and p.orderQuantity>0 and p.allocatedQuantity=0 order by p.item.code ");
if(picklists.size()>0) {
autoAllocator.allocatePickticketDetail(picklists,taskQty,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,noLoc);//明细分配
List<Long> objs1=commonDao.findByQuery("select t.id from Task t where t.movedQuantityMU=0 "
+ " and t.planQuantity>0 and t.pickTicketDetail.pickTicket.id="+ptdd.getPickTicket().getId()+" ");
//
if(objs1.size()>0) {
for(Long tids:objs1) {
if(!taskids.contains(tids)) {
taskids.add(tids);
}
}
}
}
}
}
return taskids;
}
}

View File

@ -581,6 +581,32 @@
</bean> </bean>
</property> </property>
</bean> </bean>
<bean id="waveDocManager1" parent="abstractTransactionProxy">
<property name="target">
<bean
class="com.dev.swms.server.service.shipping.pojo.DefaultWaveDocManager1"
parent="baseManager">
<constructor-arg index="0">
<ref local="pickTicketManager" />
</constructor-arg>
<constructor-arg index="1">
<ref local="autoAllocator1" />
</constructor-arg>
<constructor-arg index="2">
<ref local="inventoryManager" />
</constructor-arg>
<constructor-arg index="3">
<ref local="itemManager" />
</constructor-arg>
<constructor-arg index="4">
<ref bean="swmsBussinessCodeManager" />
</constructor-arg>
<constructor-arg index="5">
<ref bean="jdbcManager" />
</constructor-arg>
</bean>
</property>
</bean>
<bean id="waveDocFigManager" parent="abstractTransactionProxy"> <bean id="waveDocFigManager" parent="abstractTransactionProxy">
<property name="target"> <property name="target">
<bean <bean
@ -721,7 +747,38 @@
</bean> </bean>
</property> </property>
</bean> </bean>
<bean id="autoAllocator1" parent="abstractTransactionProxy">
<property name="target">
<bean
class="com.dev.swms.server.service.picking.allocate.DefaultAutoAllocator1"
parent="baseManager">
<constructor-arg index="0">
<ref local="itemManager" />
</constructor-arg>
<constructor-arg index="1">
<ref local="inventoryManager" />
</constructor-arg>
<constructor-arg index="2">
<ref local="swmsBussinessCodeManager" />
</constructor-arg>
<constructor-arg index="3">
<ref local="putawayAllocator" />
</constructor-arg>
<constructor-arg index="4">
<ref local="interfaceManager" />
</constructor-arg>
<constructor-arg index="5">
<ref local="jdbcManager" />
</constructor-arg>
<constructor-arg index="6">
<ref local="agvTaskManager" />
</constructor-arg>
<constructor-arg index="7">
<ref local="interfaceReqManager" />
</constructor-arg>
</bean>
</property>
</bean>
<!-- bussiness code generater --> <!-- bussiness code generater -->
<bean id="swmsBussinessCodeManager" parent="abstractTransactionProxy"> <bean id="swmsBussinessCodeManager" parent="abstractTransactionProxy">
<property name="target"> <property name="target">

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="editbkcbPage1" title="创建波次" onClose="refreshParent" width="600" height="360">
<inputUIs>
<date id="date1" title="开始日期" row="1" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false"/>
<textArea id="pickCode" title="工单选择" row="1" col="2" span="4" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" rows="5" cols="30" />
<date id="date2" title="结束日期" row="2" col="1" span="5" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false"/>
<numberText id="longtiem" title="时长(小时)" row="3" col="1" width="120" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<checkbox id="ddq1" title="3#不良品区" row="3" col="2" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq2" title="3#焊接件区" row="3" col="3" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq3" title="3#货架区" row="3" col="4" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<numberText id="lxqQty" title="3#料箱区工作站数" row="5" col="1" width="120" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<checkbox id="ddq4" title="3#料箱区" row="5" col="2" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq5" title="7#3楼普通库" row="5" col="3" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq6" title="7#4楼普通库" row="5" col="4" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<numberText id="hjqQty" title="3#货架区工作站数" row="6" width="120" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<checkbox id="ddq7" title="7#地堆区" row="6" col="2" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq8" title="7#堆垛库" row="6" col="3" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="ddq9" title="8#化学品区" row="6" col="4" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<numberText id="lkqQty" title="7#堆垛工作站数" row="7" col="1" width="120" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<numberText id="taskQty" title="最大单任务数" row="7" col="2" width="120" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="15"/>
<checkbox id="ddq" title="地堆区是否发当天" row="17" col="1" defaultValue="true" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
<checkbox id="beUrgent" title="是否加急" row="17" col="2" defaultValue="false" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" />
</inputUIs>
<buttons>
<commit id="save" title="save"
enableType="none" invisible="false">
<mappings>
<mapping id="date1" className="date" />
<mapping id="date2" className="date" />
<mapping id="longtiem" className="int" />
<mapping id="lxqQty" className="int" />
<mapping id="hjqQty" className="int" />
<mapping id="lkqQty" className="int" />
<mapping id="ddq" className="boolean" />
<mapping id="pickCode" className="string" />
<mapping id="ddq1" className="boolean" />
<mapping id="ddq2" className="boolean" />
<mapping id="ddq3" className="boolean" />
<mapping id="ddq4" className="boolean" />
<mapping id="ddq5" className="boolean" />
<mapping id="ddq6" className="boolean" />
<mapping id="ddq7" className="boolean" />
<mapping id="ddq8" className="boolean" />
<mapping id="ddq9" className="boolean" />
<mapping id="taskQty" className="int" />
<mapping id="beUrgent" className="boolean" />
</mappings>
<actions>
<action managerName="waveDocManager1" methodName="hotWaveDoc"
parameter="date1,date2,longtiem,lxqQty,hjqQty,lkqQty,ddq,pickCode,ddq1,ddq2,ddq3,ddq4,ddq5,ddq6,ddq7,ddq8,ddq9,taskQty,beUrgent" />
</actions>
<forwards>
<forward name="closeWindow" newEnabled="true" editEnabled="true" />
<forward name="refreshParent" newEnabled="true"
editEnabled="true" />
</forwards>
</commit>
</buttons>
</editPage>
</pages>

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<maintainPage id="maintainWaveDocPage1" title="波次管理" autoQuery="false">
<search>
<inputUIs>
<text id="waveDoc.code" title="waveDoc.code" row="1" col="1"
span="1" readOnly="false" required="false" reserve="false"
forceOverride="true" inVisible="false" trimSpace="true" />
<!-- <list id="waveDoc.status" title="waveDoc.status" row="1" col="2"
span="1" width="120" readOnly="false" required="false" reserve="false"
forceOverride="true" enumType="WaveDocStatus">
<hql><![CDATA[SELECT
enumerate.enumValue,
enumerate.enumValue From Enumerate enumerate
where enumerate.enumType = 'WaveDocStatus'
order by enumerate.id]]></hql>
</list> -->
<date id="beginDate" title="创建日期" row="2" col="1"
readOnly="false" required="false" reserve="false" forceOverride="false"
inVisible="false" showTime="false" manualEditable="true"
defaultCurrentDate="false" />
<date id="endDate" title="至" row="2" col="1"
readOnly="false" required="false" reserve="false" forceOverride="false"
inVisible="false" showTime="false" manualEditable="true"
defaultCurrentDate="false" />
<checkbox id="ordersAll" title="ordersAll" row="3" col="2" defaultValue="false"
span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false"/>
</inputUIs>
</search>
<datasource type="hql"><![CDATA[ select
waveDoc.id,
waveDoc.code,
waveDoc.createDate,
waveDoc.createDate,
waveDoc.quantity,
waveDoc.userName,
waveDoc.status,
waveDoc.lxqQty,
waveDoc.longtiem,
waveDoc.hjqQty,
waveDoc.lkqQty,
waveDoc.updateTime,
waveDoc.updateTime
from WaveDoc waveDoc
left join waveDoc.warehouse
left join waveDoc.prepareGoodsLoc
left join waveDoc.company
where 1=1
and (waveDoc.status not in('CLOSE','PICK_ALL') or ( /~ordersAll: {ordersAll} = true~/ ))
/~SESSION_WAREHOUSE: and waveDoc.warehouse = #{SESSION_WAREHOUSE}~/
/~waveDoc.code: and upper(waveDoc.code) like upper({waveDoc.code}) ~/
/~waveDoc.status: and waveDoc.status = {waveDoc.status} ~/
and (1=1
/~beginDate: AND CONVERT(varchar(100), waveDoc.createDate, 23) = {beginDate} ~/
/~endDate: or (CONVERT(varchar(100), waveDoc.createDate, 23)>= {beginDate} and CONVERT(varchar(100), waveDoc.createDate, 23)<= {endDate}) ~/
)
order by waveDoc.id desc
]]></datasource>
<columns>
<column id="waveDoc.id" title="waveDoc.id" visible="false" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.code" title="waveDoc.code" width="160" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.createDate1" title="创建日期" visible="true" horizonAlign="center" verticalAlign="middle" format="dateFormatter"/>
<column id="waveDoc.createDate2" title="创建时间" visible="true" horizonAlign="center" verticalAlign="middle" format="dateTiemFormatter"/>
<column id="waveDoc.quantity" title="订单个数" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.userName" title="创建人" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.status" title="波次状态" width="150" visible="true" horizonAlign="center" dataType="enum" format="enumFormat" formatParam="WaveStatus" />
<column id="waveDoc.lxqQty" title="料箱工作数" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.longtiem" title="时长(小时)" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.hjqQty" title="货架工作站数" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.lkqQty" title="堆垛工作站数" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="waveDoc.updateTime1" title="完成日期" visible="true" horizonAlign="center" verticalAlign="middle" format="dateFormatter"/>
<column id="waveDoc.updateTime2" title="完成时间" visible="true" horizonAlign="center" verticalAlign="middle" format="dateTiemFormatter"/>
</columns>
<buttons>
<popup id="bkcb" title="创建波次" enableType="none" invisible="false" containId="false" pageId="editbkcbPage1" />
<popup id="issuedAgvTask" title="下发工作站任务" enableType="single" invisible="false"
containId="true" pageId="modifyIssuedAgvTaskPage1" />
<commit id="allocate21" title="下发AGV"
enableType="multi" invisible="false" confirmMessage="确认是否下发?">
<enableExpression><![CDATA[(${waveDoc.status} =='ACTIVE')]]></enableExpression>
<mappings>
<mapping id="ids" className="list" />
</mappings>
<actions>
<action managerName="autoAllocator" methodName="taskIssuedAgv"
parameter="ids" />
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true"
editEnabled="true" />
</forwards>
</commit>
<commit id="cancelallocate" title="取消波次"
enableType="multi" invisible="false" confirmMessage="确认取消波次?">
<enableExpression><![CDATA[(${waveDoc.status} =='OPEN')||(${waveDoc.status} =='ACTIVE')]]></enableExpression>
<mappings>
<mapping id="ids" className="list" />
</mappings>
<actions>
<action managerName="autoAllocator" methodName="cancelallocate"
parameter="ids" />
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true"
editEnabled="true" />
</forwards>
</commit>
<!-- <popup id="create" title="手工创建波次" enableType="none" invisible="false" containId="false" pageId="editCreateWaveDocPage" />
<popup id="modify" title="maintainWaveDocPage.modify" enableType="single" invisible="false" containId="true" pageId="editCreateWaveDocPage" /> -->
<!-- <commit id="allocate" title="maintainWaveDocPage.allocate"
enableType="multi" invisible="false">
<enableExpression><![CDATA[(${waveDoc.status} =='OPEN')]]></enableExpression>
<mappings>
<mapping id="ids" className="list" />
</mappings>
<actions>
<action managerName="autoAllocator" methodName="allocateWaveDoc"
parameter="ids" />
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true"
editEnabled="true" />
</forwards>
</commit> -->
<popup id="bclook1" title="查看未完成任务"
enableType="none" invisible="false" containId="true" pageId="maintainUndoneTaskPage" >
</popup>
</buttons>
</maintainPage>
</pages>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<modifyDetailPage id="modifyIssuedAgvTaskPage1" title="任务信息"
entityClass="com.dev.swms.server.model.shipping.WaveDoc" onClose="refreshParent"
width="850" height="600">
<modify>
<inputUIs>
<hidden id="waveDoc.id" reserve="false" />
<hidden id="waveDoc.status" reserve="false" />
<date id="waveDoc.startDate" title="开始时间" row="1" col="1" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false"/>
<textArea id="waveDoc.applyDoc" title="工单选择" row="1" col="2" span="3" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" rows="5" cols="30" />
<date id="waveDoc.endDate" title="结束时间" row="2" col="1" span="5" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false"/>
<numberText id="waveDoc.longtiem" title="时长" row="3" width="200" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<numberText id="waveDoc.lxqQty" title="3#料箱区工作站数" row="3" width="200" span="3" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<numberText id="waveDoc.hjqQty" title="3#货架区工作站数" row="6" width="200" span="2" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
<numberText id="waveDoc.lkqQty" title="7#堆垛工作站数" row="6" width="200" span="3" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="Integer" defaultValue="0"/>
</inputUIs>
</modify>
<detail autoQuery="false">
<datasource><![CDATA[select
wv.id,
wv.zCode,
wv.tnumber,
wv.taskCode,
wv.number,
case wv.agvStatus
when 0 then '未下发'
when 1 then '已下发'
when 2 then '执行中'
when 3 then '已完成'
else '' end
from waveView wv
where 1=1
and wv.waveDocId={waveDoc.id}
]]></datasource>
<columns>
<column id="wv.id" title="id" visible="false" horizonAlign="center" verticalAlign="middle" />
<column id="wv.zCode" title="库区" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="wv.tnumber" title="任务行" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="wv.wlnumber" title="子任务" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="wv.number" title="推荐工作站数" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="wv.agvStatus" title="状态" visible="true" horizonAlign="center" verticalAlign="middle" />
</columns>
<buttons>
<popup id="issuedTask" title="下发" enableType="none" invisible="false"
containId="false" pageId="editbkcbPage2" >
<enableExpression><![CDATA[(${waveDoc.status} =='OPEN')]]></enableExpression>
</popup>
<!-- <commit id="celenPick" title="下发" enableType="none"
invisible="false" >
<mappings>
<mapping id="waveDoc.id" className="long" />
</mappings>
<actions>
<action managerName="agvTaskManager" methodName="iussedWavaDocAgvTask"
parameter="waveDoc.id" />
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true" editEnabled="true" />
</forwards>
</commit> -->
</buttons>
</detail>
</modifyDetailPage>
</pages>