wms服务部分修改1.3

highway
mengjiao 1 year ago
parent dee2982dbd
commit 51da2c459f

@ -23,7 +23,7 @@ import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author Open Platform
* @date 2023-07-06
*/
@ -71,7 +71,7 @@ public class OdsWhiteEmbryoController extends BaseController {
@RequiresPermissions("wms:embryo:add")
@Log(title = "白胚出库单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OdsWhiteEmbryo odsWhiteEmbryo) {
public AjaxResult add(@RequestBody List<OdsWhiteEmbryo> odsWhiteEmbryo) {
return toAjax(odsWhiteEmbryoService.insertOdsWhiteEmbryo(odsWhiteEmbryo));
}

@ -23,7 +23,7 @@ import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author Open Platform
* @date 2023-07-06
*/
@ -71,7 +71,7 @@ public class OdsWhiteEmbryoInventoryController extends BaseController {
@RequiresPermissions("wms:Inventory:add")
@Log(title = "白胚盘点单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OdsWhiteEmbryoInventory odsWhiteEmbryoInventory) {
public AjaxResult add(@RequestBody List<OdsWhiteEmbryoInventory> odsWhiteEmbryoInventory) {
return toAjax(odsWhiteEmbryoInventoryService.insertOdsWhiteEmbryoInventory(odsWhiteEmbryoInventory));
}

@ -1,8 +1,15 @@
package com.op.wms.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.wms.domain.OdsWhiteEmbryo;
import com.op.wms.domain.Purcode;
import com.op.wms.mapper.PurcodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.OdsWhiteEmbryoInventoryMapper;
@ -19,7 +26,8 @@ import com.op.wms.service.IOdsWhiteEmbryoInventoryService;
public class OdsWhiteEmbryoInventoryServiceImpl implements IOdsWhiteEmbryoInventoryService {
@Autowired
private OdsWhiteEmbryoInventoryMapper odsWhiteEmbryoInventoryMapper;
@Autowired
private PurcodeMapper purcodeMapper;
/**
*
*
@ -52,10 +60,59 @@ public class OdsWhiteEmbryoInventoryServiceImpl implements IOdsWhiteEmbryoInvent
*/
@Override
@DS("#header.poolName")
public int insertOdsWhiteEmbryoInventory(OdsWhiteEmbryoInventory odsWhiteEmbryoInventory) {
return odsWhiteEmbryoInventoryMapper.insertOdsWhiteEmbryoInventory(odsWhiteEmbryoInventory);
public int insertOdsWhiteEmbryoInventory(List<OdsWhiteEmbryoInventory> odsWhiteEmbryoInventory) {
String userName = SecurityContextHolder.getUserName();
int tem=0;
for (OdsWhiteEmbryoInventory odsWhiteEmbryoInventory1:
odsWhiteEmbryoInventory) {
String orderCode =getPurcode(null,"PD");
odsWhiteEmbryoInventory1.setID(IdUtils.fastSimpleUUID());
odsWhiteEmbryoInventory1.setOrderCode(orderCode);
odsWhiteEmbryoInventory1.setCreateDate(new Date());
odsWhiteEmbryoInventory1.setOrderStatus("0");//0,1
odsWhiteEmbryoInventory1.setActive("1");
odsWhiteEmbryoInventory1.setCreateBy(userName);
tem= odsWhiteEmbryoInventoryMapper.insertOdsWhiteEmbryoInventory(odsWhiteEmbryoInventory1);
}
return tem;
}
@DS("#header.poolName")
private String getPurcode(String factorycode, String orderType) {
String purcode = "";
String curDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
Integer vaule = purcodeMapper.queryCurValue(orderType, curDate);
if (vaule == null) {
Purcode purcodeO = new Purcode();
purcodeO.setCurDate(curDate);
purcodeO.setOrderType(orderType);
purcodeO.setValue(1);
int count = purcodeMapper.insert(purcodeO);
if (count != 1) {
return "";
}
if (factorycode != null && !factorycode.equals("")) {
purcode = orderType + factorycode + curDate.substring(2) + String.format("%04d", 1);
} else {
purcode = orderType + curDate.substring(2) + String.format("%04d", 1);
}
} else {
int count = purcodeMapper.updateCurValue(orderType, curDate, vaule);
if (count != 1) {
return "";
}
if (factorycode != null && !factorycode.equals("")) {
purcode = orderType + factorycode + curDate.substring(2) + String.format("%04d", vaule + 1);
} else {
purcode = orderType + curDate.substring(2) + String.format("%04d", vaule + 1);
}
}
return purcode;
}
/**
*
*

@ -1,8 +1,15 @@
package com.op.wms.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.wms.domain.Purcode;
import com.op.wms.domain.WmsOdsWhiteEmbryoIn;
import com.op.wms.mapper.PurcodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.OdsWhiteEmbryoMapper;
@ -19,7 +26,8 @@ import com.op.wms.service.IOdsWhiteEmbryoService;
public class OdsWhiteEmbryoServiceImpl implements IOdsWhiteEmbryoService {
@Autowired
private OdsWhiteEmbryoMapper odsWhiteEmbryoMapper;
@Autowired
private PurcodeMapper purcodeMapper;
/**
*
*
@ -52,10 +60,59 @@ public class OdsWhiteEmbryoServiceImpl implements IOdsWhiteEmbryoService {
*/
@Override
@DS("#header.poolName")
public int insertOdsWhiteEmbryo(OdsWhiteEmbryo odsWhiteEmbryo) {
return odsWhiteEmbryoMapper.insertOdsWhiteEmbryo(odsWhiteEmbryo);
public int insertOdsWhiteEmbryo(List<OdsWhiteEmbryo> odsWhiteEmbryos) {
String userName = SecurityContextHolder.getUserName();
int tem=0;
for (OdsWhiteEmbryo odsWhiteEmbryo:
odsWhiteEmbryos) {
String orderCode =getPurcode(null,"CL");
odsWhiteEmbryo.setID(IdUtils.fastSimpleUUID());
odsWhiteEmbryo.setOrderCode(orderCode);
odsWhiteEmbryo.setCreateDate(new Date());
odsWhiteEmbryo.setOrderStatus("0");//0,1
odsWhiteEmbryo.setActive("1");
odsWhiteEmbryo.setCreateBy(userName);
tem= odsWhiteEmbryoMapper.insertOdsWhiteEmbryo(odsWhiteEmbryo);
}
return tem;
}
@DS("#header.poolName")
private String getPurcode(String factorycode, String orderType) {
String purcode = "";
String curDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
Integer vaule = purcodeMapper.queryCurValue(orderType, curDate);
if (vaule == null) {
Purcode purcodeO = new Purcode();
purcodeO.setCurDate(curDate);
purcodeO.setOrderType(orderType);
purcodeO.setValue(1);
int count = purcodeMapper.insert(purcodeO);
if (count != 1) {
return "";
}
if (factorycode != null && !factorycode.equals("")) {
purcode = orderType + factorycode + curDate.substring(2) + String.format("%04d", 1);
} else {
purcode = orderType + curDate.substring(2) + String.format("%04d", 1);
}
} else {
int count = purcodeMapper.updateCurValue(orderType, curDate, vaule);
if (count != 1) {
return "";
}
if (factorycode != null && !factorycode.equals("")) {
purcode = orderType + factorycode + curDate.substring(2) + String.format("%04d", vaule + 1);
} else {
purcode = orderType + curDate.substring(2) + String.format("%04d", vaule + 1);
}
}
return purcode;
}
/**
*
*

Loading…
Cancel
Save