no message
parent
0d87781dc9
commit
3f1a65912a
|
|
@ -252,6 +252,9 @@ public class SceneAppController {
|
|||
for (int i = 0; i < tableList.size(); i++) {
|
||||
JSONObject tableSize=tableList.getJSONObject(i);
|
||||
String rfid=tableSize.getString("rfid");
|
||||
if (rfid.length()<10){
|
||||
continue;
|
||||
}
|
||||
//如果物料不是半成品
|
||||
String itemCode=rfid.substring(0, 9);
|
||||
Item item=itemRepository.findByCode(itemCode);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
* @param itemId
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "SELECT inv FROM Inventory inv WHERE inv.itemKey in (select ik.id from ItemKey ik where ik.item.id = ?1 ) and inv.quantity>0 and inv.queuedQty=0 order by inv.point.heat desc,inv.createTime asc ", nativeQuery = false)
|
||||
@Query(value = "SELECT inv FROM Inventory inv WHERE inv.itemKey in (select ik.id from ItemKey ik where ik.item.id = ?1 ) and inv.quantity>0 and inv.queuedQty=0 order by inv.point.heat asc ,inv.createTime asc ", nativeQuery = false)
|
||||
List<Inventory> queryInventory(long itemId);
|
||||
@Query(value = "SELECT i FROM Inventory i WHERE i.itemKey.item.id=?1 and i.point.id=?2 ", nativeQuery = false)
|
||||
List<Inventory> findByItemAndPoint(long itemId,long pointId);
|
||||
|
|
@ -53,4 +53,8 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
|||
@Query(value = "SELECT i FROM Inventory i WHERE (?3='' or i.point.area.name=?1)" +
|
||||
" and (?2='' or (i.point.code like CONCAT('',?2,'%'))) and (?3='' or i.itemKey.item.code =?3)", nativeQuery = false)
|
||||
List<Inventory> findByLoadUnits(String storageZone, String pointCode, String itemCode);
|
||||
@Query(value = " select max(inv.id) from data_inventory inv "
|
||||
+" LEFT JOIN data_task t on t.inv_id=inv.id "
|
||||
+" GROUP BY t.asn_detail_id ", nativeQuery = true)
|
||||
List<Long> findByBackSap();
|
||||
}
|
||||
|
|
@ -788,7 +788,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
List<Task> taskItemKeyList=taskRepository.findByGroupItemKey(BizStatus.RECEIVING,1,billType);
|
||||
if (billType.equals(BizStatus.RM_RK)){
|
||||
/* 料箱入库票数*/
|
||||
if (taskItemKeyList.size()!=BaseStatus.DoorPoint_LX_SUM){
|
||||
if ((taskItemKeyList.size()!=BaseStatus.DoorPoint_LX_SUM)&&!"-1".equals(BaseStatus.DoorPoint_LX_SUM+"")){
|
||||
return ApiResult.fail(201,"料箱入库当前RFID票数:"+taskItemKeyList.size(),null);
|
||||
}
|
||||
}else if(billType.equals(BizStatus.SM_RK)){
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
continue;
|
||||
}
|
||||
/* 出库完成反馈*/
|
||||
UrlApi.ptBackSap(inventory.getBillCode()
|
||||
UrlApi.ptBackSap(pickDetail.getPick().getOwner()
|
||||
,pickDetail.getPick().getRelatedBill2()
|
||||
,inventory.getItemKey().getItem().getCode()
|
||||
,pickDetail.getLineNo()+""
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.youchain.basicdata.service.dto.ItemDto;
|
|||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.AgvTaskService;
|
||||
import com.youchain.exception.BadRequestException;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
|
|
@ -147,9 +148,9 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
Dept dept = item.getDept();//仓库
|
||||
Double quantity=pickDetail.getOrderQty()-pickDetail.getAllocatedQty();//未分配数量
|
||||
ApiResult apiResult =null;
|
||||
if (pickDetail.getPropC4()==null){
|
||||
if (pickDetail.getPropC5()==null||pickDetail.getPropC5().length()<1){
|
||||
/** 默认出库配置*/
|
||||
List<Box> boxList=boxRepository.findByCodeAndItem(BizStatus.BCP_PT);
|
||||
List<Box> boxList=boxRepository.findByLampStatus(pickDetail.getPick().getBillType().getCode());;
|
||||
if (boxList.size()>0){
|
||||
Box box=boxList.get(0);
|
||||
pickDetail.setPropC4(box.getLampCode());
|
||||
|
|
@ -206,12 +207,14 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (unQty <= 0) {
|
||||
break;
|
||||
}
|
||||
{
|
||||
//整托分配
|
||||
allocateQty = inv.getQuantity();
|
||||
if (unQty < allocateQty) {
|
||||
return ApiResult.fail(201, "单号:" + pickDetail.getPick().getRelatedBill1()
|
||||
/*return ApiResult.fail(201, "单号:" + pickDetail.getPick().getRelatedBill1()
|
||||
+ "行:" + pickDetail.getLineNo() + ",剩余订单数量不足一托" + "订单数量" + quantity + ",剩余未分配数量"
|
||||
+ unQty + ",库存单托数量" + inv.getQuantity(), null);
|
||||
+ unQty + ",库存单托数量" + inv.getQuantity(), null);*/
|
||||
return ApiResult.fail(201, "拆托:" + unQty, null);
|
||||
}
|
||||
//更新库存
|
||||
inv.setQueuedQty(allocateQty);
|
||||
|
|
@ -248,6 +251,99 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
}
|
||||
taskRepository.save(task);
|
||||
}
|
||||
/*List<Inventory> inventoryEndList=inventoryRepository.findByItemAndPoint(inv.getItemKey().getItem().getId(),inv.getPoint().getId());
|
||||
if (inventoryEndList.size()>1){
|
||||
for (Inventory inventory:inventoryEndList){
|
||||
|
||||
inv=inventory;
|
||||
//整托分配
|
||||
allocateQty = inv.getQuantity();
|
||||
if (unQty < allocateQty) {
|
||||
*//*return ApiResult.fail(201, "单号:" + pickDetail.getPick().getRelatedBill1()
|
||||
+ "行:" + pickDetail.getLineNo() + ",剩余订单数量不足一托" + "订单数量" + quantity + ",剩余未分配数量"
|
||||
+ unQty + ",库存单托数量" + inv.getQuantity(), null);*//*
|
||||
return ApiResult.fail(201, "拆托:" + unQty, null);
|
||||
}
|
||||
//更新库存
|
||||
inv.setQueuedQty(allocateQty);
|
||||
inventoryRepository.save(inv);
|
||||
unQty = unQty - allocateQty;
|
||||
//更新出库单
|
||||
pickDetail.setAllocatedQty(pickDetail.getAllocatedQty() + allocateQty);
|
||||
pickDetail.setStatus(BizStatus.ALLOCATE);
|
||||
pickDetailRepository.save(pickDetail);
|
||||
//生成Task任务
|
||||
Task task = new Task();
|
||||
task.setItem(inv.getItemKey().getItem());
|
||||
task.setItemKey(inv.getItemKey());
|
||||
task.setPickDetail(pickDetail);
|
||||
task.setBillCode(pickDetail.getPick().getRelatedBill1());
|
||||
task.setSrcPoint(startPoint);
|
||||
task.setDstPoint(endPoint);
|
||||
task.setTaskType(pickDetail.getPick().getBillType().getCode());
|
||||
task.setTaskStatus(BizStatus.ALLOCATE);
|
||||
task.setBeSkip(agvFlag);//是否AGV出库
|
||||
task.setPlanQty(allocateQty);
|
||||
task.setDept(dept);
|
||||
task.setInventory(inv);
|
||||
if (agvFlag == 1) {
|
||||
*//** 是否AGV任务*//*
|
||||
if (task.getTaskType().equals(BizStatus.RM_CK)) {
|
||||
// 如果是料箱出库,先不生成搬运任务
|
||||
} else {
|
||||
//生成AGV任务
|
||||
AgvTask agvTask = agvTaskService.addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, BizStatus.PICK);
|
||||
//更新Task任务 写入关联AGV
|
||||
task.setAgvTask(agvTask);
|
||||
}
|
||||
}
|
||||
taskRepository.save(task);
|
||||
}
|
||||
}else {
|
||||
//整托分配
|
||||
allocateQty = inv.getQuantity();
|
||||
if (unQty < allocateQty) {
|
||||
*//*return ApiResult.fail(201, "单号:" + pickDetail.getPick().getRelatedBill1()
|
||||
+ "行:" + pickDetail.getLineNo() + ",剩余订单数量不足一托" + "订单数量" + quantity + ",剩余未分配数量"
|
||||
+ unQty + ",库存单托数量" + inv.getQuantity(), null);*//*
|
||||
return ApiResult.fail(201, "拆托:" + unQty, null);
|
||||
}
|
||||
//更新库存
|
||||
inv.setQueuedQty(allocateQty);
|
||||
inventoryRepository.save(inv);
|
||||
unQty = unQty - allocateQty;
|
||||
//更新出库单
|
||||
pickDetail.setAllocatedQty(pickDetail.getAllocatedQty() + allocateQty);
|
||||
pickDetail.setStatus(BizStatus.ALLOCATE);
|
||||
pickDetailRepository.save(pickDetail);
|
||||
//生成Task任务
|
||||
Task task = new Task();
|
||||
task.setItem(inv.getItemKey().getItem());
|
||||
task.setItemKey(inv.getItemKey());
|
||||
task.setPickDetail(pickDetail);
|
||||
task.setBillCode(pickDetail.getPick().getRelatedBill1());
|
||||
task.setSrcPoint(startPoint);
|
||||
task.setDstPoint(endPoint);
|
||||
task.setTaskType(pickDetail.getPick().getBillType().getCode());
|
||||
task.setTaskStatus(BizStatus.ALLOCATE);
|
||||
task.setBeSkip(agvFlag);//是否AGV出库
|
||||
task.setPlanQty(allocateQty);
|
||||
task.setDept(dept);
|
||||
task.setInventory(inv);
|
||||
if (agvFlag == 1) {
|
||||
*//** 是否AGV任务*//*
|
||||
if (task.getTaskType().equals(BizStatus.RM_CK)) {
|
||||
// 如果是料箱出库,先不生成搬运任务
|
||||
} else {
|
||||
//生成AGV任务
|
||||
AgvTask agvTask = agvTaskService.addAgvTask(BizStatus.AGV, startPoint.getStorageType(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, BizStatus.PICK);
|
||||
//更新Task任务 写入关联AGV
|
||||
task.setAgvTask(agvTask);
|
||||
}
|
||||
}
|
||||
taskRepository.save(task);
|
||||
}*/
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -408,8 +504,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (task.getAgvTask()!=null){
|
||||
AgvTask agvTask=task.getAgvTask();
|
||||
if (agvTask.getStatus().equals(BizStatus.ATCALL)||agvTask.getStatus().equals(BizStatus.ATWORK)||agvTask.getStatus().equals(BizStatus.FINISH)){
|
||||
return ApiResult.fail(400, "搬运任务已执行", null);
|
||||
|
||||
throw new BadRequestException("搬运任务已执行!");
|
||||
// return ApiResult.fail(400, "搬运任务已执行", null);
|
||||
}else {
|
||||
agvTaskRepository.delete(agvTask);
|
||||
}
|
||||
|
|
@ -547,6 +643,8 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
pickDetail=new PickDetail();
|
||||
pickDetail.setStatus(BizStatus.OPEN);
|
||||
}
|
||||
pickDetail.setPropC4("AGV_PT");
|
||||
pickDetail.setPropC5(address);
|
||||
pickDetail.setLineNo(Long.valueOf(lineNo));
|
||||
pickDetail.setItem(item);
|
||||
pickDetail.setOrderQty(Double.valueOf(quantity));
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public class TestTask {
|
|||
|
||||
}
|
||||
public void asnPutaway(){
|
||||
synchronized (BaseStatus.Lock.rfid_SJ) {
|
||||
synchronized ("asnPutaway") {
|
||||
Reader.READER_ERR err = RfidDocJava.startRfid();
|
||||
System.out.println("开始扫描:"+err.toString());
|
||||
try {
|
||||
|
|
@ -192,6 +192,11 @@ public class TestTask {
|
|||
/* 料箱入库*/
|
||||
agvTaskService.addTaskRfid(BizStatus.RM_RK);
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,9 @@ public class asnTask {
|
|||
* 同步 入库单反馈
|
||||
*/
|
||||
public void asnBackSap() {
|
||||
List<Inventory> inventoryList=inventoryRepository.findAll();
|
||||
for (Inventory inventory:inventoryList){
|
||||
List<Long> inventoryIds=inventoryRepository.findByBackSap();
|
||||
for (Long id:inventoryIds){
|
||||
Inventory inventory=inventoryRepository.findByInvId(id);
|
||||
List<Task> taskList=taskRepository.findByRkInventory(inventory.getId());
|
||||
Task task=taskList.get(0);
|
||||
UrlApi.asnBackSap(inventory.getOwner(),
|
||||
|
|
|
|||
|
|
@ -198,10 +198,13 @@ public class RfidDocJava {
|
|||
public void run() {
|
||||
for(int i=0;i<tag.length;i++){
|
||||
String v=Reader.bytes_Hexstr(tag[i].EpcId);
|
||||
System.out.println("RFID》"+Reader.bytes_Hexstr(tag[i].EpcId)+":"+v.length());
|
||||
// RFID长度验证
|
||||
boolean flag = BaseStatus.lengthVerifyList.contains(Long.valueOf(v.length()));
|
||||
if (flag) {
|
||||
// String epcId = tag[i].AntennaID;
|
||||
vt.add(Reader.bytes_Hexstr(tag[i].EpcId));
|
||||
// System.out.println("测试》"+epcId+":"+Reader.bytes_Hexstr(tag[i].EpcId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class UrlApi {
|
|||
* @param quantityExpected 期望数量
|
||||
* @param quantityReceived 收货数量
|
||||
* */
|
||||
public static void asnBackSap(String owner,String expectedReceiptId,String productId,String lineNumber
|
||||
public static void asnBackSap(String owner,String expectedReceiptId,String lineNumber,String productId
|
||||
,String quantityExpected,String quantityReceived) {
|
||||
JSONObject paramsJson=new JSONObject();
|
||||
JSONArray erLine=new JSONArray();
|
||||
|
|
@ -85,11 +85,19 @@ public class UrlApi {
|
|||
JSONArray attributeValue=new JSONArray();
|
||||
JSONObject ztBidName=new JSONObject();
|
||||
ztBidName.put("name", "ztBidName");
|
||||
if (ztBidNameValue==null){
|
||||
ztBidName.put("value", "");
|
||||
}else {
|
||||
ztBidName.put("value", ztBidNameValue);
|
||||
}
|
||||
attributeValue.add(ztBidName);
|
||||
JSONObject prodMtrlNo=new JSONObject();
|
||||
prodMtrlNo.put("name", "prodMtrlNo");
|
||||
if (prodMtrlNoValue==null){
|
||||
prodMtrlNo.put("value", "");
|
||||
}else {
|
||||
prodMtrlNo.put("value", prodMtrlNoValue);
|
||||
}
|
||||
attributeValue.add(prodMtrlNo);
|
||||
|
||||
order.put("attributeValue",attributeValue);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ spring:
|
|||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:nrwms2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:Youchain@56}
|
||||
|
|
|
|||
Loading…
Reference in New Issue