no message

main
768863620@qq.com 2025-01-07 15:46:28 +08:00
parent 6d9461548b
commit 52603ba6e8
1 changed files with 348 additions and 316 deletions

View File

@ -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();
/* try { */
String sql ="select STUFF((select ','+CONVERT(nvarchar(10),b.id) "
+"from task b "
+"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 LOCATION loc2 on loc2.id=b.SRC_LOC_ID "
+"left join ITEM_KEY ik2 on ik2.id=b.ITEM_KEY_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 "
//" and b.PLAN_QUANTITY_MU-b.MOVED_QUANTITY_MU>0 "+
+" for xml Path('')),1,1,'') as taskId,"
+ "item.code as liaohao ,"
+ "max(z.id) as kuqu,"
+ "max(t.END_REGION) as gzz,"
+"sum(t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU) as jhsl,"
+ "MAX(s2.LP) as rqh ,"
+ "t.BILLCODE as zrwh,"
+ "MAX(pt.code) as gdh,"
+ "MAX(pt.LOGISTICS_COMPANY) as gzzx,"
+ "loc.code as kwh,"
+ "max(t.agv_Status) as rwzt,"
+"max(item.GOOD_TYPE) as wllx,"
+ "max(t.strBill8) as twl "
+"from task t "
+"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 LOCATION loc on loc.id=t.SRC_LOC_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 item on item.id=ik.ITEM_ID "
+"left join STOCK s2 on s2.id=t.SRC_LP "
+"left join STOCK s1 on s1.id=loc.stock "
+"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 "
//+ " 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);
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();
int dataSize=list.size();
List<FenPei> list_fenpei= new ArrayList<FenPei>(); public void allocateGZZ(String waveDocCode, List<Long> lx_gzz_ids,
List<FenPei> list_fenpei_wgzz= new ArrayList<FenPei>();//无需分配工作站数据 List<Long> hj_gzz_ids, List<Long> lk_gzz_ids) {
for(int i=0;i<list.size();i++){ Session session = ((HibernateDaoSupport) this.commonDao)
FenPei bean=new FenPei(); .getSessionFactory().openSession();
bean.tsakId=getValueString(list.get(i),0); /* try { */
bean.liaohao=getValueString(list.get(i),1); String sql = "select STUFF((select ','+CONVERT(nvarchar(10),b.id) "
bean.kuqu=getValueLong(list.get(i),2); + "from task b "
bean.gzz=getValueString(list.get(i),3); + "left join PICK_TICKET_DETAIL ptd1 on ptd1.id=b.PICK_TICKET_DETAIL_ID "
bean.jhsl=getValueFloat(list.get(i),4); + "left join PICK_TICKET pt1 on pt1.id=ptd1.PICK_TICKET_ID "
bean.rqh=getValueString(list.get(i),5); + "left join LOCATION loc2 on loc2.id=b.SRC_LOC_ID "
bean.zrwh=getValueString(list.get(i),6); + "left join ITEM_KEY ik2 on ik2.id=b.ITEM_KEY_ID "
bean.gdh=getValueString(list.get(i),7); + "left join item item2 on item2.id=ik2.ITEM_ID "
bean.gzzx=getValueString(list.get(i),8); + "where 1=1 and b.BILLCODE=t.BILLCODE and pt1.BILL_TYPE_ID=1094 and loc2.id=loc.id and item2.id=item.id "
bean.kwh=getValueString(list.get(i),9); // " and b.PLAN_QUANTITY_MU-b.MOVED_QUANTITY_MU>0 "+
bean.rwzt=getValueInt(list.get(i),10); + " for xml Path('')),1,1,'') as taskId,"
bean.wllx=getValueString(list.get(i),11); + "item.code as liaohao ,"
bean.twl=getValueString(list.get(i),12); + "max(z.id) as kuqu,"
if(bean.kuqu.equals(NewWaveFlag.LXQ)||bean.kuqu.equals(NewWaveFlag.HJQ)||bean.kuqu.equals(NewWaveFlag.LKQ)){ + "max(t.END_REGION) as gzz,"
list_fenpei.add(bean); + "sum(t.PLAN_QUANTITY_MU-t.MOVED_QUANTITY_MU) as jhsl,"
}else{ + "MAX(s2.LP) as rqh ,"
list_fenpei_wgzz.add(bean); + "t.BILLCODE as zrwh,"
+ "MAX(pt.code) as gdh,"
+ "MAX(pt.LOGISTICS_COMPANY) as gzzx,"
+ "loc.code as kwh,"
+ "max(t.agv_Status) as rwzt,"
+ "max(item.GOOD_TYPE) as wllx,"
+ "max(t.strBill8) as twl "
+ "from task t "
+ "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 LOCATION loc on loc.id=t.SRC_LOC_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 item on item.id=ik.ITEM_ID "
+ "left join STOCK s2 on s2.id=t.SRC_LP "
+ "left join STOCK s1 on s1.id=loc.stock "
+ "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 "
// +
// " 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);
Query query = session.createSQLQuery(sql);
List<Object[]> list = (List<Object[]>) query.list();
int dataSize = list.size();
List<FenPei> list_fenpei = new ArrayList<FenPei>();
List<FenPei> list_fenpei_wgzz = new ArrayList<FenPei>();// 无需分配工作站数据
for (int i = 0; i < list.size(); i++) {
FenPei bean = new FenPei();
bean.tsakId = getValueString(list.get(i), 0);
bean.liaohao = getValueString(list.get(i), 1);
bean.kuqu = getValueLong(list.get(i), 2);
bean.gzz = getValueString(list.get(i), 3);
bean.jhsl = getValueFloat(list.get(i), 4);
bean.rqh = getValueString(list.get(i), 5);
bean.zrwh = getValueString(list.get(i), 6);
bean.gdh = getValueString(list.get(i), 7);
bean.gzzx = getValueString(list.get(i), 8);
bean.kwh = getValueString(list.get(i), 9);
bean.rwzt = getValueInt(list.get(i), 10);
String wllx_str = getValueString(list.get(i), 11);
if ("大件".equals(wllx_str)) {
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);
} else {
list_fenpei_wgzz.add(bean);
}
// logger.info(bean.gdh+"---"+bean.twl);
}
// 1个工单对应一个头物料拆分号。
// 工单号 容器号 料号 物料类型 库区 工作中心 //头物料 拆分号 工单总行数
// 1100382814B X8001315 A0101 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 A0102 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 A0101 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 A0102 A 3#料箱区 kanban 512-00004567-F04A
// 计算同一工单总行数。
Map<String, List<FenPei>> gdCount = new HashMap<>();
for (FenPei fenPei : list_fenpei) {
String key_gd_wl = fenPei.gdh + fenPei.wllx;
if (((java.util.Map) gdCount).containsKey(key_gd_wl)) {
List<FenPei> list_count = gdCount.get(key_gd_wl);
list_count.add(fenPei);
gdCount.put(key_gd_wl, list_count);
} else {
List<FenPei> list_count = new ArrayList<FenPei>();
list_count.add(fenPei);
gdCount.put(key_gd_wl, list_count);
}
}
int sumCout = 0;
// 记录每个工单 的数目
List<GdPaiXu> gd_paixuList = new ArrayList<GdPaiXu>();
for (String key : gdCount.keySet()) {
// logger.info("gdh: "+key+" count"+gdCount.get(key).size());
sumCout = sumCout + gdCount.get(key).size();
List<FenPei> list_ll1 = gdCount.get(key);
Collections.sort(list_ll1);
GdPaiXu gdPaiXu = new GdPaiXu(key, list_ll1);
gd_paixuList.add(gdPaiXu);
}
Collections.sort(gd_paixuList);
logger.info("sumCout" + sumCout + "___dataSize:" + dataSize);
// 先根据头物料分组 如果头物料相同 且工单总行数 差异小于4的工单分到一个组里面 (尽量分配到同一工作站)
Map<String, List<GdPaiXu>> touwuliao_map = new HashMap<>();
for (GdPaiXu gdPaiXu : gd_paixuList) {
// 获取当前头物料
String twl = gdPaiXu.twl;
String gdh = gdPaiXu.gdh;
// 获取当前工单的数量
int currCount = gdPaiXu.hangshu;
// logger.info("---gdh:"+gdh+" currCount:"+currCount);
// 在touwuliao_map中进行匹配
boolean isFind = false;
for (String twlKey : touwuliao_map.keySet()) {
String twl_in = touwuliao_map.get(twlKey).get(0).twl;
String gdh_in = touwuliao_map.get(twlKey).get(0).gdh;
int currCount_in = touwuliao_map.get(twlKey).get(0).hangshu;
if (twl_in.equals(twl)
&& Math.abs(currCount - currCount_in) <= 4) {
// 在分配好的数据中找到了相同的头物料 且 数量差小于4
List<GdPaiXu> old = touwuliao_map.get(twlKey);
old.add(gdPaiXu);
touwuliao_map.put(twlKey, old);
isFind = true;
break;
} }
}
logger.info(bean.gdh+"---"+bean.twl); if (!isFind) {
// 未匹配到数据,自己单独一组
List<GdPaiXu> llist = new ArrayList<GdPaiXu>();
llist.add(gdPaiXu);
touwuliao_map.put(twl + "_" + gdh, llist);
} }
//1个工单对应一个头物料拆分号。
//工单号 容器号 料号 物料类型 库区 工作中心 //头物料 拆分号 工单总行数
//1100382814B X8001315 A0101 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 A0102 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 A0101 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 A0102 A 3#料箱区 kanban 512-00004567-F04A
//计算同一工单总行数。
Map<String, List<FenPei> > gdCount = new HashMap<>();
for (FenPei fenPei : list_fenpei) {
if(((java.util.Map) gdCount).containsKey(fenPei.gdh)){
List<FenPei> list_count=gdCount.get(fenPei.gdh);
list_count.add(fenPei);
gdCount.put(fenPei.gdh, list_count);
}else{
List<FenPei> list_count= new ArrayList<FenPei>();
list_count.add(fenPei);
gdCount.put(fenPei.gdh, list_count);
}
}
int sumCout=0;
//记录每个工单 的数目
List<GdPaiXu> gd_paixuList =new ArrayList<GdPaiXu>();
for (String key : gdCount.keySet()) {
logger.info("gdh: "+key+" count"+gdCount.get(key).size());
sumCout=sumCout+gdCount.get(key).size();
List<FenPei> list_ll1=gdCount.get(key);
Collections.sort(list_ll1);
GdPaiXu gdPaiXu=new GdPaiXu(key, list_ll1);
gd_paixuList.add(gdPaiXu);
}
Collections.sort(gd_paixuList);
logger.info("sumCout"+sumCout+"___dataSize:"+dataSize);
//先根据头物料分组 如果头物料相同 且工单总行数 差异小于4的工单分到一个组里面 (尽量分配到同一工作站)
Map<String, List<GdPaiXu>> touwuliao_map = new HashMap<>();
for (GdPaiXu gdPaiXu : gd_paixuList) {
//获取当前头物料
String twl=gdPaiXu.twl;
String gdh=gdPaiXu.gdh;
//获取当前工单的数量
int currCount=gdPaiXu.hangshu;
logger.info("---gdh:"+gdh+" currCount:"+currCount);
//在touwuliao_map中进行匹配
boolean isFind=false;
for (String twlKey : touwuliao_map.keySet()) {
String twl_in=touwuliao_map.get(twlKey).get(0).twl;
String gdh_in=touwuliao_map.get(twlKey).get(0).gdh;
int currCount_in=touwuliao_map.get(twlKey).get(0).hangshu;
if(twl_in.equals(twl)&&Math.abs(currCount-currCount_in)<=4){
//在分配好的数据中找到了相同的头物料 且 数量差小于4
List<GdPaiXu> old=touwuliao_map.get(twlKey);
old.add(gdPaiXu);
touwuliao_map.put(twlKey, old);
isFind=true;
break ;
}
}
if(!isFind){
//未匹配到数据,自己单独一组
List<GdPaiXu> llist=new ArrayList<GdPaiXu>();
llist.add(gdPaiXu);
touwuliao_map.put(twl+"_"+gdh,llist);
}
}
logger.info("-----------------------------------------------------------------------");
logger.info("-----------------------------------------------------------------------");
logger.info("---------------------------打印计算结果--------------------------------------------");
int twl_count=0;
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+"");
}
}
logger.info("-----------------------------------------------------------------------");
logger.info("-----------------------------------------------------------------------");
logger.info("---------------------------打印计算结果--------------------------------------------");
int twl_count = 0;
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 + "");
} }
logger.info("-----------------------------------------------------------------------");
} }
logger.info("twl_count"+twl_count+"___dataSize:"+dataSize); logger.info("-----------------------------------------------------------------------");
//计算没个容器号出现得次数(在每个头物料得分组里面) }
logger.info("twl_count" + twl_count + "___dataSize:" + dataSize);
logger.info("-------------------------------------------------------------------------------打印工单容器号----------------------------------------------------------------------------------------------------------------------------"); // 计算没个容器号出现得次数(在每个头物料得分组里面)
for (String twlKey : touwuliao_map.keySet()) { logger.info("-------------------------------------------------------------------------------打印工单容器号----------------------------------------------------------------------------------------------------------------------------");
List<GdPaiXu> list_show=touwuliao_map.get(twlKey);
Map<String, Integer > rq_showTime = new HashMap<>(); for (String twlKey : touwuliao_map.keySet()) {
List<GdPaiXu> list_show = touwuliao_map.get(twlKey);
for (GdPaiXu fenPei2 : list_show) { Map<String, Integer> rq_showTime = new HashMap<>();
Set<String> set_rqh = new HashSet<>();
StringBuffer rqm_str =new StringBuffer();
for (FenPei fff : fenPei2.list) {
//通过set记录容器号
set_rqh.add(fff.rqh);
}
for(String rqh : set_rqh){ for (GdPaiXu fenPei2 : list_show) {
if(rq_showTime.containsKey(rqh)){ Set<String> set_rqh = new HashSet<>();
int stt=rq_showTime.get(rqh); StringBuffer rqm_str = new StringBuffer();
rq_showTime.put(rqh, stt+1); for (FenPei fff : fenPei2.list) {
rqm_str.append(rqh+" __"+stt+"("+rq_showTime.get(rqh)+")"+""); // 通过set记录容器号
}else{ set_rqh.add(fff.rqh);
rq_showTime.put(rqh, 1); }
rqm_str.append(rqh+" __"+0+"("+rq_showTime.get(rqh)+")"+"");
}
}
for(String key:rq_showTime.keySet()){ for (String rqh : set_rqh) {
if (rq_showTime.containsKey(rqh)) {
int stt = rq_showTime.get(rqh);
rq_showTime.put(rqh, stt + 1);
rqm_str.append(rqh + " __" + stt + "("+ rq_showTime.get(rqh) + ")" + "");
} else {
rq_showTime.put(rqh, 1);
rqm_str.append(rqh + " __" + 0 + "("+ rq_showTime.get(rqh) + ")" + "");
}
}
} }
// 给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(); }
*/
session.close();
/* }catch (Exception e) {
logger.info(e.toString());
session.close();
}finally {
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;
} }
@ -310,11 +347,11 @@ public class DefaultNewWaveManager extends DefaultBaseManager implements NewWave
/** /**
* *
*/ */
public String liaohao; public String liaohao;
/** /**
* *
*/ */
public Long kuqu; public Long kuqu;
/** /**
* *
*/ */
@ -322,7 +359,7 @@ public class DefaultNewWaveManager extends DefaultBaseManager implements NewWave
/** /**
* *
*/ */
public float jhsl; public float jhsl;
/** /**
* *
*/ */
@ -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){ public int getValueInt(Object[] obj, int i) {
int str=-1; int str = -1;
try{ try {
str=Integer.parseInt(obj[i].toString()); str = Integer.parseInt(obj[i].toString());
}catch(Exception e){ } catch (Exception e) {
logger.info(i+""+e.toString()); logger.info(i + "" + e.toString());
str=-1; 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;
} }
} }