|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 修改白胚盘点单
|
|
|
|
|
*
|
|
|
|
|