no message
parent
6d9461548b
commit
52603ba6e8
|
|
@ -27,254 +27,292 @@ import com.dev.swms.server.utils.interfaceUtil;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class DefaultNewWaveManager extends DefaultBaseManager implements NewWaveManager{
|
public class DefaultNewWaveManager extends DefaultBaseManager implements
|
||||||
private static Logger logger = Logger.getLogger(DefaultNewWaveManager.class);
|
NewWaveManager {
|
||||||
|
private static Logger logger = Logger
|
||||||
|
.getLogger(DefaultNewWaveManager.class);
|
||||||
|
|
||||||
public void allocateGZZ(List<Long> ids){
|
public void allocateGZZ(List<Long> ids) {
|
||||||
for(Long id:ids){
|
for (Long id : ids) {
|
||||||
WaveDoc waveDoc=commonDao.get(WaveDoc.class, id);
|
WaveDoc waveDoc = commonDao.get(WaveDoc.class, id);
|
||||||
allocateGZZ(waveDoc.getCode(),getGZZ(NewWaveFlag.LXQ),getGZZ(NewWaveFlag.HJQ),getGZZ(NewWaveFlag.LKQ));
|
allocateGZZ(waveDoc.getCode(), getGZZ(NewWaveFlag.LXQ),
|
||||||
|
getGZZ(NewWaveFlag.HJQ), getGZZ(NewWaveFlag.LKQ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void allocateGZZ(String waveDocCode,List<Long> lx_gzz_ids,List<Long> hj_gzz_ids,List<Long> lk_gzz_ids){
|
|
||||||
Session session = ((HibernateDaoSupport) this.commonDao).getSessionFactory().openSession();
|
public void allocateGZZ(String waveDocCode, List<Long> lx_gzz_ids,
|
||||||
|
List<Long> hj_gzz_ids, List<Long> lk_gzz_ids) {
|
||||||
|
Session session = ((HibernateDaoSupport) this.commonDao)
|
||||||
|
.getSessionFactory().openSession();
|
||||||
/* try { */
|
/* try { */
|
||||||
String sql ="select STUFF((select ','+CONVERT(nvarchar(10),b.id) "
|
String sql = "select STUFF((select ','+CONVERT(nvarchar(10),b.id) "
|
||||||
+"from task b "
|
+ "from task b "
|
||||||
+"left join PICK_TICKET_DETAIL ptd1 on ptd1.id=b.PICK_TICKET_DETAIL_ID "
|
+ "left join PICK_TICKET_DETAIL ptd1 on ptd1.id=b.PICK_TICKET_DETAIL_ID "
|
||||||
+"left join PICK_TICKET pt1 on pt1.id=ptd1.PICK_TICKET_ID "
|
+ "left join PICK_TICKET pt1 on pt1.id=ptd1.PICK_TICKET_ID "
|
||||||
+"left join LOCATION loc2 on loc2.id=b.SRC_LOC_ID "
|
+ "left join LOCATION loc2 on loc2.id=b.SRC_LOC_ID "
|
||||||
+"left join ITEM_KEY ik2 on ik2.id=b.ITEM_KEY_ID "
|
+ "left join ITEM_KEY ik2 on ik2.id=b.ITEM_KEY_ID "
|
||||||
+"left join item item2 on item2.id=ik2.ITEM_ID "
|
+ "left join item item2 on item2.id=ik2.ITEM_ID "
|
||||||
+"where 1=1 and b.BILLCODE=t.BILLCODE and pt1.BILL_TYPE_ID=1094 and loc2.id=loc.id and item2.id=item.id "
|
+ "where 1=1 and b.BILLCODE=t.BILLCODE and pt1.BILL_TYPE_ID=1094 and loc2.id=loc.id and item2.id=item.id "
|
||||||
//" and b.PLAN_QUANTITY_MU-b.MOVED_QUANTITY_MU>0 "+
|
// " and b.PLAN_QUANTITY_MU-b.MOVED_QUANTITY_MU>0 "+
|
||||||
+" for xml Path('')),1,1,'') as taskId,"
|
+ " for xml Path('')),1,1,'') as taskId,"
|
||||||
+ "item.code as liaohao ,"
|
+ "item.code as liaohao ,"
|
||||||
+ "max(z.id) as kuqu,"
|
+ "max(z.id) as kuqu,"
|
||||||
+ "max(t.END_REGION) as gzz,"
|
+ "max(t.END_REGION) as gzz,"
|
||||||
+"sum(t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU) as jhsl,"
|
+ "sum(t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU) as jhsl,"
|
||||||
+ "MAX(s2.LP) as rqh ,"
|
+ "MAX(s2.LP) as rqh ,"
|
||||||
+ "t.BILLCODE as zrwh,"
|
+ "t.BILLCODE as zrwh,"
|
||||||
+ "MAX(pt.code) as gdh,"
|
+ "MAX(pt.code) as gdh,"
|
||||||
+ "MAX(pt.LOGISTICS_COMPANY) as gzzx,"
|
+ "MAX(pt.LOGISTICS_COMPANY) as gzzx,"
|
||||||
+ "loc.code as kwh,"
|
+ "loc.code as kwh,"
|
||||||
+ "max(t.agv_Status) as rwzt,"
|
+ "max(t.agv_Status) as rwzt,"
|
||||||
+"max(item.GOOD_TYPE) as wllx,"
|
+ "max(item.GOOD_TYPE) as wllx,"
|
||||||
+ "max(t.strBill8) as twl "
|
+ "max(t.strBill8) as twl "
|
||||||
+"from task t "
|
+ "from task t "
|
||||||
+"left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID "
|
+ "left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID "
|
||||||
+"left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID "
|
+ "left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID "
|
||||||
+"left join LOCATION loc on loc.id=t.SRC_LOC_ID "
|
+ "left join LOCATION loc on loc.id=t.SRC_LOC_ID "
|
||||||
+"left join ZONE z on z.id=loc.ZONE_ID "
|
+ "left join ZONE z on z.id=loc.ZONE_ID "
|
||||||
+"left join ITEM_KEY ik on ik.id=t.ITEM_KEY_ID "
|
+ "left join ITEM_KEY ik on ik.id=t.ITEM_KEY_ID "
|
||||||
+"left join ITEM item on item.id=ik.ITEM_ID "
|
+ "left join ITEM item on item.id=ik.ITEM_ID "
|
||||||
+"left join STOCK s2 on s2.id=t.SRC_LP "
|
+ "left join STOCK s2 on s2.id=t.SRC_LP "
|
||||||
+"left join STOCK s1 on s1.id=loc.stock "
|
+ "left join STOCK s1 on s1.id=loc.stock "
|
||||||
+"left join WAVE_DOC wd on wd.id=t.WAVE_DOC_ID "
|
+ "left join WAVE_DOC wd on wd.id=t.WAVE_DOC_ID "
|
||||||
+"where 1=1 and pt.BILL_TYPE_ID=1094 and wd.code='"+waveDocCode+"' and t.WAVE_DOC_ID is not null "
|
+ "where 1=1 and pt.BILL_TYPE_ID=1094 and wd.code='"
|
||||||
//+ " t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU>0 and t.agv_status=0 "
|
+ waveDocCode
|
||||||
+"group by pt.code,t.BILLCODE,item.id,item.code,item.BE_MARK_WEIGHT,loc.id,loc.code,ik.PROP_C1,ik.PROP_C2,ik.PROP_C3,ik.PROP_D1,ik.PROP_D2,item.ISBOM "
|
+ "' and t.WAVE_DOC_ID is not null "
|
||||||
+"order by min(t.skips ),max(loc.code) asc, item.id,pt.code,t.BILLCODE ";
|
// +
|
||||||
|
// " t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU>0 and t.agv_status=0 "
|
||||||
|
+ "group by pt.code,t.BILLCODE,item.id,item.code,item.BE_MARK_WEIGHT,loc.id,loc.code,ik.PROP_C1,ik.PROP_C2,ik.PROP_C3,ik.PROP_D1,ik.PROP_D2,item.ISBOM "
|
||||||
|
+ "order by min(t.skips ),max(loc.code) asc, item.id,pt.code,t.BILLCODE ";
|
||||||
logger.info(sql);
|
logger.info(sql);
|
||||||
Query query = session.createSQLQuery(sql);
|
Query query = session.createSQLQuery(sql);
|
||||||
List<Object[]> list= (List<Object[]>)query.list();
|
List<Object[]> list = (List<Object[]>) query.list();
|
||||||
int dataSize=list.size();
|
int dataSize = list.size();
|
||||||
|
|
||||||
List<FenPei> list_fenpei= new ArrayList<FenPei>();
|
List<FenPei> list_fenpei = new ArrayList<FenPei>();
|
||||||
List<FenPei> list_fenpei_wgzz= new ArrayList<FenPei>();//无需分配工作站数据
|
List<FenPei> list_fenpei_wgzz = new ArrayList<FenPei>();// 无需分配工作站数据
|
||||||
for(int i=0;i<list.size();i++){
|
for (int i = 0; i < list.size(); i++) {
|
||||||
FenPei bean=new FenPei();
|
FenPei bean = new FenPei();
|
||||||
bean.tsakId=getValueString(list.get(i),0);
|
bean.tsakId = getValueString(list.get(i), 0);
|
||||||
bean.liaohao=getValueString(list.get(i),1);
|
bean.liaohao = getValueString(list.get(i), 1);
|
||||||
bean.kuqu=getValueLong(list.get(i),2);
|
bean.kuqu = getValueLong(list.get(i), 2);
|
||||||
bean.gzz=getValueString(list.get(i),3);
|
bean.gzz = getValueString(list.get(i), 3);
|
||||||
bean.jhsl=getValueFloat(list.get(i),4);
|
bean.jhsl = getValueFloat(list.get(i), 4);
|
||||||
bean.rqh=getValueString(list.get(i),5);
|
bean.rqh = getValueString(list.get(i), 5);
|
||||||
bean.zrwh=getValueString(list.get(i),6);
|
bean.zrwh = getValueString(list.get(i), 6);
|
||||||
bean.gdh=getValueString(list.get(i),7);
|
bean.gdh = getValueString(list.get(i), 7);
|
||||||
bean.gzzx=getValueString(list.get(i),8);
|
bean.gzzx = getValueString(list.get(i), 8);
|
||||||
bean.kwh=getValueString(list.get(i),9);
|
bean.kwh = getValueString(list.get(i), 9);
|
||||||
bean.rwzt=getValueInt(list.get(i),10);
|
bean.rwzt = getValueInt(list.get(i), 10);
|
||||||
bean.wllx=getValueString(list.get(i),11);
|
String wllx_str = getValueString(list.get(i), 11);
|
||||||
bean.twl=getValueString(list.get(i),12);
|
if ("大件".equals(wllx_str)) {
|
||||||
if(bean.kuqu.equals(NewWaveFlag.LXQ)||bean.kuqu.equals(NewWaveFlag.HJQ)||bean.kuqu.equals(NewWaveFlag.LKQ)){
|
wllx_str = "big";
|
||||||
|
} else {
|
||||||
|
wllx_str = "small";
|
||||||
|
}
|
||||||
|
bean.wllx = wllx_str;
|
||||||
|
|
||||||
|
bean.twl = getValueString(list.get(i), 12);
|
||||||
|
if (bean.kuqu.equals(NewWaveFlag.LXQ)
|
||||||
|
|| bean.kuqu.equals(NewWaveFlag.HJQ)
|
||||||
|
|| bean.kuqu.equals(NewWaveFlag.LKQ)) {
|
||||||
list_fenpei.add(bean);
|
list_fenpei.add(bean);
|
||||||
}else{
|
} else {
|
||||||
list_fenpei_wgzz.add(bean);
|
list_fenpei_wgzz.add(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(bean.gdh+"---"+bean.twl);
|
// logger.info(bean.gdh+"---"+bean.twl);
|
||||||
|
|
||||||
}
|
}
|
||||||
//1个工单对应一个头物料拆分号。
|
// 1个工单对应一个头物料拆分号。
|
||||||
//工单号 ; 容器号 ; 料号 物料类型 ; 库区 ; 工作中心 //头物料 拆分号 工单总行数
|
// 工单号 ; 容器号 ; 料号 物料类型 ; 库区 ; 工作中心 //头物料 拆分号 工单总行数
|
||||||
//1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
// 1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
||||||
//1100382814B X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
// 1100382814B X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
||||||
//1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
// 1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
||||||
//1100382814B X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
// 1100382814B X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
||||||
//1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
// 1100382814B X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04B 1 5
|
||||||
//1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
// 1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
||||||
//1100382814A X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04A
|
// 1100382814A X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04A
|
||||||
//1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
// 1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
||||||
//1100382814A X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04A
|
// 1100382814A X8001315 A0101 A 3#料箱区 kanban 512-00004567-F04A
|
||||||
//1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
// 1100382814A X8001315 A0102 A 3#料箱区 kanban 512-00004567-F04A
|
||||||
|
|
||||||
//计算同一工单总行数。
|
// 计算同一工单总行数。
|
||||||
Map<String, List<FenPei> > gdCount = new HashMap<>();
|
Map<String, List<FenPei>> gdCount = new HashMap<>();
|
||||||
|
|
||||||
for (FenPei fenPei : list_fenpei) {
|
for (FenPei fenPei : list_fenpei) {
|
||||||
if(((java.util.Map) gdCount).containsKey(fenPei.gdh)){
|
String key_gd_wl = fenPei.gdh + fenPei.wllx;
|
||||||
List<FenPei> list_count=gdCount.get(fenPei.gdh);
|
if (((java.util.Map) gdCount).containsKey(key_gd_wl)) {
|
||||||
|
List<FenPei> list_count = gdCount.get(key_gd_wl);
|
||||||
list_count.add(fenPei);
|
list_count.add(fenPei);
|
||||||
gdCount.put(fenPei.gdh, list_count);
|
gdCount.put(key_gd_wl, list_count);
|
||||||
}else{
|
} else {
|
||||||
List<FenPei> list_count= new ArrayList<FenPei>();
|
List<FenPei> list_count = new ArrayList<FenPei>();
|
||||||
list_count.add(fenPei);
|
list_count.add(fenPei);
|
||||||
gdCount.put(fenPei.gdh, list_count);
|
gdCount.put(key_gd_wl, list_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int sumCout=0;
|
int sumCout = 0;
|
||||||
//记录每个工单 的数目
|
// 记录每个工单 的数目
|
||||||
|
|
||||||
List<GdPaiXu> gd_paixuList =new ArrayList<GdPaiXu>();
|
List<GdPaiXu> gd_paixuList = new ArrayList<GdPaiXu>();
|
||||||
for (String key : gdCount.keySet()) {
|
for (String key : gdCount.keySet()) {
|
||||||
logger.info("gdh: "+key+" count:"+gdCount.get(key).size());
|
// logger.info("gdh: "+key+" count:"+gdCount.get(key).size());
|
||||||
sumCout=sumCout+gdCount.get(key).size();
|
sumCout = sumCout + gdCount.get(key).size();
|
||||||
List<FenPei> list_ll1=gdCount.get(key);
|
List<FenPei> list_ll1 = gdCount.get(key);
|
||||||
Collections.sort(list_ll1);
|
Collections.sort(list_ll1);
|
||||||
GdPaiXu gdPaiXu=new GdPaiXu(key, list_ll1);
|
GdPaiXu gdPaiXu = new GdPaiXu(key, list_ll1);
|
||||||
gd_paixuList.add(gdPaiXu);
|
gd_paixuList.add(gdPaiXu);
|
||||||
}
|
}
|
||||||
Collections.sort(gd_paixuList);
|
Collections.sort(gd_paixuList);
|
||||||
logger.info("sumCout"+sumCout+"___dataSize:"+dataSize);
|
logger.info("sumCout" + sumCout + "___dataSize:" + dataSize);
|
||||||
|
|
||||||
//先根据头物料分组 如果头物料相同 且工单总行数 差异小于4的工单分到一个组里面 (尽量分配到同一工作站)
|
// 先根据头物料分组 如果头物料相同 且工单总行数 差异小于4的工单分到一个组里面 (尽量分配到同一工作站)
|
||||||
|
|
||||||
Map<String, List<GdPaiXu>> touwuliao_map = new HashMap<>();
|
Map<String, List<GdPaiXu>> touwuliao_map = new HashMap<>();
|
||||||
|
|
||||||
for (GdPaiXu gdPaiXu : gd_paixuList) {
|
for (GdPaiXu gdPaiXu : gd_paixuList) {
|
||||||
|
|
||||||
//获取当前头物料
|
// 获取当前头物料
|
||||||
String twl=gdPaiXu.twl;
|
String twl = gdPaiXu.twl;
|
||||||
String gdh=gdPaiXu.gdh;
|
String gdh = gdPaiXu.gdh;
|
||||||
//获取当前工单的数量
|
// 获取当前工单的数量
|
||||||
int currCount=gdPaiXu.hangshu;
|
int currCount = gdPaiXu.hangshu;
|
||||||
logger.info("---gdh:"+gdh+" currCount:"+currCount);
|
// logger.info("---gdh:"+gdh+" currCount:"+currCount);
|
||||||
//在touwuliao_map中进行匹配
|
// 在touwuliao_map中进行匹配
|
||||||
boolean isFind=false;
|
boolean isFind = false;
|
||||||
for (String twlKey : touwuliao_map.keySet()) {
|
for (String twlKey : touwuliao_map.keySet()) {
|
||||||
String twl_in=touwuliao_map.get(twlKey).get(0).twl;
|
String twl_in = touwuliao_map.get(twlKey).get(0).twl;
|
||||||
String gdh_in=touwuliao_map.get(twlKey).get(0).gdh;
|
String gdh_in = touwuliao_map.get(twlKey).get(0).gdh;
|
||||||
int currCount_in=touwuliao_map.get(twlKey).get(0).hangshu;
|
int currCount_in = touwuliao_map.get(twlKey).get(0).hangshu;
|
||||||
if(twl_in.equals(twl)&&Math.abs(currCount-currCount_in)<=4){
|
if (twl_in.equals(twl)
|
||||||
//在分配好的数据中找到了相同的头物料 且 数量差小于4
|
&& Math.abs(currCount - currCount_in) <= 4) {
|
||||||
List<GdPaiXu> old=touwuliao_map.get(twlKey);
|
// 在分配好的数据中找到了相同的头物料 且 数量差小于4
|
||||||
|
List<GdPaiXu> old = touwuliao_map.get(twlKey);
|
||||||
old.add(gdPaiXu);
|
old.add(gdPaiXu);
|
||||||
touwuliao_map.put(twlKey, old);
|
touwuliao_map.put(twlKey, old);
|
||||||
isFind=true;
|
isFind = true;
|
||||||
break ;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isFind){
|
if (!isFind) {
|
||||||
//未匹配到数据,自己单独一组
|
// 未匹配到数据,自己单独一组
|
||||||
List<GdPaiXu> llist=new ArrayList<GdPaiXu>();
|
List<GdPaiXu> llist = new ArrayList<GdPaiXu>();
|
||||||
llist.add(gdPaiXu);
|
llist.add(gdPaiXu);
|
||||||
touwuliao_map.put(twl+"_"+gdh,llist);
|
touwuliao_map.put(twl + "_" + gdh, llist);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("-----------------------------------------------------------------------");
|
logger.info("-----------------------------------------------------------------------");
|
||||||
logger.info("-----------------------------------------------------------------------");
|
logger.info("-----------------------------------------------------------------------");
|
||||||
logger.info("---------------------------打印计算结果--------------------------------------------");
|
logger.info("---------------------------打印计算结果--------------------------------------------");
|
||||||
int twl_count=0;
|
int twl_count = 0;
|
||||||
for (String twlKey : touwuliao_map.keySet()) {
|
for (String twlKey : touwuliao_map.keySet()) {
|
||||||
List<GdPaiXu> list_show=touwuliao_map.get(twlKey);
|
List<GdPaiXu> list_show = touwuliao_map.get(twlKey);
|
||||||
for (GdPaiXu fenPei2 : list_show) {
|
for (GdPaiXu fenPei2 : list_show) {
|
||||||
logger.info("twl"+fenPei2.twl+" GDH:"+fenPei2.gdh+" twlKey:"+twlKey+" GDHCount:"+fenPei2.hangshu);
|
logger.info("twl" + fenPei2.twl + " GDH:" + fenPei2.gdh+ " twlKey:" + twlKey + " GDHCount:"+ fenPei2.hangshu);
|
||||||
twl_count++;
|
twl_count++;
|
||||||
StringBuffer rqm =new StringBuffer();
|
StringBuffer rqm = new StringBuffer();
|
||||||
for (FenPei fff : fenPei2.list) {
|
for (FenPei fff : fenPei2.list) {
|
||||||
rqm.append(fff.rqh+",");
|
rqm.append(fff.rqh + ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("-----------------------------------------------------------------------");
|
logger.info("-----------------------------------------------------------------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
logger.info("twl_count"+twl_count+"___dataSize:"+dataSize);
|
logger.info("twl_count" + twl_count + "___dataSize:" + dataSize);
|
||||||
|
|
||||||
//计算没个容器号出现得次数(在每个头物料得分组里面)
|
// 计算没个容器号出现得次数(在每个头物料得分组里面)
|
||||||
|
|
||||||
logger.info("-------------------------------------------------------------------------------打印工单容器号----------------------------------------------------------------------------------------------------------------------------");
|
logger.info("-------------------------------------------------------------------------------打印工单容器号----------------------------------------------------------------------------------------------------------------------------");
|
||||||
|
|
||||||
for (String twlKey : touwuliao_map.keySet()) {
|
for (String twlKey : touwuliao_map.keySet()) {
|
||||||
List<GdPaiXu> list_show=touwuliao_map.get(twlKey);
|
List<GdPaiXu> list_show = touwuliao_map.get(twlKey);
|
||||||
|
|
||||||
Map<String, Integer > rq_showTime = new HashMap<>();
|
Map<String, Integer> rq_showTime = new HashMap<>();
|
||||||
|
|
||||||
for (GdPaiXu fenPei2 : list_show) {
|
for (GdPaiXu fenPei2 : list_show) {
|
||||||
Set<String> set_rqh = new HashSet<>();
|
Set<String> set_rqh = new HashSet<>();
|
||||||
StringBuffer rqm_str =new StringBuffer();
|
StringBuffer rqm_str = new StringBuffer();
|
||||||
for (FenPei fff : fenPei2.list) {
|
for (FenPei fff : fenPei2.list) {
|
||||||
//通过set记录容器号
|
// 通过set记录容器号
|
||||||
set_rqh.add(fff.rqh);
|
set_rqh.add(fff.rqh);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String rqh : set_rqh){
|
for (String rqh : set_rqh) {
|
||||||
if(rq_showTime.containsKey(rqh)){
|
if (rq_showTime.containsKey(rqh)) {
|
||||||
int stt=rq_showTime.get(rqh);
|
int stt = rq_showTime.get(rqh);
|
||||||
rq_showTime.put(rqh, stt+1);
|
rq_showTime.put(rqh, stt + 1);
|
||||||
rqm_str.append(rqh+" __"+stt+"("+rq_showTime.get(rqh)+")"+",");
|
rqm_str.append(rqh + " __" + stt + "("+ rq_showTime.get(rqh) + ")" + ",");
|
||||||
}else{
|
} else {
|
||||||
rq_showTime.put(rqh, 1);
|
rq_showTime.put(rqh, 1);
|
||||||
rqm_str.append(rqh+" __"+0+"("+rq_showTime.get(rqh)+")"+",");
|
rqm_str.append(rqh + " __" + 0 + "("+ rq_showTime.get(rqh) + ")" + ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String key:rq_showTime.keySet()){
|
}
|
||||||
|
// 给touwuliao_map的 中 按照容器出现次数进行排序
|
||||||
|
List<GdPaiXu> list_show_new = new ArrayList<>();
|
||||||
|
for (GdPaiXu fenPei2 : list_show) {
|
||||||
|
List<FenPei> list_new = new ArrayList<>();
|
||||||
|
for (FenPei f1 : fenPei2.list) {
|
||||||
|
f1.show_time = rq_showTime.get(f1.rqh);
|
||||||
|
f1.paixu_type = 1;
|
||||||
|
list_new.add(f1);
|
||||||
|
}
|
||||||
|
Collections.sort(list_new);
|
||||||
|
fenPei2.list = list_new;
|
||||||
|
list_show_new.add(fenPei2);
|
||||||
|
}
|
||||||
|
touwuliao_map.put(twlKey, list_show_new);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("-----------"+rqm_str.toString());
|
logger.info("-----------------------------------------------------------------------");
|
||||||
}
|
logger.info("-----------------------------------------------------------------------");
|
||||||
logger.info("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
logger.info("---------------------------打印计算结果-------------------------------------------");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算拆分号 (为了15个为一组的工单) 拆分号等于 工单总行数 /15(可配置) 根据容器号。物料
|
// 计算拆分号 (为了15个为一组的工单) 拆分号等于 工单总行数 /15(可配置) 根据容器号。物料
|
||||||
|
|
||||||
|
for (String twlKey : touwuliao_map.keySet()) {
|
||||||
|
List<GdPaiXu> list_show = touwuliao_map.get(twlKey);
|
||||||
|
for (GdPaiXu fenPei2 : list_show) {
|
||||||
|
logger.info("twl" + fenPei2.twl + " GDH:" + fenPei2.gdh+ " twlKey:" + twlKey + " GDHCount:"+ fenPei2.hangshu);
|
||||||
|
twl_count++;
|
||||||
|
StringBuffer rqm = new StringBuffer();
|
||||||
|
for (FenPei fff : fenPei2.list) {
|
||||||
|
rqm.append(fff.rqh + "("+fff.show_time+") ");
|
||||||
|
}
|
||||||
|
logger.info(rqm.toString());
|
||||||
|
}
|
||||||
|
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||||
|
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||||
|
|
||||||
|
}
|
||||||
|
// 写入数据库
|
||||||
|
|
||||||
|
/*
|
||||||
|
* }catch (Exception e) { logger.info(e.toString()); session.close();
|
||||||
//写入数据库
|
* }finally { session.close(); }
|
||||||
|
*/
|
||||||
|
|
||||||
/* }catch (Exception e) {
|
|
||||||
logger.info(e.toString());
|
|
||||||
session.close();
|
|
||||||
}finally {
|
|
||||||
session.close();
|
|
||||||
}*/
|
|
||||||
session.close();
|
session.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeToDb(List<FenPei> list_fenpei) {
|
||||||
|
for (FenPei fp : list_fenpei) {
|
||||||
public void writeToDb( List<FenPei> list_fenpei){
|
String[] ids = fp.tsakId.split(",");
|
||||||
for(FenPei fp:list_fenpei ){
|
for (int i = 0; i <= ids.length; i++) {
|
||||||
String[] ids=fp.tsakId.split(",");
|
Task task = this.commonDao.get(Task.class,
|
||||||
for(int i=0;i<=ids.length;i++){
|
Long.parseLong(ids[i]));
|
||||||
Task task=this.commonDao.get(Task.class, Long.parseLong(ids[i]));
|
// 保留原有信息字段做对比分析
|
||||||
//保留原有信息字段做对比分析
|
if (task.getOldGzz() == null) {
|
||||||
if(task.getOldGzz()==null){
|
|
||||||
task.setOldGzz(task.getEndRegion());
|
task.setOldGzz(task.getEndRegion());
|
||||||
task.setOldZrw(task.getBillCode());
|
task.setOldZrw(task.getBillCode());
|
||||||
}
|
}
|
||||||
//对分析后的数据进行赋值
|
// 对分析后的数据进行赋值
|
||||||
task.setEndRegion(null);
|
task.setEndRegion(null);
|
||||||
task.setBillCode(null);
|
task.setBillCode(null);
|
||||||
this.commonDao.store(task);
|
this.commonDao.store(task);
|
||||||
|
|
@ -282,18 +320,17 @@ public class DefaultNewWaveManager extends DefaultBaseManager implements NewWave
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class GdPaiXu implements Comparable<GdPaiXu> {
|
class GdPaiXu implements Comparable<GdPaiXu> {
|
||||||
public String gdh; //工单号
|
public String gdh; // 工单号
|
||||||
public int hangshu;//工单行数
|
public int hangshu;// 工单行数
|
||||||
public String twl;//头物料
|
public String twl;// 头物料
|
||||||
public List<FenPei> list;
|
public List<FenPei> list;
|
||||||
|
|
||||||
public GdPaiXu(String gdh,List<FenPei> list ){
|
public GdPaiXu(String gdh, List<FenPei> list) {
|
||||||
this.gdh=gdh;
|
this.gdh = gdh;
|
||||||
this.hangshu=list.size();
|
this.hangshu = list.size();
|
||||||
this.twl=list.get(0).twl;
|
this.twl = list.get(0).twl;
|
||||||
this.list=list;
|
this.list = list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,8 +373,6 @@ public class DefaultNewWaveManager extends DefaultBaseManager implements NewWave
|
||||||
*/
|
*/
|
||||||
public String gdh;
|
public String gdh;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作中心
|
* 工作中心
|
||||||
*/
|
*/
|
||||||
|
|
@ -364,84 +399,81 @@ public class DefaultNewWaveManager extends DefaultBaseManager implements NewWave
|
||||||
*/
|
*/
|
||||||
public String chf;
|
public String chf;
|
||||||
|
|
||||||
public int paixu_type=0;
|
public int paixu_type = 0;
|
||||||
|
|
||||||
public int show_time=0;
|
public int show_time = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(FenPei old) {
|
public int compareTo(FenPei old) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
if(paixu_type==0){
|
if (paixu_type == 0) {
|
||||||
try{
|
try {
|
||||||
return this.rqh.compareTo(old.rqh);
|
return this.rqh.compareTo(old.rqh);
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
try{
|
try {
|
||||||
return this.show_time-old.show_time;
|
return old.show_time - this.show_time;
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getValueInt(Object[] obj, int i) {
|
||||||
}
|
int str = -1;
|
||||||
|
try {
|
||||||
public int getValueInt(Object[] obj,int i){
|
str = Integer.parseInt(obj[i].toString());
|
||||||
int str=-1;
|
} catch (Exception e) {
|
||||||
try{
|
logger.info(i + "" + e.toString());
|
||||||
str=Integer.parseInt(obj[i].toString());
|
str = -1;
|
||||||
}catch(Exception e){
|
|
||||||
logger.info(i+""+e.toString());
|
|
||||||
str=-1;
|
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueString(Object[] obj,int i){
|
public String getValueString(Object[] obj, int i) {
|
||||||
String str="";
|
String str = "";
|
||||||
try{
|
try {
|
||||||
str=(String)obj[i];
|
str = (String) obj[i];
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
logger.info(i+""+e.toString());
|
logger.info(i + "" + e.toString());
|
||||||
str="";
|
str = "";
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getValueLong(Object[] obj,int i){
|
public Long getValueLong(Object[] obj, int i) {
|
||||||
Long str=0l;
|
Long str = 0l;
|
||||||
try{
|
try {
|
||||||
str=Long.parseLong(obj[i].toString());
|
str = Long.parseLong(obj[i].toString());
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
logger.info(i+""+e.toString());
|
logger.info(i + "" + e.toString());
|
||||||
str=0l;
|
str = 0l;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
public float getValueFloat(Object[] obj ,int i){
|
|
||||||
float v=0.0f;
|
public float getValueFloat(Object[] obj, int i) {
|
||||||
try{
|
float v = 0.0f;
|
||||||
v=Float.parseFloat(obj[i].toString());
|
try {
|
||||||
}catch(Exception e){
|
v = Float.parseFloat(obj[i].toString());
|
||||||
v=0;
|
} catch (Exception e) {
|
||||||
logger.info(i+""+e.toString());
|
v = 0;
|
||||||
|
logger.info(i + "" + e.toString());
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Long> getGZZ(Long zone_id) {
|
||||||
public List<Long> getGZZ(Long zone_id){
|
String hql = "select id from LocationStorage l where l.type='拣货' and l.warehouseArea.id="
|
||||||
String hql="select id from LocationStorage l where l.type='拣货' and l.warehouseArea.id="+zone_id;//+" and l.beAuto=1";
|
+ zone_id;// +" and l.beAuto=1";
|
||||||
List<Long> ids=commonDao.findByQuery(hql);
|
List<Long> ids = commonDao.findByQuery(hql);
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue