| | |
| | | @RequestMapping(value = "/locMast/init/auth") |
| | | @ManagerAuth(memo = "初始化库位") |
| | | // @Transactional |
| | | public R init(LocMastInitParam param) { |
| | | public synchronized R init(LocMastInitParam param) { |
| | | List<LocMast> list = new ArrayList<>(); |
| | | for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ |
| | | for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { |
| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.MatCode; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.MatCodeService; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.ints.entity.StockSync; |
| | | import com.zy.ints.service.StockSyncService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private MatCodeService matCodeService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | StockSyncService stockSyncService; |
| | | |
| | | // 库存统计 ------------------------------------------------------------------------------------------ |
| | | |
| | |
| | | @RequestParam Map<String, Object> param) { |
| | | Page<LocDetl> stockStatis = locDetlService.getStockStatis(toPage(curr, limit, param, LocDetl.class)); |
| | | for (LocDetl locDetl : stockStatis.getRecords()) { |
| | | MatCode mat = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no",locDetl.getMatNo()).eq("str8",locDetl.getColor())); |
| | | MatCode mat = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no",locDetl.getMatNo())); |
| | | // MatCode mat = matCodeService.selectById(locDetl.getMatnr()); |
| | | if (mat != null) { |
| | | VersionUtils.setLocDetl(locDetl, mat); |
| | |
| | | .doWrite(excel); |
| | | } |
| | | |
| | | // @RequestMapping(value = "/stock/statis/queryLocByMatNoAndMatName") |
| | | // public R queryLocByMatNoAndMatName(@RequestParam LocDetl locDetl){ |
| | | // List<LocDetl> locDetls=locDetlService.getlocDetlByMatNoAndMatName(locDetl); |
| | | //// locDetl. |
| | | // return R.ok().add(locDetls); |
| | | // } |
| | | /** |
| | | * 获取库存同步表数据 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/stock/stockSyncCount") |
| | | @ManagerAuth(memo = "获取库存同步上传清单数量") |
| | | public R getStockSyncCount() { |
| | | return R.ok(stockSyncService.getStockSyncCount()); |
| | | } |
| | | |
| | | /** |
| | | * 插入数据到库存同步表 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/stock/insertStockSync") |
| | | @ManagerAuth(memo = "同步上传清单数据插入") |
| | | @Transactional |
| | | public R insertStockSync() { |
| | | Date now = new Date(); |
| | | Long userId = getUserId(); |
| | | List<LocDetl> locDetls = locDetlService.getStockSum(); |
| | | for(LocDetl locdetl : locDetls){ |
| | | StockSync stockSync = new StockSync(); |
| | | stockSync.setMatNo(locdetl.getMatNo()); |
| | | stockSync.setMatName(locdetl.getMatName()); |
| | | stockSync.setQty(locdetl.getQty()); |
| | | stockSync.setModiUser(userId); |
| | | stockSync.setModiTime(now); |
| | | stockSync.setAppeUser(userId); |
| | | stockSync.setAppeTime(now); |
| | | if(!stockSyncService.insert(stockSync)){ |
| | | throw new CoolException("插入同步库存数据失败"); |
| | | } |
| | | } |
| | | return R.ok(locDetls.size()); |
| | | } |
| | | |
| | | /** |
| | | * 更新数据到库存同步表,先清空再插入 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/stock/updateStockSync") |
| | | @ManagerAuth(memo = "清空同步上传数据并插入") |
| | | @Transactional |
| | | public R updateStockSync() { |
| | | if(!stockSyncService.clearStockSync()){ |
| | | throw new CoolException("同步上传数据清空失败,请联系管理员"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | Long userId = getUserId(); |
| | | List<LocDetl> locDetls = locDetlService.getStockSum(); |
| | | for(LocDetl locdetl : locDetls){ |
| | | StockSync stockSync = new StockSync(); |
| | | stockSync.setMatNo(locdetl.getMatNo()); |
| | | stockSync.setMatName(locdetl.getMatName()); |
| | | stockSync.setQty(locdetl.getQty()); |
| | | stockSync.setModiUser(userId); |
| | | stockSync.setModiTime(now); |
| | | stockSync.setAppeUser(userId); |
| | | stockSync.setAppeTime(now); |
| | | if(!stockSyncService.insert(stockSync)){ |
| | | throw new CoolException("更新同步库存数据失败"); |
| | | } |
| | | } |
| | | return R.ok(locDetls.size()); |
| | | } |
| | | } |
| | |
| | | Integer getStockStatisCount(Map<String, Object> condition); |
| | | |
| | | List<LocDetl> getStockStatisExcel(); |
| | | |
| | | /** |
| | | * 库存上报ERP时,根据物料汇总查询库存总量 |
| | | * @return |
| | | */ |
| | | @Select("select mat_no,mat_name,sum(qty) qty from asr_loc_detl group by mat_no,mat_name") |
| | | List<LocDetl> getStockSum(); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | // List<LocDetl> getlocDetlByMatNoAndMatName(LocDetl locDetl); |
| | | |
| | | /** |
| | | * 库存上报ERP时,根据物料汇总查询库存总量 |
| | | * @return |
| | | */ |
| | | public List<LocDetl> getStockSum(); |
| | | } |
| | |
| | | return this.baseMapper.getStockStatisExcel(); |
| | | } |
| | | |
| | | /** |
| | | * 库存上报ERP时,根据物料汇总查询库存总量 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<LocDetl> getStockSum() { |
| | | return locDetlMapper.getStockSum(); |
| | | } |
| | | } |
| | |
| | | import com.zy.ints.service.WaitMatinService; |
| | | import com.zy.ints.service.WaitMatoutService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | |
| | | private WaitMatoutService waitMatoutService; |
| | | @Autowired |
| | | private IoCompleteService ioCompleteService; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | } |
| | | |
| | | //插入回报档 insert ====>> io_complete |
| | | if("Y".equals(wrkMast.getLinkMis())){ |
| | | if(erpEnabled && "Y".equals(wrkMast.getLinkMis())){ |
| | | IoComplete ioComplete = new IoComplete(); |
| | | ioComplete.setBillNo(wrkDetl.getBillNo()); |
| | | ioComplete.setSeqNo(wrkDetl.getSeqNo()); |
| | |
| | | } |
| | | |
| | | //插入回报档 insert ====>> io_complete |
| | | if("Y".equals(wrkMast.getLinkMis())){ |
| | | if(erpEnabled && "Y".equals(wrkMast.getLinkMis())){ |
| | | IoComplete ioComplete = new IoComplete(); |
| | | ioComplete.setBillNo(wrkDetl.getBillNo()); |
| | | ioComplete.setSeqNo(wrkDetl.getSeqNo()); |
| | |
| | | } |
| | | |
| | | //插入回报档 insert ====>> io_complete |
| | | if("Y".equals(wrkMast.getLinkMis())){ |
| | | if(erpEnabled && "Y".equals(wrkMast.getLinkMis())){ |
| | | IoComplete ioComplete = new IoComplete(); |
| | | ioComplete.setBillNo(wrkDetl.getBillNo()); |
| | | ioComplete.setSeqNo(wrkDetl.getSeqNo()); |
| | |
| | | } |
| | | |
| | | //插入回报档 insert ====>> io_complete |
| | | if("Y".equals(wrkMast.getLinkMis())){ |
| | | if(erpEnabled && "Y".equals(wrkMast.getLinkMis())){ |
| | | IoComplete ioComplete = new IoComplete(); |
| | | ioComplete.setBillNo(wrkDetl.getBillNo()); |
| | | ioComplete.setSeqNo(wrkDetl.getSeqNo()); |
| | |
| | | generator.url="192.168.4.208:1433;databasename=xgmasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="ints_io_complete_log"; |
| | | generator.table="ints_stock_sync"; |
| | | generator.packagePath="com.zy.ints"; |
| | | generator.html=false; |
| | | generator.js=false; |
| | | generator.htmlDetail=false; |
| | | generator.build(); |
| | | } |
| | | |
| New file |
| | |
| | | package com.zy.ints.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.ints.entity.StockSync; |
| | | import com.zy.ints.service.StockSyncService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class StockSyncController extends BaseController { |
| | | |
| | | @Autowired |
| | | private StockSyncService stockSyncService; |
| | | |
| | | @RequestMapping(value = "/stockSync/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(stockSyncService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<StockSync> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(stockSyncService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/add/auth") |
| | | @ManagerAuth |
| | | public R add(StockSync stockSync) { |
| | | stockSyncService.insert(stockSync); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/update/auth") |
| | | @ManagerAuth |
| | | public R update(StockSync stockSync){ |
| | | if (Cools.isEmpty(stockSync) || null==stockSync.getMatNo()){ |
| | | return R.error(); |
| | | } |
| | | stockSyncService.updateById(stockSync); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | stockSyncService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<StockSync> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("stockSync")); |
| | | convert(map, wrapper); |
| | | List<StockSync> list = stockSyncService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSyncQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<StockSync> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("mat_no", condition); |
| | | Page<StockSync> page = stockSyncService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (StockSync stockSync : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", stockSync.getMatNo()); |
| | | map.put("value", stockSync.getMatNo()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stockSync/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<StockSync> wrapper = new EntityWrapper<StockSync>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != stockSyncService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(StockSync.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @TableName("ints_stock_sync") |
| | | public class StockSync implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 物料编码 |
| | | */ |
| | | @ApiModelProperty(value= "物料编码") |
| | | @TableId(value = "mat_no", type = IdType.INPUT) |
| | | @TableField("mat_no") |
| | | private String matNo; |
| | | |
| | | /** |
| | | * 物料名称 |
| | | */ |
| | | @ApiModelProperty(value= "物料名称") |
| | | @TableField("mat_name") |
| | | private String matName; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @ApiModelProperty(value= "数量") |
| | | private Double qty; |
| | | |
| | | /** |
| | | * 完成状态 0: 待处理 1: 上报成功 2: 上报失败 |
| | | */ |
| | | @ApiModelProperty(value= "完成状态 0: 待处理 1: 上报成功 2: 上报失败 ") |
| | | @TableField("upd_status") |
| | | private Integer updStatus; |
| | | |
| | | /** |
| | | * 异常信息 |
| | | */ |
| | | @ApiModelProperty(value= "异常信息") |
| | | @TableField("error_memo") |
| | | private String errorMemo; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | @TableField("modi_user") |
| | | private Long modiUser; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @TableField("modi_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 建档人员 |
| | | */ |
| | | @ApiModelProperty(value= "建档人员") |
| | | @TableField("appe_user") |
| | | private Long appeUser; |
| | | |
| | | /** |
| | | * 建档时间 |
| | | */ |
| | | @ApiModelProperty(value= "建档时间") |
| | | @TableField("appe_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date appeTime; |
| | | |
| | | public StockSync() {} |
| | | |
| | | public StockSync(String matNo,String matName,Double qty,Integer updStatus,String errorMemo,Long modiUser,Date modiTime,Long appeUser,Date appeTime) { |
| | | this.matNo = matNo; |
| | | this.matName = matName; |
| | | this.qty = qty; |
| | | this.updStatus = updStatus; |
| | | this.errorMemo = errorMemo; |
| | | this.modiUser = modiUser; |
| | | this.modiTime = modiTime; |
| | | this.appeUser = appeUser; |
| | | this.appeTime = appeTime; |
| | | } |
| | | |
| | | // StockSync stockSync = new StockSync( |
| | | // null, // 物料编码[非空] |
| | | // null, // 物料名称[非空] |
| | | // null, // 数量 |
| | | // null, // 完成状态 |
| | | // null, // 异常信息 |
| | | // null, // 修改人员 |
| | | // null, // 修改时间 |
| | | // null, // 建档人员 |
| | | // null // 建档时间 |
| | | // ); |
| | | |
| | | public String getMatNo() { |
| | | return matNo; |
| | | } |
| | | |
| | | public void setMatNo(String matNo) { |
| | | this.matNo = matNo; |
| | | } |
| | | |
| | | public String getMatName() { |
| | | return matName; |
| | | } |
| | | |
| | | public void setMatName(String matName) { |
| | | this.matName = matName; |
| | | } |
| | | |
| | | public Double getQty() { |
| | | return qty; |
| | | } |
| | | |
| | | public void setQty(Double qty) { |
| | | this.qty = qty; |
| | | } |
| | | |
| | | public Integer getUpdStatus() { |
| | | return updStatus; |
| | | } |
| | | |
| | | public String getUpdStatus$(){ |
| | | if (null == this.updStatus){ return null; } |
| | | switch (this.updStatus){ |
| | | case 0: |
| | | return "待处理"; |
| | | case 1: |
| | | return "上报成功"; |
| | | case 2: |
| | | return "上报失败"; |
| | | default: |
| | | return String.valueOf(this.updStatus); |
| | | } |
| | | } |
| | | |
| | | public void setUpdStatus(Integer updStatus) { |
| | | this.updStatus = updStatus; |
| | | } |
| | | |
| | | public String getErrorMemo() { |
| | | return errorMemo; |
| | | } |
| | | |
| | | public void setErrorMemo(String errorMemo) { |
| | | this.errorMemo = errorMemo; |
| | | } |
| | | |
| | | public Long getModiUser() { |
| | | return modiUser; |
| | | } |
| | | |
| | | public String getModiUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.modiUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getUsername()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setModiUser(Long modiUser) { |
| | | this.modiUser = modiUser; |
| | | } |
| | | |
| | | public Date getModiTime() { |
| | | return modiTime; |
| | | } |
| | | |
| | | public String getModiTime$(){ |
| | | if (Cools.isEmpty(this.modiTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); |
| | | } |
| | | |
| | | public void setModiTime(Date modiTime) { |
| | | this.modiTime = modiTime; |
| | | } |
| | | |
| | | public Long getAppeUser() { |
| | | return appeUser; |
| | | } |
| | | |
| | | public String getAppeUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.appeUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getUsername()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setAppeUser(Long appeUser) { |
| | | this.appeUser = appeUser; |
| | | } |
| | | |
| | | public Date getAppeTime() { |
| | | return appeTime; |
| | | } |
| | | |
| | | public String getAppeTime$(){ |
| | | if (Cools.isEmpty(this.appeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); |
| | | } |
| | | |
| | | public void setAppeTime(Date appeTime) { |
| | | this.appeTime = appeTime; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.ints.entity.StockSync; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface StockSyncMapper extends BaseMapper<StockSync> { |
| | | |
| | | Integer getStockSyncCount(); |
| | | |
| | | // Integer insertStockSync(List<StockSync> list); |
| | | |
| | | Boolean clearStockSync(); |
| | | |
| | | } |
| | |
| | | @Mapper |
| | | @Repository |
| | | public interface WaitMatchkLogMapper extends BaseMapper<WaitMatchkLog> { |
| | | @Insert("insert into ints_wait_matchk_log select * from ints_wait_matchk where bill_no=#{billNo} and locNo=#{locNo} and matNo=#{matNo}") |
| | | @Insert("insert into ints_wait_matchk_log select * from ints_wait_matchk where bill_no=#{billNo} and loc_no=#{locNo} and mat_no=#{matNo}") |
| | | int save(@Param("billNo") String billNo, @Param("locNo") String locNo, @Param("matNo") String matNo); |
| | | } |
| New file |
| | |
| | | package com.zy.ints.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.ints.entity.StockSync; |
| | | |
| | | public interface StockSyncService extends IService<StockSync> { |
| | | |
| | | Integer getStockSyncCount(); |
| | | |
| | | // Integer insertStockSync(List<StockSync> list); |
| | | |
| | | Boolean clearStockSync(); |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.ints.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.ints.entity.StockSync; |
| | | import com.zy.ints.mapper.StockSyncMapper; |
| | | import com.zy.ints.service.StockSyncService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("stockSyncService") |
| | | public class StockSyncServiceImpl extends ServiceImpl<StockSyncMapper, StockSync> implements StockSyncService { |
| | | |
| | | @Override |
| | | public Integer getStockSyncCount() { |
| | | return this.baseMapper.getStockSyncCount(); |
| | | } |
| | | |
| | | // @Override |
| | | // public Integer insertStockSync(List<StockSync> list) { |
| | | // return this.baseMapper.insertStockSync(list); |
| | | // } |
| | | |
| | | @Override |
| | | public Boolean clearStockSync() { |
| | | return this.baseMapper.clearStockSync(); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IoCompleteLogHandler ioCompleteLogHandler; |
| | | |
| | | @Autowired |
| | | private IoCompleteService ioCompleteService; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | | if(!erpEnabled) return; |
| | | List<IoComplete> ioCompletes = ioCompleteService.selectIoCompleteBySts(); |
| | | for (IoComplete ioComplete : ioCompletes) { |
| | | ReturnT<String> result = ioCompleteLogHandler.start(ioComplete); |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private WaitMatchkService waitMatchkService; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | private void execute(){ |
| | | List<WaitMatchk> waitMatchks = null; |
| | | if(!erpEnabled) return; |
| | | List<WaitMatchk> waitMatchks = waitMatchkService.selectWaitMatchkBySts(); |
| | | for (WaitMatchk waitMatchk : waitMatchks) { |
| | | ReturnT<String> result = waitMatchkLogHandler.start(waitMatchk); |
| | | if (!result.isSuccess()) { |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private WaitMatinService waitMatinService; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | @Scheduled(cron = "0/4 * * * * ? ") |
| | | private void execute(){ |
| | | if(!erpEnabled) return; |
| | | List<WaitMatin> WaitMatins = waitMatinService.selectWaitMatinBySts(); |
| | | for (WaitMatin waitMatin : WaitMatins) { |
| | | ReturnT<String> result = waitMatinLogHandler.start(waitMatin); |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private WaitMatoutService waitMatoutService; |
| | | |
| | | @Autowired |
| | | private WaitMatoutLogHandler waitMatOutLogHandler; |
| | | |
| | | /** |
| | | * ERP接口是否启用 |
| | | */ |
| | | @Value("${erp.enabled}") |
| | | private Boolean erpEnabled; |
| | | |
| | | @Scheduled(cron = "0/4 * * * * ? ") |
| | | private void execute(){ |
| | | if(!erpEnabled) return; |
| | | List<WaitMatout> waitMatouts = waitMatoutService.selectWaitMatOutBySts(); |
| | | for (WaitMatout waitMatout : waitMatouts) { |
| | | ReturnT<String> result = waitMatOutLogHandler.start(waitMatout); |
| | |
| | | exceptionHandle("保存盘点通知历史档[billNo={0},locNo={1},matNo={2}]失败", waitMatchk.getBillNo(),waitMatchk.getLocNo(),waitMatchk.getMatNo()); |
| | | } |
| | | // 删除盘点通知档 |
| | | if (!waitMatchkService.delete(new EntityWrapper<WaitMatchk>().eq("bill_no", waitMatchk.getBillNo()).eq("loc_no", waitMatchk.getSeqNo()) |
| | | if (!waitMatchkService.delete(new EntityWrapper<WaitMatchk>().eq("bill_no", waitMatchk.getBillNo()).eq("loc_no", waitMatchk.getLocNo()) |
| | | .eq("mat_no", waitMatchk.getMatNo()))) { |
| | | exceptionHandle("删除盘点通知档[billNo={0},locNo={1},matNo={2}]失败", waitMatchk.getBillNo(),waitMatchk.getLocNo(),waitMatchk.getMatNo()); |
| | | } |
| New file |
| | |
| | | -- save stockSync record |
| | | -- mysql |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync/stockSync.html', 'stockSync管理', null , '2', null , '1'); |
| | | |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#view', '查询', '', '3', '0', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#btn-add', '新增', '', '3', '1', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#btn-edit', '编辑', '', '3', '2', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#btn-delete', '删除', '', '3', '3', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#btn-export', '导出', '', '3', '4', '1'); |
| | | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'stockSync#btn-into', '导入', '', '3', '5', '1'); |
| | | |
| | | -- sqlserver |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync/stockSync.html', N'stockSync管理', null, '2', null, '1'); |
| | | |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#view', N'查询', '', '3', '0', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#btn-add', N'新增', '', '3', '1', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#btn-edit', N'编辑', '', '3', '2', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#btn-delete', N'删除', '', '3', '3', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#btn-export', N'导出', '', '3', '4', '1'); |
| | | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'stockSync#btn-into', N'导入', '', '3', '5', '1'); |
| | |
| | | pwd: xltys1995 |
| | | |
| | | swagger: |
| | | enable: false |
| | | enable: false |
| | | |
| | | #ERP接口 |
| | | erp: |
| | | enabled: true |
| | |
| | | where 1=1 |
| | | group by a.mat_no,a.mat_name |
| | | </select> |
| | | |
| | | <!-- <select id="getStockSum" resultMap="BaseResultMap">--> |
| | | <!-- select mat_no,mat_name,sum(qty) qty from asr_loc_detl--> |
| | | <!-- group by mat_no,mat_name--> |
| | | <!-- </select>--> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.ints.mapper.StockSyncMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.ints.entity.StockSync"> |
| | | <result column="mat_no" property="matNo" /> |
| | | <result column="mat_name" property="matName" /> |
| | | <result column="qty" property="qty" /> |
| | | <result column="upd_status" property="updStatus" /> |
| | | <result column="error_memo" property="errorMemo" /> |
| | | <result column="modi_user" property="modiUser" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="appe_user" property="appeUser" /> |
| | | <result column="appe_time" property="appeTime" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="getStockSyncCount" resultType="integer"> |
| | | select count(*) from ints_stock_sync; |
| | | </select> |
| | | |
| | | <!-- <insert id="insertStockSync">--> |
| | | <!-- BEGIN--> |
| | | <!-- <foreach collection="list" item="item" index="index">--> |
| | | <!-- INSERT INTO ints_stock_sync (mat_no, mat_name, qty, upd_status, appe_time, appe_user, modi_time, modi_user)--> |
| | | <!-- VALUES (#{item.matNo,jdbcType=VARCHAR}, #{item.matName,jdbcType=VARCHAR}, #{item.qty,jdbcType=DECIMAL}, 0,--> |
| | | <!-- #{item.appeTime,jdbcType=TIMESTAMP}, #{item.appeUser,jdbcType=DECIMAL},--> |
| | | <!-- #{item.modiTime,jdbcType=TIMESTAMP}, #{item.modiUser,jdbcType=DECIMAL})--> |
| | | <!-- </foreach>--> |
| | | <!-- END;--> |
| | | <!-- </insert>--> |
| | | |
| | | <delete id="clearStockSync"> |
| | | DELETE FROM ints_stock_sync |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectWaitMatchkBySts" resultMap="BaseResultMap"> |
| | | select * from ints_wait_matchk |
| | | where io_status=2 |
| | | where io_status=2 and verify_status=1 |
| | | order by modi_time,mat_no asc |
| | | </select> |
| | | |
| | |
| | | cols: [[ |
| | | {type: 'checkbox', fixed: 'left'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | ,{field: 'locNo', align: 'center',title: '库位号',sort:true} |
| | | ,{field: 'locNo', align: 'center',title: '库位号', sort:true} |
| | | ,{field: 'locSts$', align: 'center',title: '库位状态',width:200} |
| | | // ,{field: 'whsType$', align: 'center',title: '库位类型'} |
| | | // ,{field: 'pltType', align: 'center',title: ''} |
| | |
| | | // ,{field: 'scWeight', align: 'center',title: ''} |
| | | // ,{field: 'invWh', align: 'center',title: ''} |
| | | // ,{field: 'mk', align: 'center',title: ''} |
| | | // ,{field: 'barcode', align: 'center',title: ''} |
| | | ,{field: 'barcode', align: 'center',title: '条码'} |
| | | // ,{field: 'PdcType', align: 'center',title: ''} |
| | | // ,{field: 'ctnNo', align: 'center',title: ''} |
| | | ,{field: 'locType1$', align: 'center',title: '高低类型'} |
| | | ,{field: 'locType2$', align: 'center',title: '宽窄类型'} |
| | | ,{field: 'locType3$', align: 'center',title: '轻重类型'} |
| | | // ,{field: 'locType2$', align: 'center',title: '宽窄类型'} |
| | | // ,{field: 'locType3$', align: 'center',title: '轻重类型'} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:100} |
| | | ]], |
| | |
| | | }); |
| | | break; |
| | | case "init": |
| | | $('#initDo').removeClass("layui-btn-disabled") |
| | | layer.prompt({title: '请输入口令,并重置库位', formType: 1, shadeClose: true}, function(pass, idx){ |
| | | http.get(baseUrl+"/locMast/init/pwd", {pwd: pass}, function (res) { |
| | | if (res.data) { |
| | |
| | | |
| | | // 初始化保存 |
| | | form.on('submit(initDo)', function (data) { |
| | | // layer.load(1, {shade: [0.5,'#000']}); |
| | | $('#initDo').addClass("layui-btn-disabled").attr("disabled", "disabled"); |
| | | $.ajax({ |
| | | url: baseUrl+"/locMast/init/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | async: false, |
| | | // async: false, |
| | | success: function (res) { |
| | | // layer.closeAll('loading'); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg); |
| | | layer.closeAll(); |
| | |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[{field: 'qty', align: 'center', title: '数量', width: 80} |
| | | cols: [[{field: 'qty', align: 'center', title: '数量', width: 120} |
| | | , {field: 'matNo', align: 'center', title: '产品编码'} |
| | | , {field: 'matName', align: 'center', title: '产品名称'} |
| | | ]], |
| | |
| | | table.on('toolbar(locStatis)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch(obj.event) { |
| | | case 'syncStok': |
| | | alert('插入数据到ERP接口库存同步表'); |
| | | $.ajax({ |
| | | url: baseUrl + "/stock/stockSyncCount", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | method: 'POST', |
| | | traditional: true, |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | var msg = ''; |
| | | if (res.data == 0) { |
| | | msg = '确定要同步库存数据吗?' |
| | | } else { |
| | | msg = '同步任务正在进行,确定要中止并重新同步吗?' |
| | | } |
| | | layer.confirm(msg, { |
| | | shadeClose: true |
| | | , btn: ['确定'] |
| | | }, function () { |
| | | if (res.data > 0) { |
| | | // 清空同步上传清单数据,再进行插入数据 |
| | | $.ajax({ |
| | | url: baseUrl + "/stock/updateStockSync", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | layer.msg("更新上报库存数据成功!"); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | // 调用同步上传清单数据插入接口 |
| | | $.ajax({ |
| | | url: baseUrl + "/stock/insertStockSync", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {}, |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200) { |
| | | layer.msg("插入上报库存数据成功!"); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | layer.closeAll(); |
| | | } |
| | | ); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | break; |
| | | case 'exportAll': |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 解决浏览器自动填充密码问题,新增一个隐藏输入框 --> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" style="width:10px;opacity: 0;position: absolute"> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="locMast" lay-filter="locMast"></table> |
| | |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">宽窄类型</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="locType2"> |
| | | <option style="display: none"></option> |
| | | <option value="0">未知</option> |
| | | <option value="1">窄库位</option> |
| | | <option value="2">宽库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">轻重类型</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="locType3"> |
| | | <option style="display: none"></option> |
| | | <option value="0">未知</option> |
| | | <option value="1">轻库位</option> |
| | | <option value="2">重库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">宽窄类型</label>--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <select name="locType2">--> |
| | | <!-- <option style="display: none"></option>--> |
| | | <!-- <option value="0">未知</option>--> |
| | | <!-- <option value="1">窄库位</option>--> |
| | | <!-- <option value="2">宽库位</option>--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">轻重类型</label>--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <select name="locType3">--> |
| | | <!-- <option style="display: none"></option>--> |
| | | <!-- <option value="0">未知</option>--> |
| | | <!-- <option value="1">轻库位</option>--> |
| | | <!-- <option value="2">重库位</option>--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div id="prompt" style="text-indent: 10px;"> |
| | | <span class="not-null">初始化库位后将删除库存明细,请谨慎操作!</span> |
| | | </div> |
| | |
| | | </div> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" lay-event="exportAll" style="margin-top: -0px">导出全部</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" id="refresh-sto" lay-event="syncStok" style="margin-left: 10px">上报库存到ERP</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" lay-event="exportAll" style="float: right">导出</button> |
| | | </div> |
| | | </script> |
| | | <script type="text/html" id="operate"> |