New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.param.WmsWrkCreateParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/open") |
| | | public class OpenController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | public static final ArrayList<String> APP_KEY_LIST = new ArrayList<String>() {{ |
| | | add("ea1f0459efc02a79f046f982767939ae"); |
| | | }}; |
| | | |
| | | //创建WMS任务 |
| | | @PostMapping("/wmsWrkCreate") |
| | | public R wmsWrkCreate(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) WmsWrkCreateParam param, |
| | | HttpServletRequest request) { |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | if (Cools.isEmpty(param.getWmsWrkNo())) { |
| | | return R.error("WMS任务号[wmsWrkNo]不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getIoType())) { |
| | | return R.error("任务类型[ioType]不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getBarcode())) { |
| | | return R.error("条码[barcode]不能为空"); |
| | | } |
| | | openService.wmsWrkCreate(param); |
| | | return R.ok(); |
| | | } |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}接口被访问;appkey:{};请求数据:{}", request.getServletPath(), appkey, JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | if (Cools.isEmpty(appkey)) { |
| | | throw new CoolException("认证失败,请确认appkey无误!"); |
| | | } |
| | | if (!APP_KEY_LIST.contains(appkey)) { |
| | | throw new CoolException("认证失败,请确认appkey无误!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | if (wmsWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (wmsWrk.getWmsStatus() == WmsWrkStatusType.COMPLETE.id) { |
| | | return R.error(wmsWrk.getWmsWrkNo() + "已完结"); |
| | | } |
| | | Date now = new Date(); |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.COMPLETE.id); |
| | | wmsWrk.setModiTime(new Date()); |
| | | wmsWrk.setModiTime(now); |
| | | wmsWrk.setModiUser(getUserId()); |
| | | wmsWrk.setEndTime(now); |
| | | wmsWrkService.updateById(wmsWrk); |
| | | return R.ok(); |
| | | } |
| | |
| | | if (wmsWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (wmsWrk.getWmsStatus() == WmsWrkStatusType.CANCEL.id) { |
| | | return R.error(wmsWrk.getWmsWrkNo() + "已被取消"); |
| | | } |
| | | Date now = new Date(); |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.CANCEL.id); |
| | | wmsWrk.setModiTime(new Date()); |
| | | wmsWrk.setModiTime(now); |
| | | wmsWrk.setModiUser(getUserId()); |
| | | wmsWrk.setEndTime(now); |
| | | wmsWrkService.updateById(wmsWrk); |
| | | return R.ok(); |
| | | } |
| | |
| | | private String sourceLocNo; |
| | | |
| | | /** |
| | | * 库位状态 |
| | | * 条码 |
| | | */ |
| | | @ApiModelProperty(value= "库位状态") |
| | | @TableField("loc_sts") |
| | | private String locSts; |
| | | |
| | | /** |
| | | * 拣料(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "拣料(checkBox)") |
| | | private String picking; |
| | | @ApiModelProperty(value= "条码") |
| | | @TableField("barcode") |
| | | private String barcode; |
| | | |
| | | /** |
| | | * 修改人员 |
| | |
| | | private String memo; |
| | | |
| | | /** |
| | | * 条码 |
| | | */ |
| | | @ApiModelProperty(value= "条码") |
| | | @TableField("barcode") |
| | | private String barcode; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | @ApiModelProperty(value= "结束时间") |
| | |
| | | |
| | | public WmsWrk() {} |
| | | |
| | | public WmsWrk(Integer wmsWrkNo, Integer wmsStatus, Integer wrkNo, Date createTime, Integer ioType, Double ioPri, String locNo, Integer staNo, Integer sourceStaNo, String sourceLocNo, String locSts, String picking, Long modiUser, Date modiTime, Long appeUser, Date appeTime, String memo, String barcode) { |
| | | public WmsWrk(Integer wmsWrkNo, Integer wmsStatus, Integer wrkNo, Date createTime, Integer ioType, Double ioPri, String locNo, Integer staNo, Integer sourceStaNo, String sourceLocNo, Long modiUser, Date modiTime, Long appeUser, Date appeTime, String memo, String barcode, Date endTime) { |
| | | this.wmsWrkNo = wmsWrkNo; |
| | | this.wmsStatus = wmsStatus; |
| | | this.wrkNo = wrkNo; |
| | |
| | | this.staNo = staNo; |
| | | this.sourceStaNo = sourceStaNo; |
| | | this.sourceLocNo = sourceLocNo; |
| | | this.locSts = locSts; |
| | | this.picking = picking; |
| | | this.modiUser = modiUser; |
| | | this.modiTime = modiTime; |
| | | this.appeUser = appeUser; |
| | | this.appeTime = appeTime; |
| | | this.memo = memo; |
| | | this.barcode = barcode; |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | // WmsWrk wmsWrk = new WmsWrk( |
New file |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class WmsWrkCreateParam { |
| | | |
| | | //WMS任务号 |
| | | private Integer wmsWrkNo; |
| | | |
| | | //任务类型 |
| | | private Integer ioType; |
| | | |
| | | //目标库位 |
| | | private String locNo; |
| | | |
| | | //源库位 |
| | | private String sourceLocNo; |
| | | |
| | | //目标站 |
| | | private Integer staNo; |
| | | |
| | | //源站 |
| | | private Integer sourceStaNo; |
| | | |
| | | //条码 |
| | | private String barcode; |
| | | |
| | | //备注 |
| | | private String memo; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.param.WmsWrkCreateParam; |
| | | |
| | | public interface OpenService { |
| | | |
| | | //创建WMS任务 |
| | | void wmsWrkCreate(WmsWrkCreateParam param); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.WmsWrkStatusType; |
| | | import com.zy.asrs.entity.WmsWrk; |
| | | import com.zy.asrs.entity.param.WmsWrkCreateParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.WmsWrkService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class OpenServiceImpl implements OpenService { |
| | | |
| | | @Autowired |
| | | private WmsWrkService wmsWrkService; |
| | | |
| | | @Override |
| | | public void wmsWrkCreate(WmsWrkCreateParam param) { |
| | | WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(param.getWmsWrkNo()); |
| | | if (wmsWrk != null) { |
| | | throw new CoolException(param.getWmsWrkNo() + "任务已存在,请勿重复提交"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | wmsWrk = new WmsWrk(); |
| | | wmsWrk.setWmsWrkNo(param.getWmsWrkNo());//WMS任务号 |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.RECEIVE.id);//WMS状态:接收 |
| | | wmsWrk.setCreateTime(now); |
| | | wmsWrk.setAppeTime(now); |
| | | wmsWrk.setAppeUser(9527L); |
| | | wmsWrk.setIoType(param.getIoType());//任务类型 |
| | | wmsWrk.setIoPri(13D);//优先级 |
| | | wmsWrk.setBarcode(param.getBarcode());//条码 |
| | | if (!Cools.isEmpty(param.getLocNo())) { |
| | | wmsWrk.setLocNo(param.getLocNo());//目标库位 |
| | | } |
| | | if (!Cools.isEmpty(param.getSourceLocNo())) { |
| | | wmsWrk.setSourceLocNo(param.getSourceLocNo());//源库位 |
| | | } |
| | | if (!Cools.isEmpty(param.getStaNo())) { |
| | | wmsWrk.setStaNo(param.getStaNo());//目标站 |
| | | } |
| | | if (!Cools.isEmpty(param.getSourceStaNo())) { |
| | | wmsWrk.setSourceStaNo(param.getSourceStaNo());//源站 |
| | | } |
| | | if (!Cools.isEmpty(param.getMemo())) { |
| | | wmsWrk.setMemo(param.getMemo());//备注 |
| | | } |
| | | |
| | | if (!wmsWrkService.insert(wmsWrk)) { |
| | | throw new CoolException("生成任务失败,请联系管理员"); |
| | | } |
| | | } |
| | | } |
| | |
| | | <result column="sta_no" property="staNo" /> |
| | | <result column="source_sta_no" property="sourceStaNo" /> |
| | | <result column="source_loc_no" property="sourceLocNo" /> |
| | | <result column="loc_sts" property="locSts" /> |
| | | <result column="picking" property="picking" /> |
| | | <result column="modi_user" property="modiUser" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="appe_user" property="appeUser" /> |
| | |
| | | ,{field: 'staNo$', align: 'center',title: '目标站'} |
| | | ,{field: 'sourceLocNo', align: 'center',title: '源库位'} |
| | | ,{field: 'locNo', align: 'center',title: '目标库位'} |
| | | ,{field: 'locSts', align: 'center',title: '库位状态'} |
| | | ,{field: 'barcode', align: 'center',title: '条码'} |
| | | // ,{field: 'picking', align: 'center',title: '拣料'} |
| | | // ,{field: 'modiUser$', align: 'center',title: '修改人员'} |
| | | // ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'appeUser$', align: 'center',title: '创建者'} |
| | | ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | ,{field: 'memo', align: 'center',title: '备注'} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 110} |