Commit 5e2ef206 zshaohui

1.工单未出完,通知wms

1 个父辈 0f7e4b3c
......@@ -37,11 +37,14 @@ import com.neotel.smfcore.core.system.bean.MSDAppendInfo;
import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.zhongche1568.enums.ZhongCheOrderType;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.bean.FileProperties;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.security.service.manager.IRoleManager;
import com.neotel.smfcore.security.service.manager.IUserManager;
import com.neotel.smfcore.security.service.po.Group;
import com.neotel.smfcore.security.service.po.Role;
import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -52,6 +55,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -114,6 +118,9 @@ public class OrderController {
private DataCache dataCache;
@Autowired
private IRoleManager roleManager;
@Autowired
SmfApi smfApi;
// @ApiOperation("导出用户数据")
......@@ -295,6 +302,32 @@ public class OrderController {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"orderNo"});
}
//通知wms
@ApiOperation("通知wms完成")
@RequestMapping("/notificationToWms")
//@AnonymousAccess
public ResultBean notificationToWms(String orderNo) {
if (StringUtils.isEmpty(orderNo)){
return ResultBean.newErrorResult(-1,"smfcore.valueCanotNull","{0}不能为空",new String[]{"需求单号"});
}
LiteOrder order = liteOrderCache.getLiteOrder(orderNo);
if (order == null){
return ResultBean.newErrorResult(-1,"smfcore.valueNotExist","{0}[{1}]不存在",new String[]{"需求单",orderNo});
}
//判断登录人是不是admin权限
String userId = SecurityUtils.getCurrentUserId();
User user = userManager.get(userId);
Role role = roleManager.get(user.getRoleId());
if (!"admin".equals(role.getName())){
return ResultBean.newErrorResult(-1,"smfcore.noAccess", "暂无权限");
}
order.setNotificationToWms(true);
smfApi.onOrderStatusChange(order);
return ResultBean.newOkResult("");
}
private OrderDto toOrderDto(LiteOrder liteOrder) {
OrderSetting orderSetting = dataCache.getOrderSetting();
OrderDto dto = orderMapper.toDto(liteOrder);
......
......@@ -116,6 +116,8 @@ public class LiteOrder extends BasePo implements Serializable {
*/
private Date sdate=new Date();
private boolean notificationToWms = false;
public void setClosed(boolean value){
this.closed=value;
if(value){
......
......@@ -153,7 +153,7 @@ public class ZhongcheApi extends BaseSmfApiListener {
@Override
public void onOrderStatusChange(String orderNotifyUrl, LiteOrder liteOrder) {
if (liteOrder.isClosed() || liteOrder.isTaskFinished()) {
if (liteOrder.isClosed() || liteOrder.isTaskFinished() || liteOrder.isNotificationToWms()) {
if (ZhongCheOrderType.FIRST.equals(liteOrder.getType())) {
ShelfInfo shelfInfo = new ShelfInfo();
shelfInfo.setOrderNo(liteOrder.getOrderNo());
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!