This commit is contained in:
2023-04-14 14:36:11 +08:00
3 changed files with 94 additions and 4 deletions

View File

@@ -0,0 +1,89 @@
package org.nl.wms.pda.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.ConstantParam;
import org.nl.common.anno.Log;
import org.nl.common.utils.MapOf;
import org.nl.wms.basedata.st.service.SectattrService;
import org.nl.wms.basedata.st.service.StructivtService;
import org.nl.wms.pcs.service.SaleOrderService;
import org.nl.wms.pda.dto.MaterialDto;
import org.nl.wms.sch.service.PointService;
import org.nl.wms.st.in.service.ProductInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/*
* @author ZZQ
* @Date 2023/4/11 17:35
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "成品手持服务")
@RequestMapping("/api/pda/finishproduct")
@Slf4j
@SaIgnore
public class PdaProductIosController {
@Autowired
private ProductInService productInService;
@Autowired
private StructivtService structivtService;
@Autowired
private SectattrService sectattrService;
@Autowired
private SaleOrderService saleOrderService;
@Autowired
private PointService pointService;
@PostMapping("/order")
@Log("根据订单获取订单物料信息")
@ApiOperation("根据订单获取订单物料信息")
public ResponseEntity<Object> getOrderMaterial(@RequestBody JSONObject param) {
Assert.notNull(param,"请求参数不能为空");
param.put("sale_code",param.getString("order"));
Map<String, Object> data = saleOrderService.queryAll(param, PageRequest.of(param.getInteger("page")-1,param.getInteger("size")));
return new ResponseEntity<>(data,HttpStatus.OK);
}
@PostMapping("/in")
@Log("新增入库单")
@ApiOperation("新增入库单")
public ResponseEntity<Object> in(@RequestBody JSONObject whereJson) {
productInService.createPdaTask(whereJson);
return new ResponseEntity<>(MapOf.of("message","创建成功","status", HttpStatus.OK.value()),HttpStatus.OK);
}
@PostMapping("/releasepoint")
@Log("发货确认")
@ApiOperation("发货确认")
public ResponseEntity<Object> out(@RequestBody JSONObject param) {
Assert.notEmpty(new Object[]{param, param.getString("option")}, "操作类型不能为空");
if (param.getString("option").equals("one")){
Assert.notNull(param.getString("point"),"发货区点位不能为空");
}
structivtService.releasePoint(param.getString("point"),StringUtils.isEmpty(param.getString("sect_code"))?ConstantParam.FHQ:param.getString("sect_code"));
return new ResponseEntity<>(MapOf.of("message","创建成功","status", HttpStatus.OK.value()),HttpStatus.OK);
}
@PostMapping("/point")
@Log("根据订单获取订单物料信息")
@ApiOperation("根据订单获取订单物料信息")
public ResponseEntity<Object> getPoint(@RequestBody JSONObject param) {
Assert.notNull(param,"请求参数不能为空");
String type = param.getString("type");
return new ResponseEntity<>(pointService.selectPoint(type),HttpStatus.OK);
}
}

View File

@@ -713,14 +713,16 @@ public class ProductInServiceImpl implements ProductInService {
@Transactional(rollbackFor = Exception.class)
public void confirmvehicle(JSONObject whereJson) {
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
WQLObject vehicleMaterialTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis");
String storagevehicle_code = whereJson.getString("storagevehicle_code");
// 校验载具是否存在
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVehicle)) throw new BadRequestException("载具不存在");
JSONArray vehicleMaterial = vehicleMaterialTab.query("storagevehicle_code = '" + storagevehicle_code + "' and material_id IS not NULL ").getResultJSONArray(0);
if (vehicleMaterial.size()>0){
throw new BadRequestException("载具已被占用");
}
// 更新分配明细载具号
JSONObject jsonDis = disTab.query("iostorinvdis_id = '" + whereJson.getString("iostorinvdis_id") + "'").uniqueResult(0);
// 校验此明细是否已经分配
@@ -730,7 +732,6 @@ public class ProductInServiceImpl implements ProductInService {
jsonDis.put("storagevehicle_id", jsonVehicle.getString("storagevehicle_id"));
jsonDis.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
disTab.update(jsonDis);
}
@Override