|
@@ -4,9 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jsh.erp.datasource.entities.*;
|
|
|
import com.jsh.erp.datasource.mappers.MaterialBatchMapper;
|
|
|
+import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
|
|
|
+import com.jsh.erp.exception.JshException;
|
|
|
import com.jsh.erp.service.*;
|
|
|
import com.jsh.erp.utils.DateUtils;
|
|
|
import com.jsh.erp.utils.RandomHelper;
|
|
|
+import com.jsh.erp.utils.StringUtil;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -17,7 +22,7 @@ import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,MaterialBatch> implements MaterialBatchService {
|
|
|
-
|
|
|
+ private Logger logger = LoggerFactory.getLogger(MaterialBatchServiceImpl.class);
|
|
|
|
|
|
@Resource
|
|
|
private MaterialBatchMapper materialBatchMapper;
|
|
@@ -34,17 +39,20 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
|
|
|
@Resource
|
|
|
private InventoryLogService inventoryLogService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MaterialCategoryMapperEx materialCategoryMapperEx;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
- public void generateMaterialBatchByDepotItemId(Long diId) throws Exception {
|
|
|
+ public void generateMaterialBatchByDepotItemId(DepotItem depotItem) throws Exception {
|
|
|
//获取单据子表信息
|
|
|
- DepotItem depotItem = depotItemService.getDepotItem(diId);
|
|
|
+ //DepotItem depotItem = depotItemService.getDepotItem(diId);
|
|
|
//获取条码信息
|
|
|
MaterialExtend materialExtend = materialExtendService.getMaterialExtend(depotItem.getMaterialExtendId());
|
|
|
//创建批次信息
|
|
|
MaterialBatch materialBatch = new MaterialBatch();
|
|
|
//设置单据id
|
|
|
- materialBatch.setDepotItemId(diId);
|
|
|
+ materialBatch.setDepotItemId(depotItem.getId());
|
|
|
//设置商品id
|
|
|
materialBatch.setMaterialId(depotItem.getMaterialId());
|
|
|
//设置商品单位
|
|
@@ -127,4 +135,24 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
|
|
|
return materialBatchMapper.getInventorySumByDepotAndMid(depotList,mid);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取批次号字符
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String standardOrModel, String color, String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Integer offset, Integer rows, Long depotId) throws Exception {
|
|
|
+ List<MaterialVo4Unit> list =null;
|
|
|
+ try{
|
|
|
+
|
|
|
+ if(StringUtil.isNotEmpty(q)) {
|
|
|
+ q = q.replace("'", "");
|
|
|
+ q = q.trim();
|
|
|
+ }
|
|
|
+ list= materialBatchMapper.findBySelectWithBarCode(q, standardOrModel, color, brand, mfrs,
|
|
|
+ enableSerialNumber, enableBatchNumber, offset, rows,depotId);
|
|
|
+ }catch(Exception e){
|
|
|
+ JshException.readFail(logger, e);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
}
|