| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.service.MobileService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("mobile") |
| | | public class MobileController { |
| | | public class MobileController extends BaseController { |
| | | |
| | | @Autowired |
| | | private MobileService mobileService; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | |
| | | mobileService.comb(combParam, getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | |
| | | public interface MobileService { |
| | | |
| | | /** |
| | | * 组托 |
| | | * @param param |
| | | */ |
| | | void comb(CombParam param, Long userId); |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.MatCode; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.service.MatCodeService; |
| | | import com.zy.asrs.service.MobileService; |
| | | import com.zy.asrs.service.WaitPakinService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 移动端服务核心类 |
| | | * Created by vincent on 2020/6/28 |
| | | */ |
| | | @Service |
| | | public class MobileServiceImpl implements MobileService { |
| | | |
| | | @Autowired |
| | | private MatCodeService matCodeService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void comb(CombParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getBarcode()) || param.getCombMats().isEmpty()) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | int count = waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("barcode", param.getBarcode()).eq("status", "N")); |
| | | if (count > 0) { |
| | | throw new CoolException("箱号数据已存在"); |
| | | } |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | | MatCode matCode = matCodeService.selectById(combMat.getMatNo()); |
| | | if (Cools.isEmpty(matCode)) { |
| | | throw new CoolException("物料数据错误"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin( |
| | | param.getBarcode(), // 托盘码 |
| | | matCode.getMatNo(), // 物料编码 |
| | | matCode.getMatName(), // 物料描述 |
| | | combMat.getCount(), // 数量 |
| | | matCode.getStr1(), // 单位 |
| | | "N", // 状态 |
| | | "", // 备注 |
| | | new Date(), // 修改时间 |
| | | userId, // 修改人员 |
| | | new Date(), // 添加时间 |
| | | userId // 创建者 |
| | | ); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} |
| | | ,{field: 'id', align: 'center',title: '编号'} |
| | | ,{field: 'id', align: 'center',title: '编号', sort: true} |
| | | ,{field: 'barcode', align: 'center',title: '托盘码'} |
| | | ,{field: 'matnr', align: 'center',title: '物料编码'} |
| | | ,{field: 'maktx', align: 'center',title: '物料描述'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'unit', align: 'center',title: '单位'} |
| | | ,{field: 'status', align: 'center',title: '状态'} |
| | | ,{field: 'status', align: 'center',title: '状态', templet:function(row){ |
| | | var html = "<input value='status' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'"; |
| | | if(row.inEnable === 'Y'){html += " checked ";} |
| | | html += ">"; |
| | | return html; |
| | | }} |
| | | ,{field: 'memo', align: 'center',title: '备注'} |
| | | ,{field: 'modiTime$', align: 'center',title: '修改时间', hide: true} |
| | | ,{field: 'modiUser$', align: 'center',title: '修改人员', hide: true} |