main
userName 2025-06-18 15:13:26 +08:00
parent 1a99b3e1f0
commit 58fb33b702
29 changed files with 1045 additions and 111 deletions

View File

@ -70,4 +70,10 @@ public interface ImportFileManager extends BaseManager{
*/
@Transactional
void importOutOrderDetail(File file);
/**
*
* @param file
*/
@Transactional
void importOtherOrderDetail(File file);
}

View File

@ -2306,11 +2306,11 @@ public class DefaultAgvTaskManager extends DefaultBaseManager implements AgvTask
DateUtil.formatDateYMDToStr(day)+"' group by CONVERT(varchar(100), agv.createTime, 23) ";
List<Long> list=commonDao.findByQuery(hql);
if(list.size()>0) {
h=list.get(0)-99;
h=list.get(0)-100;
}
List<AgvTask> listcode=new ArrayList<AgvTask>();
String hql2=" from AgvTask agv where "
+ " agv.status='ATCALL' and agv.targetArea in('214','215') ";
String hql2=" from AgvTask agv where agv.beIssue=true "
+ " and agv.status='ATCALL' and agv.targetArea in('214','215') ";
listcode=commonDao.findByQuery(hql2);
if(listcode.size()>0) {
for(AgvTask ash:listcode) {
@ -2359,11 +2359,11 @@ public class DefaultAgvTaskManager extends DefaultBaseManager implements AgvTask
agv.setRemarks("超时加急任务");
agv.setUrgentTime(new Date());
commonDao.store(agv);
if(maplist.size()>0&&maplist.containsKey(agv.getContainerCode())) {
if(agv.getTargetArea().indexOf("214")==-1 && agv.getTargetArea().indexOf("215")==-1
&&maplist.size()>0&&maplist.containsKey(agv.getContainerCode())) {
List<AgvTask> listasv=maplist.get(agv.getContainerCode());
for(AgvTask agv2:listasv) {
//取消214、215的任务
// AgvTask agvTask=commonDao.load(AgvTask.class, id);
cancellationAgvTask(agv2);
}
}

View File

@ -1835,7 +1835,7 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
pickTicketDetail.setLineNumber(lineNumber);
pickTicketDetail.setPickTicket(pickTicket);
pickTicketDetail.getLineNumber();
// pickTicketDetail.setSOI(SOI);
pickTicketDetail.setStrBill5(item.getUnit());
pickTicketDetail.setOrderQuantity(Double.valueOf(orderQuantity));
pickTicketDetail.setAllocatedQuantity(0);
pickTicketDetail.setPickedQuantity(0);
@ -1858,4 +1858,90 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
e.printStackTrace();
}
}
@Override
public void importOtherOrderDetail(File file) {
try {
Workbook workbook = Workbook.getWorkbook(file);
Sheet sheet = workbook.getSheet(0);// 得到excel第一页的内容
/* 查询单据类型*/
List<BillType> billTypes=commonDao.findByQuery(
"from BillType bt where code='QPUTPTC' ");
Warehouse warehouse=this.load(Warehouse.class, 1l);
PickTicket pickTicket=null;
for (int i = 1; i <sheet.getRows(); i++) {
int j=0;
String status=PickTicketStatus.OPEN;//状态
String itemCode=sheet.getCell(j++,i).getContents().trim();//料号
if (itemCode.length()<1) {
break;
}
String orderQuantity=sheet.getCell(j++,i).getContents().trim();//需求数量
String lotPropC9=sheet.getCell(j++,i).getContents().trim();//工厂
String lotPropC2=sheet.getCell(j++,i).getContents().trim();//LOC
String barCode=sheet.getCell(j++,i).getContents().trim();//序列号
/*获取工单集合 工单*/
if (pickTicket==null) {
pickTicket=EntityFactory.getEntity(PickTicket.class);
/* 新建工单*/
pickTicket.setSourceType("QPUTPTC");
pickTicket.setCode(bussinessCodeManager.getCodeForYm("CP",5));
pickTicket.setCollectNo(pickTicket.getCode());
pickTicket.setOrderDate(new Date());
pickTicket.setStatus(status);
if(billTypes.size()>0) {
pickTicket.setBillType(billTypes.get(0));
}
pickTicket.setWorkerName1(lotPropC9);
pickTicket.setUpdateTime(new Date());
pickTicket.setWarehouse(warehouse);
commonDao.store(pickTicket);
}
if(lotPropC9==null||lotPropC9.length()==0) {
throw new BusinessException(i+1+"行,LOC错误!");
}
if(lotPropC2==null||lotPropC2.length()==0) {
throw new BusinessException(i+1+"行,LOC错误!");
}
if(orderQuantity==null||orderQuantity.length()==0||orderQuantity.equals("0")) {
throw new BusinessException(i+1+"行,数量错误错误!");
}
Item item=null;
List<Item> itemList=commonDao.findByQuery(
"from Item i where i.code=:code",
new String[] { "code" }, new Object[] { itemCode});
if (itemList.size()>0) {
item=itemList.get(0);
}else {
throw new BusinessException(i+1+"行,料号"+itemCode+"错误!");
}
PickTicketDetail pickTicketDetail=new PickTicketDetail();
/* 新增明细*/
pickTicketDetail.setItem(item);
pickTicketDetail.setLineNumber(i+"");
pickTicketDetail.setPickTicket(pickTicket);
pickTicketDetail.setOrderQuantity(Double.valueOf(orderQuantity));
pickTicketDetail.setAllocatedQuantity(0);
pickTicketDetail.setPickedQuantity(0);
pickTicketDetail.setStrBill5(item.getUnit());
NewLotInfo newLotInfo=new NewLotInfo();
newLotInfo.setPropC2(lotPropC2);
newLotInfo.setPropC9(lotPropC9);
pickTicketDetail.setNewLotInfo(newLotInfo);
pickTicketDetail.setStrBill14(barCode);
commonDao.store(pickTicketDetail);
pickTicket.setOrderQuantity(pickTicket.getOrderQuantity()+Double.valueOf(orderQuantity));
pickTicket.setPackageQuantity(pickTicket.getPackageQuantity()+1);
commonDao.store(pickTicket);
}
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

View File

@ -804,11 +804,13 @@ public class DefaultInterfaceReqManager extends DefaultBaseManager implements In
jsonobj.put("INPUT", array);
if(asn.getCode().indexOf("RP")==-1&&(billType.getCode().equals("CPUTASN")||billType.getCode().equals("ZPUTASN")||billType.getCode().equals("QPUTASN"))
&&asn.getCode().indexOf("OT")==-1) {
if(getPropertiesParm("ldxt.bz").equals("1")) {
String flag = doWmsReqSap(getPropertiesParm("ldxt.SAP")+ApiURL.doWmsReqSap, jsonobj.toString(),"整理"+billType.getCode()+becode);
if (flag!=null) {
//
}
}
}
}
}

View File

@ -206,8 +206,8 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
}
if(asn_code!=null&&!asn_code.equals("")) {
sql+=" and (asn.code='"+asn_code.trim()+"' or "
+ "asn.related_Bill1='"+asn_code.trim()+"' "
+ " or ad.strBill7='"+asn_code.trim()+"')";
+ "asn.related_Bill1='"+asn_code.trim()+"' "
+ " or ad.strBill7='"+asn_code.trim()+"')";
}
if(type.equals("2")) {
@ -230,12 +230,12 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
// sql+= " and ((ad.ftl_qty=0 and ad.EXPECTED_QUANTITY>ad.RECEIVED_QUANTITY) or (ad.ftl_qty>0 and ad.ftl_qty>ad.RECEIVED_QUANTITY)) "
sql+= " order by ad.strBill8,item.code";
logger.info("-----------itemCode-0002"+itemcode);
// logger.info("-----------itemCode-0002"+itemcode);
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();
logger.info("-----------itemCode-0003"+itemcode);
// logger.info("-----------itemCode-0003"+itemcode);
String sql1=" select ad.id,ad.EXPECTED_QUANTITY,ad.RECEIVED_QUANTITY from ASN_DETAIL ad "
+ " left join ASN asn on asn.id=ad.ASN_ID "
+ " left join ITEM item on item.id=ad.ITEM_ID "
@ -503,7 +503,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " where 1=1 and ad.BE_QUALITY=1 and ad.strBill=0 ";
if(asn_code!=null&&!asn_code.equals("")) {
sql+="and (upper(asn.related_Bill1)=upper('"+asn_code.trim()+"') or item.code='"+asn_code.trim()+"')";
sql+="and ((asn.related_Bill1)=('"+asn_code.trim()+"') or item.code='"+asn_code.trim()+"')";
}
sql+= " and ad.RECEIVED_QUANTITY=0 and ad.BE_QUALITY=1 ";
@ -738,7 +738,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ZONE z on z.id=lx.ZONE_ID "
+ " left join stock s on s.id=lx.stock "
+ " where 1=1 "
+ " and upper(lx.code)=upper('"+zone_code.trim()+"') "
+ " and (lx.code)=('"+zone_code.trim()+"') "
+ " and lx.DISABLED=0 and z.id in(1763,1765,1783,1768,1808)";
Query query1 = session.createSQLQuery(sql1);
List<Object[]> list1= (List<Object[]>)query1.list();
@ -912,7 +912,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ZONE z on z.id=lx.ZONE_ID "
+ " left join stowage s on s.id=lx.STOWAGE_ID "
+ " where 1=1 "
+ " and upper(lx.code)=upper('"+locode.trim()+"') "
+ " and (lx.code)=('"+locode.trim()+"') "
+ " and lx.DISABLED=0 ";
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();
@ -969,7 +969,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ZONE z on z.id=lx.ZONE_ID "
+ " left join stowage s on s.id=lx.STOWAGE_ID "
+ " where 1=1 "
+ " and upper(lx.code)=upper('"+locode.trim()+"') "
+ " and (lx.code)=('"+locode.trim()+"') "
+ " and lx.DISABLED=0 ";
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();
@ -1049,7 +1049,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join Seed_Wall bzq on bzq.id=pt.Seed_Wall_ID "
+ " left join WAVE_DOC wd on wd.id=pt.wave_Doc_ID "
+ " where 1=1 "
+ " and upper(bzq.code)=upper('"+bzqCode.trim()+"') ";
+ " and (bzq.code)=('"+bzqCode.trim()+"') ";
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();
if(list.size()>0){
@ -1193,7 +1193,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join zone z on item.id=mdd.warehouse_Area_ID_SRC "
+ " where 1=1 and mdd.PLAN_QUANTITY_MU-mdd.MOVE_QUANTITY>0";
if(itemCode!=null && itemCode.length()>0){
sql+=" and (upper(item.code) like upper('%"+ itemCode + "%') and upper(mdd.strBill2) = upper('"+ xlh +"'))";
sql+=" and ((item.code) like ('%"+ itemCode + "%') and (mdd.strBill2) = ('"+ xlh +"'))";
}
// if(asn_code!=null && asn_code.length()>0){
// sql+=" and (upper(md.RELATEBILLCODE) like upper('%"+ asn_code + "%') or upper(s.LP) like upper('%"+ asn_code +"%'))";
@ -1284,11 +1284,11 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join zone z on z.id=mdd.warehouse_Area_ID_SRC "
+ " where 1=1 and mdd.PLAN_QUANTITY_MU-mdd.MOVE_QUANTITY>0";
if(itemCode!=null && itemCode.length()>0){
sql+=" and (upper(item.code) like upper('"+ itemCode + "%') )";
sql+=" and ((item.code) like ('"+ itemCode + "%') )";
}
if(asn_code!=null && asn_code.length()>0){
sql+=" and (upper(md.RELATEBILLCODE) like upper('"+ asn_code + "%') )";
sql+=" and ((md.RELATEBILLCODE) like ('"+ asn_code + "%') )";
}
if(barCode!=null&&barCode.length()>0){
sql+=" and (s.LP like '"+ barCode + "%' )";
@ -1505,7 +1505,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ITEM item on item.id=ik.ITEM_ID "
+ " where 1=1 ";
if(parameter!=null && parameter.length()>0){
sql+=" and upper(item.code) like upper('%"+ parameter + "%') ";
sql+=" and (item.code) like ('%"+ parameter + "%') ";
}
sql+=" order by lx.code ";
Query query = session.createSQLQuery(sql);
@ -3409,10 +3409,12 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
String status = "0";
String msg = "";
String data = "";
Session session = ((HibernateDaoSupport) this.commonDao).getSessionFactory().openSession();
try {
if (userId > 0) {
if (warehouseId > 0) {
/**
* 20250617sql
String sql = "select t.billCode,max(t.pickTicketDetail.pickTicket.code) as code,max(t.srcLoc.zone.name) as name,"
+ "max(t.pickTicketDetail.pickTicket.relatedBill3) as relatedBill3"
+ ", max(t.pickTicketDetail.pickTicket.equatedQuantity) as equatedQuantity,"
@ -3433,6 +3435,33 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
sql+=" group by t.billCode ,t.srcLoc.zone.beBill,t.srcLoc.zone.beStock "
+ " order by max(t.pickTicketDetail.pickTicket.equatedQuantity) desc,max(t.dateBill1),t.billCode ";
List<Object[]> objs = commonDao.findByQuery(sql);
*/
String sql2="select t.BILLCODE,max(pt.CODE) as pt_code,max(z.NAME) as zname,\r\n" +
"max(pt.RELATED_BILL3) as RELATED_BILL3,max(pt.equated_Quantity) as equated_Quantity,\r\n" +
"max(ptd.strBill13) as strBill13 ,max(z.id) as zone_id,z.beBill,max(z.LEVELS) as LEVELS2,\r\n" +
"z.beStock,COUNT(DISTINCT t.BILLCODE + lc.code + ct.code) as hang\r\n" +
" from task t\r\n" +
" left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID\r\n" +
" left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID\r\n" +
" left join LOCATION lc on lc.id=t.SRC_LOC_ID\r\n" +
" left join [ZONE] z on z.id=lc.ZONE_ID\r\n" +
//" left join ITEM_KEY ik on ik.id=t.ITEM_KEY_ID\r\n" +
" left join ITEM ct on ct.id=ptd.ITEM_ID \r\n" +
" left join WORKER w on w.id=t.WORKER1_ID\r\n" +
" where t.agv_Status='1' and t.PLAN_QUANTITY>t.MOVED_QUANTITY_MU\r\n" +
" and z.CARRIER_TYPE_ID=3 and t.agvTask_ID is null ";
if(type.equals("0")){
sql2+=" and w.id is null ";
}else if(type.equals("1")){
sql2+=" and w.id="+userId+" ";
}
sql2+=" GROUP BY t.BILLCODE,z.beBill,z.beStock " +
" ORDER BY max(pt.equated_Quantity) desc,max(t.dateBill1),t.BILLCODE";
Query query = session.createSQLQuery(sql2);
List<Object[]> objs= (List<Object[]>)query.list();
if (objs .size() > 0) {
for(Object[] object:objs){
String billCode=object[0].toString()==null?"":object[0].toString();
@ -3445,7 +3474,8 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
String beBill=object[7]==null?"":object[7].toString();//是否合单
String levels2=object[8]==null?"":object[8].toString();//合单标记
String beStock=object[9]==null?"":object[9].toString();//是否料号交单
String hang=countLing(billCode);
String hangqty=object[10]==null?"":object[10].toString();//是否料号交单
String hang=hangqty+"/"+hangqty;//countLing(billCode);//未完成行/总行数
obj.put("taskCode", billCode);
obj.put("qty", hang);
obj.put("zoneName", zoneName);
@ -3489,6 +3519,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
e.printStackTrace();
msg = e.getMessage();
} finally {
session.close();
}
resultJson.put("status", status);
resultJson.put("data", data);
@ -3499,16 +3530,14 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
public synchronized String countLing(String billCode){
String resut="";
//总行数=序列号数量+不是序列号数量
List<Object[]> xlh = commonDao.findByQuery("select t.billCode, t.srcLoc.id,t.itemKey.item.id from Task t where t.billCode='"+billCode+"' and t.agvTask.id is null and t.itemKey.item.beMarkWeight=1 group by t.billCode, t.srcLoc.id,t.itemKey.item.id ");
List<Object[]> noxlh = commonDao.findByQuery("select t.billCode from Task t where t.billCode='"+billCode+"' and t.agvTask.id is null and t.itemKey.item.beMarkWeight=0 group by t.billCode ");
List<Object[]> xlh = commonDao.findByQuery("select t.billCode, t.srcLoc.id,t.itemKey.item.id from Task t where t.billCode='"+billCode+"' and t.agvTask.id is null group by t.billCode, t.srcLoc.id,t.itemKey.item.id ");
// List<Object[]> noxlh = commonDao.findByQuery("select t.billCode from Task t where t.billCode='"+billCode+"' and t.agvTask.id is null and t.itemKey.item.beMarkWeight=0 group by t.billCode ");
List<Object[]> wacxlh = commonDao.findByQuery("select t.billCode, t.srcLoc.id,t.itemKey.item.id from Task t where t.billCode='"+billCode+"' and t.planQuantityMU>t.movedQuantityMU and t.agvTask.id is null and t.itemKey.item.beMarkWeight=1 group by t.billCode, t.srcLoc.id,t.itemKey.item.id ");
List<Object[]> wacnoxlh = commonDao.findByQuery("select t.billCode from Task t where t.billCode='"+billCode+"' and t.planQuantityMU>t.movedQuantityMU and t.agvTask.id is null and t.itemKey.item.beMarkWeight=0 group by t.billCode ");
List<Object[]> wacxlh = commonDao.findByQuery("select t.billCode, t.srcLoc.id,t.itemKey.item.id from Task t where t.billCode='"+billCode+"' and t.planQuantityMU>t.movedQuantityMU and t.agvTask.id is null group by t.billCode, t.srcLoc.id,t.itemKey.item.id ");
// List<Object[]> wacnoxlh = commonDao.findByQuery("select t.billCode from Task t where t.billCode='"+billCode+"' and t.planQuantityMU>t.movedQuantityMU and t.agvTask.id is null and t.itemKey.item.beMarkWeight=0 group by t.billCode ");
resut=(wacxlh.size()+wacnoxlh.size())+"/"+(xlh.size()+noxlh.size());
resut=(wacxlh.size())+"/"+(xlh.size());
return resut;
}
//盘点
@ -3782,6 +3811,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
e.printStackTrace();
msg = e.getMessage();
} finally {
}
resultJson.put("status", status);
@ -5530,7 +5560,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ZONE z on z.id=lx.ZONE_ID "
+ " left join stock s on s.id=lx.stock "
+ " where 1=1 "
+ " and upper(lx.code)=upper('"+locCode.trim()+"') "
+ " and (lx.code)=('"+locCode.trim()+"') "
+ " and lx.DISABLED=0 ";
Query query1 = session.createSQLQuery(sql1);
List<Object[]> list1= (List<Object[]>)query1.list();
@ -6050,16 +6080,16 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join zone z on z.id=mdd.warehouse_Area_ID_SRC "
+ " where z.id=1765 and mdd.PLAN_QUANTITY_MU-mdd.MOVE_QUANTITY>0";
if(itemCode!=null && itemCode.length()>0){
sql+=" and (upper(item.code) like upper('"+ itemCode + "%') )";
sql+=" and ((item.code) like ('"+ itemCode + "%') )";
}
if(asn_code!=null && asn_code.length()>0){
sql+=" and (upper(md.RELATEBILLCODE) like upper('"+ asn_code + "%') )";
sql+=" and ((md.RELATEBILLCODE) ('"+ asn_code + "%') )";
}
if(stockCode!=null&&stockCode.length()>0){
sql+=" and (upper(s.LP) like upper('"+ stockCode + "%') )";
sql+=" and ((s.LP) like ('"+ stockCode + "%') )";
}
sql+=" order by mdd.ID ";
@ -7362,7 +7392,7 @@ public class DefaultQueryAppManager extends DefaultBaseManager implements QueryA
+ " left join ITEM item on item.id=ik.ITEM_ID "
+ " left join STOCK stock on stock.id=loc.stock "
+ " where 1=1 "
+ " and upper(stock.LP)=upper('"+stockCode.trim()+"') "
+ " and (stock.LP)=('"+stockCode.trim()+"') "
+ " and inv.RECEIVED_QUANTITY>0 and inv.BE_MOVED=0 ";
Query query = session.createSQLQuery(sql);
List<Object[]> list= (List<Object[]>)query.list();

View File

@ -20,6 +20,7 @@ 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.swms.server.model.shipping.WaveDoc;
import com.dev.energy.server.service.BaseManager;
/**
@ -145,6 +146,10 @@ public interface AutoAllocator extends BaseManager {
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
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,WaveDoc waveDoc);
//按明细分配
@Transactional
void allocatePickticketDetail(List<Long> ids);

View File

@ -3166,6 +3166,290 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
return tasks;
}
public 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,WaveDoc waveDoc) {
String msg="";
List<Task> tasks=new ArrayList<Task>();
for (int i = 0; i < ids.size(); i++) {
Long id=Long.valueOf(ids.get(i)+"");
PickTicketDetail ptd= commonDao.load(PickTicketDetail.class, id);
if(ptd.getOrderQuantity()- ptd.getAllocatedQuantity()<=0) {
continue;
}
Date date=new Date();
if(ptd.getStrBill6()==null||ptd.getStrBill6().length()<=0){
PickTicket pt=ptd.getPickTicket();
//分配库存
String hql1=" from Inventory i where i.itemKey.item.id=:id and i.location.type='存货'"
+ "and i.status='已入库' and i.quantity-i.queuedQuantity>0 and i.counPlan is null "
+ " ";
//不能入波的LOC
if(noLoc!=null&&!noLoc.equals("")) {
hql1+=" and i.itemKey.lotInfo.propC2 not in("+noLoc+")";
}
//自动创波,ddq1=3#不良品区,ddq2=3#焊接件区,ddq3=3#货架区,ddq4=3#料箱区,ddq5=7#3楼普通库,
//ddq6=7#4楼普通库,ddq7=7#地堆区,ddq8=7#堆垛库,ddq9=8#化学品区
String kqno="";
if(!ddq1) {
kqno+="1798,";
}
if(!ddq2) {
kqno+="1773,";
}
if(!ddq3) {
kqno+="1765,";
}
if(!ddq4) {
kqno+="1763,";
}
if(!ddq5) {
kqno+="1768,";
}
if(!ddq6) {
kqno+="1783,";
}
if(!ddq7) {
kqno+="1808,";
}
if(!ddq8) {
kqno+="1766,";
}
if(!ddq9) {
kqno+="1799,";
}
if(kqno.length()>0) {
kqno=kqno.substring(0, kqno.length()-1);
hql1+=" and i.location.zone.id not in("+kqno+") ";
}
if(ddq&&ptd.getPickTicket().getOrderDate().getTime()>=date.getTime()) {
hql1+=" and i.location.zone.id not in(1808) ";
}
if(ptd.getNewLotInfo()!=null) {
if(ptd.getNewLotInfo().getPropC1()!=null&&!ptd.getNewLotInfo().getPropC1().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC1='"+ptd.getNewLotInfo().getPropC1()+"'";
}
// if(ptd.getNewLotInfo()!=null&&ptd.getNewLotInfo().getPropC2()!=null&&ptd.getNewLotInfo().getPropC2().length()>0) {
// hql1+=" and i.itemKey.lotInfo.propC2='"+ptd.getNewLotInfo().getPropC2()+"'";
// }
if(ptd.getNewLotInfo().getPropC3()!=null&&!ptd.getNewLotInfo().getPropC3().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC3='"+ptd.getNewLotInfo().getPropC3()+"'";
}else {
if(ptd.getStrExtend2()!=null&&(ptd.getStrExtend2().equals("TRUE")||ptd.getStrExtend2().equals("true"))) {
hql1+=" and i.itemKey.lotInfo.propC3='K' ";
}
}
if(ptd.getNewLotInfo().getPropC4()!=null&&!ptd.getNewLotInfo().getPropC4().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC4='"+ptd.getNewLotInfo().getPropC4()+"'";
}
if(ptd.getNewLotInfo().getPropC4()!=null&&!ptd.getNewLotInfo().getPropC4().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC4='"+ptd.getNewLotInfo().getPropC4()+"'";
}
if(ptd.getNewLotInfo().getPropC5()!=null&&!ptd.getNewLotInfo().getPropC5().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC5='"+ptd.getNewLotInfo().getPropC5()+"'";
}
if(ptd.getNewLotInfo().getPropC6()!=null&&!ptd.getNewLotInfo().getPropC6().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC6='"+ptd.getNewLotInfo().getPropC6()+"'";
}
if(ptd.getNewLotInfo().getPropC7()!=null&&!ptd.getNewLotInfo().getPropC7().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC7='"+ptd.getNewLotInfo().getPropC7()+"'";
}
if(ptd.getNewLotInfo().getPropC8()!=null&&!ptd.getNewLotInfo().getPropC8().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC8='"+ptd.getNewLotInfo().getPropC8()+"'";
}
if(ptd.getNewLotInfo().getPropC9()!=null&&!ptd.getNewLotInfo().getPropC9().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC9='"+ptd.getNewLotInfo().getPropC9()+"'";
}
}else {
}
String hql2=" order by i.itemKey.lotInfo.propD2,i.itemKey.lotInfo.propC3,i.itemKey.lotInfo.propC1,i.statuss desc,i.storageDate,i.quantity";
//排序
String lcs = new String();
if(pt.getBillType()!=null&&pt.getBillType().getName().indexOf("工单")>=0
&&ptd.getStrBill12()!=null&&(!ptd.getStrBill12().equals("881")&&
!ptd.getStrBill12().equals("981"))) {
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=" CASE i.itemKey.lotInfo.propC2 ";
for(String sh:hqllist1) {
hqlmaveloc=hqlmaveloc+" WHEN '"+sh+"' THEN 1 ";
lcs=lcs+"'"+sh + "',";
}
hqlmaveloc=hqlmaveloc+" ELSE 99 " +
" END ASC " ;
lcs=lcs.substring(0, lcs.length()-1);
hql2=" order by i.itemKey.lotInfo.propD2,i.itemKey.lotInfo.propC3,i.itemKey.lotInfo.propC1,"+hqlmaveloc+",i.statuss desc,i.storageDate,i.quantity";
}
}
if(pt.getBillType()!=null&&pt.getBillType().getName().indexOf("其它")>=0) {
List<Configuration> cs=commonDao.findByQuery(" from Configuration c where c.configuration1='"+
ptd.getNewLotInfo().getPropC2()+"' or c.configuration2='"+ptd.getNewLotInfo().getPropC2()+"' " );
if(cs.size()>0) {
Configuration c=cs.get(0);
StringBuffer sb = new StringBuffer();
if(c.getConfiguration1().length()>0) {
sb.append("'"+c.getConfiguration1() + "', ");
sb.append("'"+c.getConfiguration2() + "' ");
hql1+=" and i.itemKey.lotInfo.propC2 in("+sb.toString()+")";
}
}else {
if(ptd.getNewLotInfo()!=null&&ptd.getNewLotInfo().getPropC2()!=null&&ptd.getNewLotInfo().getPropC2().length()>0) {
hql1+=" and i.itemKey.lotInfo.propC2='"+ptd.getNewLotInfo().getPropC2()+"'";
}
}
}else if(pt.getBillType()!=null&&pt.getBillType().getName().indexOf("工单")>=0) {
if(ptd.getNewLotInfo()!=null&&ptd.getNewLotInfo().getPropC2()!=null
&&!ptd.getNewLotInfo().getPropC2().equals("")) {
hql1+=" and i.itemKey.lotInfo.propC2='"+ptd.getNewLotInfo().getPropC2()+"'";
}else {
String bsql=" from BillTypeConfig b where b.billType.id="+pt.getBillType().getId();
if(ptd.getNewLotInfo().getPropC9()!=null&&!ptd.getNewLotInfo().getPropC9().equals("")) {
bsql+=" and b.plantCode='"+ptd.getNewLotInfo().getPropC9()+"'";
}
List<BillTypeConfig> bts=commonDao.findByQuery(bsql);
if(bts.size()>0) {
StringBuffer sb = new StringBuffer();
for(int y1=0;y1<=bts.size()-1;y1++){
BillTypeConfig bt=bts.get(y1);
if(y1<bts.size()-1){
sb.append("'"+bt.getCode() + "', ");
}else {
sb.append("'"+bt.getCode()+"' ");
}
}
if(lcs!=null&&lcs.length()>0) {
sb.append(","+lcs);
}
hql1+=" and i.itemKey.lotInfo.propC2 in("+sb.toString()+") ";
}else {
if(ptd.getNewLotInfo()!=null&&ptd.getNewLotInfo().getPropC2()!=null&&ptd.getNewLotInfo().getPropC2().length()>0) {
hql1+=" and i.itemKey.lotInfo.propC2='"+ptd.getNewLotInfo().getPropC2()+"'";
}
}
}
}else {
if(ptd.getNewLotInfo()!=null&&ptd.getNewLotInfo().getPropC2()!=null&&ptd.getNewLotInfo().getPropC2().length()>0) {
hql1+=" and i.itemKey.lotInfo.propC2='"+ptd.getNewLotInfo().getPropC2()+"'";
}
}
//指定序列号
// if(ptd.getApplyDoc()!=null&&!ptd.getApplyDoc().equals("")) {
// hql1+=" and i.barCode='"+ptd.getApplyDoc()+"'";
// }
//有限期
if(ptd.getItem().getIsBOM()) {
hql1+=" and CONVERT(varchar(100), i.itemKey.lotInfo.propD2, 23)>='"+DateUtil.formatDateYMDToStr(new Date())+"'";
}
//
List<Inventory> Inventorys = commonDao.findByQuery(
hql1+hql2,new String[] { "id" },new Object[] { ptd.getItem().getId() });
if (Inventorys.size() > 0) {
double allocatedQuantity = 0;
double unQty = ptd.getOrderQuantity()- ptd.getAllocatedQuantity();//未分配数量
double allocateQty=0;
for (Inventory inventory : Inventorys) {
int j = 0;
if (unQty == 0) {
break;
}
allocateQty = inventory.getQuantity()- inventory.getQueuedQuantity();//可分配数量
if (allocateQty == 0) {
continue;
}
//判断料号是不是整行库存发料
if(ptd.getItem().isBeWholeLine()&&unQty>allocateQty&&pt.getSourceType()!=null
&&(pt.getSourceType().equals("261")||pt.getSourceType().equals("Z65"))) {
//保存跳过记录
saveWorkOrderAllocationInfo(inventory, ptd, unQty, allocateQty);
continue;
}
if (unQty < allocateQty) {
allocateQty = unQty;
}
j++;
inventory.setQueuedQuantity(inventory.getQueuedQuantity()+ allocateQty);
inventory.setVersion(inventory.getVersion());
commonDao.store(inventory);
allocatedQuantity += allocateQty;
unQty -= allocateQty;
ptd.setAllocatedQuantity(ptd.getAllocatedQuantity()+ allocateQty);
commonDao.store(ptd);
pt.setAllocatedQuantity(pt.getAllocatedQuantity()+allocateQty);
pt.setStatus(PickTicketStatus.ALLOCATE);
commonDao.store(pt);
Task task = EntityFactory.getEntity(Task.class);
task.setPickTicketDetail(ptd);
Item item=commonDao.load(Item.class, ptd.getItem().getId());
task.setBillCode(getSubWorkOrer(ptd.getPickTicket().getCode(),inventory.getLocation().getZone(),item));
//单个子任务数量
if(qty>0) {
List<Integer> tas=commonDao.findByQuery("select t.hs from PickTicketTaskView t where t.pickTicket.id="+ptd.getPickTicket().getId()
+" and t.billcode='"+task.getBillCode()+"' ");
if(tas.size()>0) {
//单个子任务数量
if(tas.get(0)>=qty) {
task.setBillCode(bussinessCodeManager.getCodeForYmd(ptd.getPickTicket().getCode()+"-", 2));
}
}
}
task.setCode(TimeNumberUtils.getTaskCode());
task.setType(TaskType.MV_PICKTICKET);
task.setItemKey(inventory.getItemKey());
task.setStorageDate(inventory.getStorageDate());
task.setSrcLoc(inventory.getLocation());
task.setSOI(inventory.getSOI());
task.setPlanQuantity(allocateQty);
task.setPlanQuantityMU(allocateQty);
task.setInventoryStatus(inventory.getStatus());
task.setCreateTime(new Date());
task.setWarehouseArea(inventory.getWarehouseArea());
task.setBarCode(inventory.getBarCode());
task.setStrBill10(inventory.getStatuss());
task.setSrcLP(inventory.getLocation().getStock());
if(UserHolder.getUser()!=null) {
task.setOperator(UserHolder.getUser().getName());
task.setStrBill3(UserHolder.getUser().getName());
}
task.setItemCode(item.getCode());
task.setWaveDoc(waveDoc);
commonDao.store(task);
tasks.add(task);
}
if(unQty>0) {
msg=msg+ptd.getItem().getCode()+",库存不足! ";
}
//修改为下发的回传状态
// List<Long> pdids=new ArrayList<Long>();
// pdids.add(ptd.getId());
// interfaceReqManager.wmsSapZhuantaihuichuang(pdids, 0,"",1);//状态回传
}else {
msg=msg+ptd.getItem().getCode()+",无匹配库存! ";
}
}else{
throw new BusinessException("任务状态错误!");
}
}
return tasks;
}
@Override
public String preAllocateDate(Date beginDate, Date endDate) {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//日期格式

View File

@ -1195,9 +1195,9 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
// }
for (ReceivedRecord record : asn.getReceivedRecords()) {
logger.info(record.getId());
// 直接收货上架的记录不再加入上架计划明细A
if (!LocationType.RECEIVE.equals(record.getLocation().getType())||
record.getWarehouseArea().getId()==1766) {
// 直接收货上架的记录不再加入上架计划明细Arecord.getWarehouseArea().getId()==1766
if (!LocationType.RECEIVE.equals(record.getLocation().getType())
) {
continue;
}
double qty = record.getReceivedQuantity() ;
@ -4036,7 +4036,6 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
List<ReceivedRecord> receivedRecords=commonDao.findByQuery(" from ReceivedRecord "
+ "receivedrecord where receivedrecord.beMoved=0 and receivedrecord.srcLP.LP='"+stock.getLP()+"' ");//根据这个容器号获取这个容器号的所有数据
logger.info("-----------ReceivedRecord-0002"+ids);
if(receivedRecords.size()>0) {
ReceivedRecord rd=receivedRecords.get(0);
if(!rd.getWarehouseArea().getName().equals(z.getName())) {
@ -4047,7 +4046,6 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
}
ReceivedRecord r=commonDao.load(ReceivedRecord.class, id);//根据id或者该行数据
// ItemKey itemKey=r.getItemKey();
logger.info("-----------ReceivedRecord-0003"+ids);
if(z.getId()==1763) {
if(locationId==null||locationId==0) {
throw new BusinessException("料箱区,库位不能为空");
@ -4058,7 +4056,6 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
}
//查询库存
Inventory srcInv =null;
logger.info("-----------ReceivedRecord-0004"+ids);
List<Inventory> Inventorys=commonDao.findByQuery(" from Inventory inv where inv.receivedRecordId="+r.getId()+" ");
if(Inventorys.size()>0){
srcInv=Inventorys.get(0);
@ -4084,23 +4081,21 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
r.setSrcLPCode(stock.getLP());
}
r.setWarehouseArea(z);
logger.info("-----------ReceivedRecord-0005"+ids);
List<MoveDocDetail> MoveDocDetails=commonDao.findByQuery(" from MoveDocDetail mdd where mdd.receivedRecordId="+r.getId()+" ");
if(MoveDocDetails.size()>0){
MoveDocDetail mdd=MoveDocDetails.get(0);
if(z.getId()==1766) {
commonDao.delete(mdd);
}else {
// if(z.getId()==1766) {
// commonDao.delete(mdd);
// }else {
if(stock!=null) {
mdd.setSrcLP(stock);
mdd.setSrcLPCode(stock.getLP());
}
mdd.setWarehouseArea(z);
commonDao.store(mdd);
}
// }
}
commonDao.store(r);
logger.info("-----------ReceivedRecord-0006"+ids);
}else{
ReceivedRecord r=commonDao.load(ReceivedRecord.class, id);//根据id或者该行数据
List<ReceivedRecord> ReceivedRecords=commonDao.findByQuery(" from ReceivedRecord "
@ -4117,16 +4112,16 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
List<MoveDocDetail> MoveDocDetails=commonDao.findByQuery(" from MoveDocDetail mdd where mdd.receivedRecordId="+r.getId()+" ");
if(MoveDocDetails.size()>0){
MoveDocDetail mdd=MoveDocDetails.get(0);
if(z.getId()==1766) {
commonDao.delete(mdd);
}else {
// if(z.getId()==1766) {
// commonDao.delete(mdd);
// }else {
if(stock!=null) {
mdd.setSrcLP(stock);
mdd.setSrcLPCode(stock.getLP());
}
mdd.setWarehouseArea(z);
commonDao.store(mdd);
}
// }
}
}
//查询库存
@ -4148,22 +4143,22 @@ public void addASNDetail(Long id,ASNDetail asnDetail) {
List<MoveDocDetail> MoveDocDetails=commonDao.findByQuery(" from MoveDocDetail mdd where mdd.receivedRecordId="+r.getId()+" ");
if(MoveDocDetails.size()>0){
MoveDocDetail mdd=MoveDocDetails.get(0);
if(z.getId()==1766) {
commonDao.delete(mdd);
}else {
// if(z.getId()==1766) {
// commonDao.delete(mdd);
// }else {
if(stock!=null) {
mdd.setSrcLP(stock);
mdd.setSrcLPCode(stock.getLP());
}
mdd.setWarehouseArea(z);
commonDao.store(mdd);
}
// }
}
commonDao.store(r);
}else{
throw new BusinessException("料箱内由已上架物料,不能转换");
}
logger.info("-----------ReceivedRecord-0008"+ids);
// logger.info("-----------ReceivedRecord-0008"+ids);
}
}
}

View File

@ -551,7 +551,7 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
if (locationCode.substring(0, 1).equals("-")) {
locationCode = locationCode.substring(1, locationCode.length());
}
List<Location> ls = this.commonDao.findByQuery("from Location l where upper(l.code)='" + locationCode
List<Location> ls = this.commonDao.findByQuery("from Location l where (l.code)='" + locationCode
+ "'");
if (ls.size() > 0) {
this.addMoveLPDetail(moveDocId, inventoryId, ls.get(0).getId(), null, Double.parseDouble(qty), null);
@ -1669,7 +1669,7 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
if (locationCode.substring(0, 1).equals("-")) {
locationCode = locationCode.substring(1, locationCode.length());
}
List<Location> ls = this.commonDao.findByQuery("from Location l where upper(l.code)='" + locationCode
List<Location> ls = this.commonDao.findByQuery("from Location l where (l.code)='" + locationCode
+ "'");
if (ls.size() > 0) {
d.setDstLoc(ls.get(0));
@ -1723,7 +1723,7 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
// 通过线边或设备找到目标区域
StorageArea sa = null;
List<StorageArea> StorageAreas = commonDao.findByQuery(
" from StorageArea sa where upper(sa.code)=upper(:code) ",
" from StorageArea sa where (sa.code)=(:code) ",
new String[] { "code" }, new Object[] { mdd.getNewLotInfo().getPropLC1() });
if (StorageAreas.size() > 0) {
sa = StorageAreas.get(0);
@ -1738,7 +1738,7 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
String endAddress = conventNullStr(obj.get("endAddress"));// 目标点位
// 根据任务号找到对应记录并存入目标点位信息
List<Task> Taskss = commonDao.findByQuery(
" from Task t where upper(t.code)=upper(:code)", new String[] { "code" },
" from Task t where (t.code)=(:code)", new String[] { "code" },
new Object[] { robotJobId.trim() });
if (Taskss.size() > 0) {
Task task = Taskss.get(0);
@ -1775,7 +1775,7 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
// 查询目标点位
LocationStorage ls = null;
List<LocationStorage> LocationStorages = commonDao.findByQuery(
" from LocationStorage ls where upper(ls.code)=upper(:code) ", new String[] { "code" },
" from LocationStorage ls where (ls.code)=(:code) ", new String[] { "code" },
new Object[] { t.getEndRegion() });
if (LocationStorages.size() > 0) {
ls = LocationStorages.get(0);
@ -2208,6 +2208,8 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
if (receivedRecords.size()>0) {
String mdids="";
Location mdloc=null;//上架库位;
for (ReceivedRecord rd : receivedRecords) {
if(rd.getWarehouseArea()!=null&&
rd.getWarehouseArea().getId()!=1766L) {
@ -2247,9 +2249,11 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
Inventory srcInv = invs.get(0);
ItemKey ik=commonDao.load(ItemKey.class, srcInv.getItemKey().getId());
List<Location> locs= commonDao.findByQuery(" from Location l where l.stock.id="+stock.getId()+"");
if (srcInv.getStatus().equals("待上架") || srcInv.getStatus().equals("质检中")) {
if(locs.size()>0) {
Location locst=locs.get(0);
mdloc=locst;
String inghql=" from Inventory inv where inv.itemKey.item.id="+ik.getItem().getId()+
" and inv.location.id="+ locst.getId()+
" and inv.id not in("+srcInv.getId()+") and inv.status='已入库' ";
@ -2313,13 +2317,12 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
commonDao.store(locst);
}
}
}
inventoryManager.addInventoryLog(InventoryLogType.RECEIVING, 1, ad.getAsn().getRelatedBill1(),
rd.getLocation(), (rd.getSrcLP() == null ? null : rd.getSrcLP().getLP()), rd.getItemKey(),
srcInv.getLocation(), (rd.getSrcLP() == null ? null : rd.getSrcLP().getLP()), rd.getItemKey(),
rd.getReceiveDate(), null, rd.getReceivedQuantity(), null,
srcInv == null ? "" : srcInv.getStatus(), srcInv == null ? 0L : srcInv.getId(), null,
asn.getBillType(), 0, rd.getBarCode(), null,asn.getSourceType());
asn.getBillType(), 0, rd.getBarCode(), rd.getLocation(),asn.getSourceType());
//上报SAP
if(!asn.getCode().substring(0, 2).equals("RP")
&&(asn.getSourceType()!=null&&!asn.getSourceType().equals("313"))
@ -2331,7 +2334,6 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
if(rd!=null&&rd.getFinishDate()==null) {
List<Long> ids=new ArrayList<Long>();
ids.add(rd.getId());
// returnoutReceivedRecord(ids);
interfaceReqManager.returnoutReceivedRecord(ids);// 提交SAP
}
}
@ -2345,6 +2347,22 @@ public class DefaultMoveDocManager extends DefaultBaseManager implements MoveDoc
logger.info(st.getLP()+"有上架信息");
rd.setBeMoved(Boolean.TRUE);
this.commonDao.store(rd);
mdids=mdids+rd.getId()+",";
}
if(mdids.length()>1) {
mdids=mdids.substring(0,mdids.length()-1);
String hql2=" from MoveDocDetail md where md.receivedRecordId in("+mdids+") ";
List<MoveDocDetail> list= commonDao.findByQuery(hql2);
for(MoveDocDetail md:list) {
MoveDoc m=commonDao.load(MoveDoc.class, md.getMoveDoc().getId());
md.setMoveQuantity(md.getPlanQuantity());
md.setDstLoc(mdloc);
m.setMoveQuantity(m.getMoveQuantity()+md.getMoveQuantity());
m.setAccomplish(m.getAccomplish()+1);
commonDao.store(md);
commonDao.store(m);
}
}
}else {

View File

@ -25,6 +25,7 @@ import com.dev.swms.server.model.shipping.MasterBOL;
import com.dev.swms.server.model.shipping.PickTicket;
import com.dev.swms.server.model.shipping.PickTicketDetail;
import com.dev.swms.server.model.shipping.Prewave;
import com.dev.swms.server.model.shipping.WaveDoc;
import com.dev.energy.server.dao.CommonDao;
import com.dev.energy.server.service.BaseManager;
@ -766,8 +767,16 @@ public interface PickTicketManager extends BaseManager {
//添加任务到波次
@Transactional
List<Long> addTaskToWaveDocDetail( List<Long> ids,Date date1,Date date2 ,Integer longtiem,Integer lxqQty,
List<Long> addTaskToWaveDocDetail( List<Long> ids,Date date1,Date date2 ,Integer longtiem,Integer lxqQty,Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode,Integer taskqty,Integer logic);
@Transactional
WaveDoc addWaveDocDetail(Date date1,Date date2 ,Integer longtiem,Integer lxqQty,
Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode,Integer taskqty,Integer logic);
@Transactional
void updateWaveDocDetail(WaveDoc waveDoc,List<Task> allTasks);
//PDA领取合单任务
@Transactional
void receiveBillTask(String taskids, Long workerId);

View File

@ -336,8 +336,21 @@ public interface WaveDocManager extends BaseManager {
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);
void newHotWaveDoc(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);
@Transactional
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);
//波次下发
@Transactional
void alloteWaveDoc(long waveDocId,boolean lx1,boolean lx2,boolean lx3,boolean lx4,boolean lx5,boolean lx6,boolean lx7,boolean lx8,boolean lx9,boolean lx10,boolean lx11,boolean lx12,boolean lx13,boolean lx14,boolean lx15,boolean hj1,boolean hj2,boolean hj3,boolean hj4,boolean hj5,boolean hj6,boolean hj7,boolean lk1,boolean lk2,boolean lk3,boolean lk4,boolean lk5);
}

View File

@ -3848,7 +3848,7 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
// 判断物料是否存在
Item item = null;
List<Item> items = this.commonDao
.findByQuery(" from Item it where upper(it.code)=upper('" + sku + "') ");
.findByQuery(" from Item it where (it.code)=('" + sku + "') ");
if (items.size() <= 0) {
JSONObject objectItem = new JSONObject();
objectItem.put("sku", sku);
@ -3885,7 +3885,7 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
Double orderQty = detail.has("orderQty") ? detail.getDouble("orderQty") : 0;// 出库数量
double qty = 0;
List<Item> items = this.commonDao
.findByQuery(" from Item it where upper(it.code)=upper('" + sku + "') ");
.findByQuery(" from Item it where (it.code)=('" + sku + "') ");
Item item = items.get(0);
List<InterfaceWmsOut> InterfaceWmsOuts = commonDao.findByQuery(
" from InterfaceWmsOut iwo where iwo.orderNo=:orderNo and iwo.sku=:sku ",
@ -3927,7 +3927,7 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
Item item = null;
List<Item> items = this.commonDao
.findByQuery(" from Item it where upper(it.code)=upper('" + sku + "') ");
.findByQuery(" from Item it where (it.code)=('" + sku + "') ");
if (items.size() > 0) {
item = items.get(0);
item.setMinimumStock(item.getMinimumStock() - orderQty);
@ -3943,7 +3943,7 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
pt = EntityFactory.getEntity(PickTicket.class);// 出库单
pt.setCode(orderNo);
List<BillType> billType = this.commonDao
.findByQuery(" from BillType it where upper(it.code)=upper('" + orderType
.findByQuery(" from BillType it where (it.code)=('" + orderType
+ "') and it.type='SHIP' ");
pt.setBillType(billType.get(0));
pt.setPriority(priority);
@ -3961,7 +3961,7 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
pt.setStatus(PickTicketStatus.OPEN);// 状态
Structure structure = null;
List<Structure> structures = this.commonDao
.findByQuery("from Structure it where upper(it.code)=upper('" + customerId + "') ");
.findByQuery("from Structure it where (it.code)=('" + customerId + "') ");
if (structures.size() > 0) {
structure = structures.get(0);
} else {
@ -8673,6 +8673,50 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
return pdids;
}
public WaveDoc addWaveDocDetail( Date date1,Date date2 ,Integer longtiem,Integer lxqQty,
Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode,Integer taskqty,Integer logic) {
WaveDoc waveDoc=EntityFactory.getEntity(WaveDoc.class);
waveDoc.setCode(TimeNumberUtils.getwaveDocCode());
waveDoc.setWarehouse(WarehouseHolder.getWarehouse());
waveDoc.setStatus(WaveDocStatus.OPEN);
waveDoc.setCreateDate(new Date());
waveDoc.setQuantity(waveDoc.getQuantity());
waveDoc.setUserName(UserHolder.getUser().getName());
waveDoc.setUpdateTime(new Date());
waveDoc.setBePopular(ddq);
waveDoc.setLkqQty(lkqQty);
waveDoc.setLxqQty(lxqQty);
waveDoc.setHjqQty(hjqQty);
waveDoc.setLongtiem(longtiem);
waveDoc.setApplyDoc(pickCode);
waveDoc.setLogic(logic);
waveDoc.setStartDate(date1);
waveDoc.setEndDate(date2);
waveDoc.setPrintCount(taskqty);//拆分行数
commonDao.store(waveDoc);
wmsOperationHisManager.storeOperationHis(waveDoc.getId(), waveDoc.getCode(), null, "", "波次", "创建波次", null, null, 0,
0, 0, 0, "", "WMS");
return waveDoc;
}
public void updateWaveDocDetail(WaveDoc waveDoc,List<Task> allTasks) {
int orderqty=0;
List<Long> list=new ArrayList<Long>();
for( Task t:allTasks) {
if(!list.contains(t.getPickTicketDetail().getPickTicket().getId())) {
list.add(t.getPickTicketDetail().getPickTicket().getId());
}
}
orderqty=list.size();
waveDoc.setQuantity(orderqty);
commonDao.store(waveDoc);
wmsOperationHisManager.storeOperationHis(waveDoc.getId(), waveDoc.getCode(), null, "", "波次", "波次完成", null, null, 0,
0, 0, 0, "", "WMS");
}
public long getQuantityMap(Map map) {
Long id=(Long) map.get("waveDoc.id");
long quantity=0;
@ -10405,8 +10449,11 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements Pick
throw new BusinessException(code+"合单码输入错误");
}
}
List<Stock> list1 =commonDao.findByQuery(" from Stock c where c.containerType.code='505' "
+ "and c.LP>='50500001' and c.enabled=false order by c.locationIndex,c.LP,c.id");
List<Stock> list1 =commonDao.findByQuery(" from Stock c "
+ " where c.containerType.code='505' "
+ " and c.enabled=false and c.LP>='50500001' "
+ "order by c.locationIndex,c.LP,c.id " +
" ");
if(list1.size()>0) {
for(int i=0;i<list1.size();i++) {
Stock stock=list1.get(i);

View File

@ -2712,6 +2712,243 @@ public class DefaultWaveDocManager extends DefaultBaseManager implements
}
public void newHotWaveDoc(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) {
Date date=new Date();
// 1000*60*20,小于20分钟。
if(!hotWave&&date.getTime()-hotWaveDate.getTime()<1200000) {
throw new BusinessException("其他人正在创建波次,请稍后");
}
hotWave=false;
//生成波次单
WaveDoc waveDoc=pickTicketManager.addWaveDocDetail(date1, date2, longtiem, lxqQty, hjqQty, lkqQty, ddq9, pickCode, taskQty,0);
List<Long> PickTicketDetailIds=null;
List<Long> taskids=new ArrayList<Long>();
List<Task> allTasks=new ArrayList<Task>();//全部拣货任务
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);
}
if(beUrgent) {
//加急单
allTasks.addAll(beUrgentTaksTwo(date1, date2, longtiem, lxqQty, hjqQty, lkqQty, ddq, pickCode, ddq1, ddq2, ddq3, ddq4, ddq5,
ddq6, ddq7, ddq8, ddq9, taskQty, beUrgent,hqlmave,waveDoc));
}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)<='"+DateUtil.formatDateYMDToStr(date2)+"' ";
}else{
sql2+= " and CONVERT(varchar(100),ptd.pickTicket.orderDate, 23)>='"+DateUtil.formatDateYMDToStr(date1)+"' ";
sql2+= " and CONVERT(varchar(100),ptd.pickTicket.orderDate, 23)<='"+DateUtil.formatDateYMDToStr(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);
allTasks.addAll(autoAllocator.allocatePickticketDetail(pids,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6,
ddq7, ddq8, ddq9,hqlmave,waveDoc));//明细分配
// 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);
allTasks.addAll(autoAllocator.allocatePickticketDetail(pids,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5,
ddq6, ddq7, ddq8, ddq9,hqlmave,waveDoc));//明细分配
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) {
allTasks.addAll(autoAllocator.allocatePickticketDetail(picklists,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6,
ddq7, ddq8, ddq9,hqlmave,waveDoc));//明细分配
}
}
}
}
}else {
allTasks.addAll(autoAllocator.allocatePickticketDetail(PickTicketDetailIds,jyq,ddq, ddq1, ddq2, ddq3, ddq4, ddq5, ddq6,
ddq7, ddq8, ddq9,hqlmave,waveDoc));//明细分配
}
}
}
if(allTasks.size()>0) {
logger.info("allTasks---"+allTasks.size()+"------"+new Date());
pickTicketManager.updateWaveDocDetail(waveDoc, allTasks);
}
hotWave=true;
hotWaveDate=DateUtil.formatStrToDateYMD("2023-02-02");
}
public List<Long> beUrgentTaks(Date date1,Date date2 ,Integer longtiem,Integer lxqQty,Integer hjqQty,Integer lkqQty,boolean ddq,String pickCode
@ -2816,7 +3053,112 @@ public class DefaultWaveDocManager extends DefaultBaseManager implements
return taskids;
}
public List<Task> beUrgentTaksTwo(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,WaveDoc waveDoc) {
List<Task> taskslist=new ArrayList<Task>();
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("+noLoc+") "
+ " 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);
taskslist.addAll(autoAllocator.allocatePickticketDetail(pids,taskQty,ddq, ddq1, ddq2, ddq3, ddq4, ddq5,
ddq6, ddq7, ddq8, ddq9,noLoc,waveDoc));//明细分配
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) {
taskslist.addAll(autoAllocator.allocatePickticketDetail(picklists,taskQty,ddq, ddq1, ddq2, ddq3,
ddq4, ddq5, ddq6, ddq7, ddq8, ddq9,noLoc,waveDoc));//明细分配
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 taskslist;
}
@Override

View File

@ -101,7 +101,8 @@ public class ASNReceiveServlet extends HttpServlet {
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
logger.info("==========ASNReceiveServlet========"+new Date());
Date openDate=new Date();
logger.info("==========ASNReceiveServlet========"+openDate);
CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
request.setCharacterEncoding("utf-8");
@ -841,8 +842,9 @@ public class ASNReceiveServlet extends HttpServlet {
String accountType= json.has("accountType")?json.getString("accountType"):"";
resultJson=exitLoginPC(mac, accountType, commonDao);
}
logger.info("======"+resultJson.toString());
Date endDate=new Date();
Long dsa=endDate.getTime()-openDate.getTime();
logger.info("======"+resultJson.toString()+"---结束时间:"+dsa);
PrintWriter out = null;
try {
response.setCharacterEncoding("UTF-8");
@ -1013,7 +1015,7 @@ public class ASNReceiveServlet extends HttpServlet {
}
}
}
logger.info(asnDetailId+"--整理+"+new Date());
// logger.info(asnDetailId+"--整理+"+new Date());
/** 2025-05-06
if(stock!=null) {
// List<String> p2s=commonDao.findByQuery("select ad.lotInfo.propC2 from ASNDetail ad "
@ -1131,7 +1133,7 @@ public class ASNReceiveServlet extends HttpServlet {
}
}else{
logger.info(asnDetailId+"--整理1--+"+new Date());
// logger.info(asnDetailId+"--整理1--+"+new Date());
Worker w= commonDao.load(Worker.class, userId);
List<String> result = Arrays.asList(asnDetailId.split(","));
double quantity=0;
@ -1196,7 +1198,7 @@ public class ASNReceiveServlet extends HttpServlet {
if(z_id==1766) {
List<Location> locs=commonDao.findByQuery(" from Location l where l.stock.id="+stock.getId()+" and l.code='"+stock.getLP()+"'");
if(locs.size()>0) {
locId=locs.get(0).getId();
//立库需要生成上架任务locId=locs.get(0).getId();
}else {
status = "2";
msg = "堆垛库,扫描的容器错误!";
@ -1287,7 +1289,7 @@ public class ASNReceiveServlet extends HttpServlet {
asnManager.receiveGoods(asnds, receiveDate, userId, locId, z_id, qty, s_id,pqty, mac,stock==null?"":stock.getLP(), agv);
msg="收货成功";
status="1";
logger.info(asnDetailId+"--整理1--2+"+new Date());
// logger.info(asnDetailId+"--整理1--2+"+new Date());
}catch(Exception e) {
msg=e.toString();
status="0";

View File

@ -91,7 +91,8 @@ public class PickingServlet extends HttpServlet {
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
logger.info("==========app出库========"+new Date());
Date opendate=new Date();
logger.info("==========app出库========"+opendate);
CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
request.setCharacterEncoding("UTF-8");
BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));//post方式传递读取字符流
@ -243,8 +244,9 @@ public class PickingServlet extends HttpServlet {
resultJson=this.printLocationCode(location_code,workerId, wId);
}
}
logger.info("======"+resultJson.toString());
Date endDate=new Date();
Long dsa=endDate.getTime()-opendate.getTime();
logger.info("===picking==="+resultJson.toString()+"结束时间: "+dsa);
PrintWriter out = null;
try {
response.setCharacterEncoding("UTF-8");

View File

@ -219,7 +219,7 @@ public class PlanCountServlet extends HttpServlet {
logger.info("======"+resultJson.toString());
PrintWriter out = null;
try {
response.setContentType(resultJson.toString());
// response.setContentType(resultJson.toString());
response.setCharacterEncoding("UTF-8");
out = response.getWriter();
out.print(resultJson.toString());

View File

@ -45,8 +45,8 @@ public class ShelfDetails extends HttpServlet{
String postResult = reqMailbox(request);
String result="";
if(postResult!=null&&!"".equals(postResult)){
InterfaceManager app = (InterfaceManager) ac.getBean("interfaceManager");
result=app.inquiryShelf(postResult.toString());
// InterfaceManager app = (InterfaceManager) ac.getBean("interfaceManager");
// result=app.inquiryShelf(postResult.toString());
}else{
resultObject.put("returnCode", -1);
resultObject.put("returnMsg","空的传值");

View File

@ -152,3 +152,9 @@ UPDATE SIGN_FILE
SET viewfileUrl = REPLACE(viewfileUrl, 'http://192.168.2.88:8080', '*.asnImageServlet?imageSourcePath=C:/tomcat-8080/webapps')
WHERE viewfileUrl is not null;
---------2025-06-12
ALTER TABLE PICK_TICKET_DETAIL
ALTER COLUMN PROP_C8 VARCHAR(400);
---//sql server
SELECT @@VERSION;

View File

@ -41,7 +41,7 @@
location.id,
location.code, location.name
FROM Location location
WHERE upper(location.code) LIKE upper(:param)
WHERE (location.code) LIKE (:param)
AND location.disabled = false
AND location.warehouse = #{SESSION_WAREHOUSE}]]></hql>
</remote> -->
@ -77,7 +77,8 @@
forceOverride="false" manualEditable="true">
<hql><![CDATA[ select warehouseArea.id,
warehouseArea.name
from WarehouseArea warehouseArea where 1=1 and warehouseArea.disabled=false order by warehouseArea.name]]></hql>
from WarehouseArea warehouseArea where 1=1 and warehouseArea.disabled=false
order by warehouseArea.name]]></hql>
</list>
<dateRanger id="occurTime" title="发生时间" row="5" col="1" span="2" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="true" fromDate="beginDate" toDate="endDate"/>
<!-- <date id="inventoryLog.occurTime" title="发生时间" row="4" span="1" readOnly="false" required="false" reserve="true" forceOverride="false" inVisible="true" showTime="false" manualEditable="false" defaultCurrentDate="true"/> -->
@ -128,7 +129,7 @@
/~billType.name: AND inventoryLog.billType.name = {billType.name}~/
/~relatedBill: AND inventoryLog.relatedBill LIKE {relatedBill}~/
/~soi: AND inventoryLog.SOI LIKE {soi}~/
/~inventoryLog.itemKey.item.code: AND upper(inventoryLog.itemKey.item.code) LIKE upper({inventoryLog.itemKey.item.code})~/
/~inventoryLog.itemKey.item.code: AND (inventoryLog.itemKey.item.code) LIKE ({inventoryLog.itemKey.item.code})~/
/~LOC: AND inventoryLog.itemKey.lotInfo.propC2 LIKE {LOC}~/
/~operator: AND inventoryLog.operator LIKE {operator}~/
and (1=1

View File

@ -58,7 +58,7 @@
/~inventory.propC5: AND inventory.itemKey.lotInfo.propC5 = {inventory.propC5}~/
/~inventory.propC9: AND inventory.itemKey.lotInfo.propC9 = {inventory.propC9}~/
/~inventory.statuss: AND inventory.statuss = {inventory.statuss}~/
ORDER BY inventory.location.id ]]></datasource>
ORDER BY inventory.id ]]></datasource>
<columns>
<column id="inventory.id" title="ID" visible="false" />

View File

@ -66,6 +66,7 @@
row="12" col="1" readOnly="false" required="false" reserve="true"
forceOverride="false" inVisible="false" trimSpace="true"
isPrecision="true" showTime="false" defaultCurrentDate="false" />
</inputUIs>
<buttons>
<commit id="save" title="save" enableType="none" invisible="false">

View File

@ -115,7 +115,7 @@
or ( /~ordersAll: {ordersAll} = true~/ ))
/~agv.type: AND (agv.type) like ({agv.type}) ~/
/~agv.errorMsg: AND agv.errorMessage like ({agv.errorMsg}) ~/
/~agv.code: AND agv.code like upper({agv.code}) ~/
/~agv.code: AND agv.code like {agv.code} ~/
/~agv.robotJobId: and agv.robotJobId like ({agv.robotJobId}) ~/
/~agv.status: and agv.status = {agv.status} ~/
/~agv.targetArea: and CHARINDEX({agv.targetArea}, agv.targetArea) > 0 ~/

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<editPage id="editImportOtherOrderDetailPag" title="editImportOtherOrderDetailPag"
entityClass="com.dev.swms.server.model.shipping.PickTicket" width="270" height="130"
onClose="refreshParent">
<inputUIs>
<hidden id="pt.id" reserve="false" />
<file id="imageFile" title="importFile" row="1" col="2"
readOnly="false" required="false" reserve="false" forceOverride="true"
inVisible="false" showImage="false" storeDir="IMAGE_FILE_DIR" />
</inputUIs>
<buttons>
<commit id="import" title="import" enableType="single"
invisible="false">
<mappings>
<mapping id="imageFile" className="file" />
</mappings>
<actions>
<action managerName="importFileManager" methodName="importOtherOrderDetail"
parameter="imageFile" />
</actions>
<forwards>
<!-- <forward name="refreshParent" newEnabled="true" editEnabled="true"/> -->
<!-- <forward name="closeWindow" newEnabled="true" editEnabled="true"/> -->
<!-- <forward name="refreshWindow" newEnabled="true" editEnabled="true"/> -->
</forwards>
</commit>
</buttons>
</editPage>
</pages>

View File

@ -57,6 +57,39 @@
editEnabled="true" />
</forwards>
</commit>
<commit id="save0291231" title="创建2"
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="waveDocManager" methodName="newHotWaveDoc"
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

@ -340,7 +340,8 @@
</popup>
<popup id="SHASO2" title="导入转库单"
enableType="none" invisible="false" containId="true" pageId="editImportOutOrderPage" />
<popup id="SHAS21123O2" title="导入其它出库单"
enableType="none" invisible="false" containId="true" pageId="editImportOtherOrderDetailPag" />
</buttons>
</maintainPage>
</pages>

View File

@ -26,7 +26,7 @@
displayColumn="2" displayedTableHead="序号,库位编码,库位名称">
<hql><![CDATA[ select location.id, location.code, location.name
from Location location
where upper(location.code) like upper(:param)
where (location.code) like (:param)
and location.warehouse = #{SESSION_WAREHOUSE}
and location.type <> 'COUNT' and location.disabled=false
]]></hql>
@ -128,7 +128,9 @@
enumerate.enumValue FROM Enumerate enumerate
WHERE enumerate.enumType = 'STATUS' and enumerate.enumValue not in('CANCEL')]]></hql>
</list>
<checkbox id="ordersAll" title="ordersAll" row="17" col="2" defaultValue="false" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false"/>
<!-- <checkbox id="ordersAll" title="ordersAll" row="17" col="2" defaultValue="false" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false"/> -->
<booleanList id="ordersAll" title="ordersAll" row="17" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false"/>
<text id="t.code" title="wms任务号" row="17" col="3" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" trimSpace="false" />
<text id="pickTicket.logisticsCompany" title="工作中心" row="18" col="1"
readOnly="false" required="false" reserve="false" forceOverride="false"
@ -136,6 +138,19 @@
<text id="pickTicketDetail.strBill12" title="机台号" row="18" col="2"
readOnly="false" required="false" reserve="false" forceOverride="false"
inVisible="false" trimSpace="false" />
<remote id="pickTicketDetail.item.id" title="精确料号"
row="18" col="3" readOnly="false" required="false" reserve="false"
forceOverride="false" inVisible="false" manualEditable="true"
headerNumber="4" displayColumn="2" displayedTableHead="序号,编码">
<hql><![CDATA[SELECT
lc.id,
lc.code
FROM Item lc
WHERE 1=1
and lc.code like :param )
AND lc.disabled = false
]]></hql>
</remote>
</inputUIs>
</search>
<datasource type="hql"><![CDATA[ select
@ -243,10 +258,10 @@
left join t.agvTask agv
left join t.dstLP dstLP
where 1=1 and t.type ='MV_PICKTICKET' and t.planQuantity>0
and ( (t.inventoryStatus not in ('交单完成')) /~ordersAll: or true={ordersAll} ~/)
and ( (zone.id not in (1787) or zone.name is null) /~ordersAll: or true={ordersAll} ~/)
and ( (t.inventoryStatus not in ('交单完成')) /~ordersAll: or 1=1 ~/)
and ( (zone.id <> 1787 or zone.name is null) /~ordersAll: or 1=1 ~/)
and ( ((pickTicket.sourceType <>'411' and t.planQuantity<=t.movedQuantityMU) or
( t.planQuantity>t.movedQuantityMU) ) /~ordersAll: or true={ordersAll} ~/)
( t.planQuantity>t.movedQuantityMU) ) /~ordersAll: or 1=1 ~/)
/~t.worker4.name: AND (t.worker4.id) = {t.worker4.name}~/
and (1=1
/~beginDate: AND CONVERT(varchar(100), pickTicket.orderDate, 23) = {beginDate} ~/
@ -267,6 +282,7 @@
/~t.code: AND (t.code) LIKE ({t.code})~/
/~pickTicket.equatedQuantity: AND (({pickTicket.equatedQuantity}=true and pickTicket.equatedQuantity>'A' ) or ({pickTicket.equatedQuantity}=false and pickTicket.equatedQuantity<'A' )) ~/
/~billType.name: AND billType.id = {billType.name}~/
/~pickTicketDetail.item.id: AND t.pickTicketDetail.item.id = {pickTicketDetail.item.id}~/
/~dLzone.name: AND dLzone.name = {dLzone.name}~/
/~pickTicketDetail.strBill12: AND (pickTicketDetail.strBill12) LIKE ({pickTicketDetail.strBill12})~/
/~agv.status: AND agv.status ={agv.status} ~/
@ -274,15 +290,15 @@
/~billCode: AND (t.billCode) LIKE ({billCode})~/
/~t.strBill1: AND t.strBill1 LIKE {t.strBill1}~/
/~warehouseArea.id: AND szone.id = {warehouseArea.id}~/
/~locCode: AND upper(location.code) LIKE upper({locCode})~/
/~pickTicket.code: AND upper(pickTicket.code) LIKE upper({pickTicket.code})~/
/~pickTicket.sourceType: AND upper(pickTicket.sourceType) LIKE upper({pickTicket.sourceType})~/
/~locCode: AND (location.code) LIKE ({locCode})~/
/~pickTicket.code: AND (pickTicket.code) LIKE ({pickTicket.code})~/
/~pickTicket.sourceType: AND (pickTicket.sourceType) LIKE ({pickTicket.sourceType})~/
/~warehouseArea: AND warehouseArea.name = {warehouseArea}~/
/~locCode: AND upper(location.code) LIKE upper({locCode})~/
/~itemCode: AND upper(item.code) LIKE upper({itemCode})~/
/~waveDoc.code: AND upper(waveDoc.code) LIKE upper({waveDoc.code})~/
/~dstLP.remark: AND upper(dstLP.remark) LIKE upper({dstLP.remark})~/
order by t.createTime desc,pickTicket.code,t.billCode,szone.name,t.id,pickTicket.orderDate desc
/~locCode: AND (location.code) LIKE ({locCode})~/
/~itemCode: AND item.code LIKE {itemCode} ~/
/~waveDoc.code: AND (waveDoc.code) LIKE ({waveDoc.code})~/
/~dstLP.remark: AND (dstLP.remark) LIKE ({dstLP.remark})~/
order by t.id desc
]]></datasource>
<columns>
<column id="t.id" title="序号" visible="true" width="50" />

View File

@ -19,6 +19,8 @@ pickTicketDetail.orderQtyOfMasterUnit=\u9700\u6c42\u6570\u91cf
GDS=\u5de5\u5355\u6570
modifyShowPickticketDetail=\u5de5\u5355\u660e\u7ec6
showPickticketDetail=\u67e5\u770b\u5de5\u5355\u660e\u7ec6
editImportOutOrderPage=\u8f6c\u5e93\u5355\u5bfc\u5165
editImportOtherOrderDetailPag=\u5176\u5b83\u51fa\u5e93\u5355\u5bfc\u5165
zhi=\u81f3
ZYJHXD_DATE=\u4f5c\u4e1a\u8ba1\u5212\u4e0b\u8fbe\u65f6\u95f4
PLWC_DATE=\u914d\u6599\u8981\u6c42\u5b8c\u6210\u65f6\u95f4

View File

@ -24,21 +24,23 @@
</property>
<property name="url">
<!-- <value>jdbc:sqlserver://localhost:1433;DatabaseName=zwtest</value> -->
<value>jdbc:sqlserver://192.168.2.88:1433;DatabaseName=zwlgtest</value>
<!-- <value>jdbc:sqlserver://192.168.2.88:1433;DatabaseName=zwlgtest</value> -->
<!-- 正式环境地址 -->
<!-- <value>jdbc:sqlserver://10.1.96.105:1433;DatabaseName=LD_WMSDB</value> -->
<!-- <value>jdbc:sqlserver://47.103.100.52:1433;DatabaseName=zwlgtest</value> -->
<value>jdbc:sqlserver://192.168.56.133:1433;DatabaseName=LD_WMSDB</value>
</property>
<property name="username">
<!-- <value>WMSDB</value> -->
<value>sa</value>
<!-- <value>sa</value> -->
<!-- <value>wmsdb</value> -->
<value>liu</value>
</property>
<property name="password">
<!-- <value>AmecDDbb32A</value> -->
<!-- <value>HPwd12#$</value> -->
<value>Amecadmin1!</value>
<!-- <value>Amecadmin1!</value> -->
<!-- <value>WmsYc@5688</value> -->
<value>123456</value>
</property>
<property name="maxActive">
<value>500</value>

View File

@ -22,12 +22,12 @@ hibernate.dialect=com.dev.swms.server.utils.MSSQLDialect
#hibernate.dialect=org.hibernate.dialect.OracleDialect
#hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.hbm2ddl.auto=none
ldxt.bz=0
hibernate.query.substitutions true=1, false=0
#
hibernate.max_fetch_depth=0
hibernate.jdbc.fetch_size=50
hibernate.jdbc.batch_size=25