|
@@ -10,6 +10,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
+import org.jeecg.modules.inventory.convert.ItdmSampleExpireConvert;
|
|
|
+import org.jeecg.modules.inventory.dto.ItdmSampleExpireDTO;
|
|
|
import org.jeecg.modules.inventory.entity.ItdmSampleExpire;
|
|
|
import org.jeecg.modules.inventory.entity.ItdmSampleExpireReal;
|
|
|
import org.jeecg.modules.inventory.entity.ItdmSampleInventory;
|
|
@@ -90,16 +92,17 @@ public class ItdmSampleExpireController extends JeecgController<ItdmSampleExpire
|
|
|
|
|
|
/**
|
|
|
* 添加
|
|
|
- *
|
|
|
- * @param itdmSampleExpire
|
|
|
- * @return
|
|
|
*/
|
|
|
@AutoLog(value = "样品过期表-添加")
|
|
|
@ApiOperation(value="样品过期表-添加", notes="样品过期表-添加")
|
|
|
//@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:add")
|
|
|
@PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody ItdmSampleExpire itdmSampleExpire) {
|
|
|
- List<String> barcodeList = Arrays.asList(itdmSampleExpire.getBarCodes().split(","));
|
|
|
+ public Result<String> add(@RequestBody ItdmSampleExpireDTO dto) {
|
|
|
+ List<String> barcodeList = dto.getBarCodes();
|
|
|
+ String barcodes = String.join(",",barcodeList);
|
|
|
+ ItdmSampleExpire itdmSampleExpire = ItdmSampleExpireConvert.INSTANCE.convert(dto,barcodes);
|
|
|
+// List<String> barcodeList = Arrays.asList(itdmSampleExpire.getBarCodes().split(","));
|
|
|
+
|
|
|
String samples = "";
|
|
|
for(String barcode:barcodeList){
|
|
|
ItdmSampleInventory inventory = inventoryService.getByBarCode(barcode);
|
|
@@ -113,17 +116,17 @@ public class ItdmSampleExpireController extends JeecgController<ItdmSampleExpire
|
|
|
|
|
|
/**
|
|
|
* 编辑
|
|
|
- *
|
|
|
- * @param itdmSampleExpire
|
|
|
- * @return
|
|
|
*/
|
|
|
@AutoLog(value = "样品过期表-编辑")
|
|
|
@ApiOperation(value="样品过期表-编辑", notes="样品过期表-编辑")
|
|
|
//@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:edit")
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody ItdmSampleExpire itdmSampleExpire) {
|
|
|
+ public Result<String> edit(@RequestBody ItdmSampleExpireDTO dto) {
|
|
|
+ List<String> barcodeList = dto.getBarCodes();
|
|
|
+ String barcodes = String.join(",",barcodeList);
|
|
|
+ ItdmSampleExpire itdmSampleExpire = ItdmSampleExpireConvert.INSTANCE.convert(dto,barcodes);
|
|
|
+
|
|
|
if(itdmSampleExpire.getAuditStatus().equals("0")){ //0未审批1审批通过2审批拒绝
|
|
|
- List<String> barcodeList = Arrays.asList(itdmSampleExpire.getBarCodes().split(","));
|
|
|
String samples = "";
|
|
|
for(String barcode:barcodeList){
|
|
|
ItdmSampleInventory inventory = inventoryService.getByBarCode(barcode);
|
|
@@ -174,8 +177,11 @@ public class ItdmSampleExpireController extends JeecgController<ItdmSampleExpire
|
|
|
//@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:delete")
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- itdmSampleExpireService.removeById(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
+ ItdmSampleExpire itdmSampleExpire = itdmSampleExpireService.getById(id);
|
|
|
+ if(itdmSampleExpire.getAuditStatus().equals("0")){
|
|
|
+ itdmSampleExpireService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }else return Result.error("已审批,不可删除!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -189,8 +195,14 @@ public class ItdmSampleExpireController extends JeecgController<ItdmSampleExpire
|
|
|
//@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:deleteBatch")
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
|
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.itdmSampleExpireService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
+ List<String> list = Arrays.asList(ids.split(","));
|
|
|
+ List<String> idList = new ArrayList<>();
|
|
|
+ for (String id :list){
|
|
|
+ ItdmSampleExpire itdmSampleExpire = itdmSampleExpireService.getById(id);
|
|
|
+ if(itdmSampleExpire.getAuditStatus().equals("0")) idList.add(id);
|
|
|
+ }
|
|
|
+ this.itdmSampleExpireService.removeByIds(idList);
|
|
|
+ return Result.OK("未审批部分批量删除成功!");
|
|
|
}
|
|
|
|
|
|
/**
|