rev:1、库存可视乎名称修改;2、库存记录可用数、库存数为0问题修改;3、载具新增支持批量新增
This commit is contained in:
@@ -45,8 +45,8 @@ public class VehicleController {
|
||||
@Log("新增载具")
|
||||
@ApiOperation("新增载具")
|
||||
//@PreAuthorize("@el.check('vehicle:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody VehicleDto dto) {
|
||||
vehicleService.create(dto);
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject form) {
|
||||
vehicleService.create(form);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ public interface VehicleService {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
* @param form /
|
||||
*/
|
||||
void create(VehicleDto dto);
|
||||
void create(JSONObject form);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
|
||||
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.st.base.service.VehicleService;
|
||||
@@ -77,19 +78,27 @@ public class VehicleServiceImpl implements VehicleService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(VehicleDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
public void create(JSONObject form) {
|
||||
int vehicle_qty = form.getIntValue("vehicle_qty");
|
||||
for (int i = 0; i < vehicle_qty; i++) {
|
||||
VehicleDto dto = form.toJavaObject(VehicleDto.class);
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setVehicle_uuid(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
String vehicle_code = CodeUtil.getNewCode("VEHICLE_CODE");
|
||||
dto.setVehicle_code(vehicle_code);
|
||||
dto.setVehicle_name(vehicle_code);
|
||||
dto.setVehicle_uuid(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_base_vehicle");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_base_vehicle");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -113,10 +113,16 @@ public class StoreIvtServiceImpl {
|
||||
break;
|
||||
case 22:
|
||||
json.put("ivt_qty", change_qty);
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("barcode",param.getString("barcode"));
|
||||
stackIvtTab.insert(json);
|
||||
break;
|
||||
case 23:
|
||||
json.put("ivt_qty", change_qty);
|
||||
json.put("canuse_qty", change_qty);
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("barcode",param.getString("barcode"));
|
||||
stackIvtTab.insert(json);
|
||||
break;
|
||||
case 24:// 同时减
|
||||
// 语句
|
||||
@@ -130,9 +136,7 @@ public class StoreIvtServiceImpl {
|
||||
default: // 可选
|
||||
throw new BadRequestException("变动类型不正确!");
|
||||
}
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("barcode",param.getString("barcode"));
|
||||
stackIvtTab.insert(json);
|
||||
|
||||
}
|
||||
// 对应的货位上有物料,需判断数量重量相关字段是否符合实际逻辑,符合时更新相应记录
|
||||
if (stackIvtObj != null) {
|
||||
@@ -167,6 +171,9 @@ public class StoreIvtServiceImpl {
|
||||
if (after_canuse_qty.doubleValue() < 0) {
|
||||
throw new BadRequestException("可用数量不足,无法操作!");
|
||||
}
|
||||
if (after_ivt_qty.doubleValue() <= 0 ) {
|
||||
is_sub0 = true;
|
||||
}
|
||||
stackIvtObj.put("canuse_qty", after_canuse_qty);
|
||||
break;
|
||||
case 12:// 12-增加可用重量和数量;
|
||||
|
||||
Reference in New Issue
Block a user