|
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
@@ -22,241 +23,256 @@ import java.util.Collection;
|
|
/**
|
|
/**
|
|
* @Description: 其他入库单
|
|
* @Description: 其他入库单
|
|
* @Author: jeecg-boot
|
|
* @Author: jeecg-boot
|
|
- * @Date: 2024-12-04
|
|
|
|
|
|
+ * @Date: 2024-12-04
|
|
* @Version: V1.0
|
|
* @Version: V1.0
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class StorePurchaseOtherServiceImpl extends ServiceImpl<StorePurchaseOtherMapper, StorePurchaseOther> implements IStorePurchaseOtherService {
|
|
public class StorePurchaseOtherServiceImpl extends ServiceImpl<StorePurchaseOtherMapper, StorePurchaseOther> implements IStorePurchaseOtherService {
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private StorePurchaseOtherMapper storePurchaseOtherMapper;
|
|
|
|
- @Autowired
|
|
|
|
- private StorePurchaseOtherShipMapper storePurchaseOtherShipMapper;
|
|
|
|
- @Autowired
|
|
|
|
- private StorePurchaseOtherDetailsMapper storePurchaseOtherDetailsMapper;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IStoreOnhandService storeOnhandService;
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void saveMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList,List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
|
|
|
|
- storePurchaseOtherMapper.insert(storePurchaseOther);
|
|
|
|
- if(storePurchaseOtherShipList!=null && storePurchaseOtherShipList.size()>0) {
|
|
|
|
- for(StorePurchaseOtherShip entity:storePurchaseOtherShipList) {
|
|
|
|
- //外键设置
|
|
|
|
- entity.setId(null);
|
|
|
|
- entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
- storePurchaseOtherShipMapper.insert(entity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(storePurchaseOtherDetailsList!=null && storePurchaseOtherDetailsList.size()>0) {
|
|
|
|
- for(StorePurchaseOtherDetails entity:storePurchaseOtherDetailsList) {
|
|
|
|
- //外键设置
|
|
|
|
- entity.setId(null);
|
|
|
|
- entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
- storePurchaseOtherDetailsMapper.insert(entity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void updateMain(StorePurchaseOther storePurchaseOther,List<StorePurchaseOtherShip> storePurchaseOtherShipList,List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
|
|
|
|
- storePurchaseOtherMapper.updateById(storePurchaseOther);
|
|
|
|
-
|
|
|
|
- //1.先删除子表数据
|
|
|
|
- storePurchaseOtherShipMapper.deleteByMainId(storePurchaseOther.getId());
|
|
|
|
- storePurchaseOtherDetailsMapper.deleteByMainId(storePurchaseOther.getId());
|
|
|
|
-
|
|
|
|
- //2.子表数据重新插入
|
|
|
|
- if(storePurchaseOtherShipList!=null && storePurchaseOtherShipList.size()>0) {
|
|
|
|
- for(StorePurchaseOtherShip entity:storePurchaseOtherShipList) {
|
|
|
|
- //外键设置
|
|
|
|
- entity.setId(null);
|
|
|
|
- entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
- storePurchaseOtherShipMapper.insert(entity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(storePurchaseOtherDetailsList!=null && storePurchaseOtherDetailsList.size()>0) {
|
|
|
|
- for(StorePurchaseOtherDetails entity:storePurchaseOtherDetailsList) {
|
|
|
|
- //外键设置
|
|
|
|
- entity.setId(null);
|
|
|
|
- entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
- storePurchaseOtherDetailsMapper.insert(entity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void delMain(String id) {
|
|
|
|
- storePurchaseOtherShipMapper.deleteByMainId(id);
|
|
|
|
- storePurchaseOtherDetailsMapper.deleteByMainId(id);
|
|
|
|
- storePurchaseOtherMapper.deleteById(id);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void delBatchMain(Collection<? extends Serializable> idList) {
|
|
|
|
- for(Serializable id:idList) {
|
|
|
|
- storePurchaseOtherShipMapper.deleteByMainId(id.toString());
|
|
|
|
- storePurchaseOtherDetailsMapper.deleteByMainId(id.toString());
|
|
|
|
- storePurchaseOtherMapper.deleteById(id);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Result<String> submitBatch(String ids) {
|
|
|
|
-
|
|
|
|
- QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
|
-
|
|
|
|
- List<StorePurchaseOther> list = this.list(queryWrapper);
|
|
|
|
- if (list.size() == 0) {
|
|
|
|
- return Result.error("数据为空!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
|
- for (StorePurchaseOther o : list) {
|
|
|
|
- // 1-已提交,0-未提交
|
|
|
|
- String submit = o.getSubmit();
|
|
|
|
- String code = o.getBillCode();
|
|
|
|
-
|
|
|
|
- if (submit != null && submit != "" && submit.equals("1")) {
|
|
|
|
- sb.append("单据编码" + code).append("已提交,请勿再次提交;");
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
|
-
|
|
|
|
- return Result.error(sb.toString());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //执行入库操作
|
|
|
|
- String result = actionIn(list);
|
|
|
|
-
|
|
|
|
- if ("true".equals(result)) {
|
|
|
|
-
|
|
|
|
- StorePurchaseOther ent = new StorePurchaseOther();
|
|
|
|
- ent.setSubmit("1");
|
|
|
|
- this.update(ent, queryWrapper);
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- return Result.error(result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return Result.OK("提交成功!");
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //执行入库操作
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public String actionIn(List<StorePurchaseOther> list) {
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
-
|
|
|
|
- for (StorePurchaseOther o : list) {
|
|
|
|
-
|
|
|
|
- List<StorePurchaseOtherDetails> entList = storePurchaseOtherDetailsMapper.selectByMainId(o.getId());
|
|
|
|
-
|
|
|
|
- for (StorePurchaseOtherDetails ent : entList) {
|
|
|
|
-
|
|
|
|
- StoreOnhand storeOnhand = new StoreOnhand();
|
|
|
|
-
|
|
|
|
- storeOnhand.setWarehouse(o.getWarehouse());//仓库
|
|
|
|
-// storeOnhand.setWarehouseName();//仓库名称
|
|
|
|
- storeOnhand.setGoodsAllocation(o.getGoodsAllocation());//货位
|
|
|
|
- storeOnhand.setProject(o.getProject());//项目
|
|
|
|
- storeOnhand.setProjectName(o.getProjectName());//项目
|
|
|
|
- storeOnhand.setSupplier(o.getSupplier());//供应商
|
|
|
|
- storeOnhand.setSupplierName(o.getSupplierName());//供应商
|
|
|
|
- storeOnhand.setProductionClass(o.getProductionClass());//产品分类
|
|
|
|
- storeOnhand.setMaker(o.getMaker());//厂家
|
|
|
|
-
|
|
|
|
- storeOnhand.setProductId(ent.getProductId());//产品
|
|
|
|
- storeOnhand.setChineseName(ent.getChineseName());//产品
|
|
|
|
- storeOnhand.setEnglishName(ent.getEnglishName());//产品
|
|
|
|
- storeOnhand.setSpecifications(ent.getSpecifications());//规格
|
|
|
|
- storeOnhand.setModel(ent.getModel());//型号
|
|
|
|
- storeOnhand.setPartno(ent.getPartno());//备件号
|
|
|
|
- storeOnhand.setDrawingno(ent.getDrawingno());//图号
|
|
|
|
-// storeOnhand.setOrderno(ent.setOrderno());//
|
|
|
|
- storeOnhand.setFactory(ent.getFactory());//厂家
|
|
|
|
- storeOnhand.setQualityGrade(ent.getQualityGrade());//质量等级
|
|
|
|
- storeOnhand.setQuantity(ent.getStockInQuantity());//入库数量
|
|
|
|
- storeOnhand.setInitialQuantity(ent.getStockInQuantity());//初始数量
|
|
|
|
- storeOnhand.setSourceId(ent.getId());//记录来源id
|
|
|
|
- storeOnhand.setSourceCode(o.getBillCode());//记录来源code
|
|
|
|
- storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
|
|
|
|
-
|
|
|
|
- storeOnhandService.addStore(storeOnhand);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- return e.getMessage();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return "true";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public Result<String> returnSubmitBatch(String ids) {
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private StorePurchaseOtherMapper storePurchaseOtherMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private StorePurchaseOtherShipMapper storePurchaseOtherShipMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private StorePurchaseOtherDetailsMapper storePurchaseOtherDetailsMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IStoreOnhandService storeOnhandService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void saveMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList, List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
|
|
|
|
+ storePurchaseOtherMapper.insert(storePurchaseOther);
|
|
|
|
+ if (storePurchaseOtherShipList != null && storePurchaseOtherShipList.size() > 0) {
|
|
|
|
+ for (StorePurchaseOtherShip entity : storePurchaseOtherShipList) {
|
|
|
|
+ //外键设置
|
|
|
|
+ entity.setId(null);
|
|
|
|
+ entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
+ storePurchaseOtherShipMapper.insert(entity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (storePurchaseOtherDetailsList != null && storePurchaseOtherDetailsList.size() > 0) {
|
|
|
|
+ for (StorePurchaseOtherDetails entity : storePurchaseOtherDetailsList) {
|
|
|
|
+ //外键设置
|
|
|
|
+ entity.setId(null);
|
|
|
|
+ entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
+ storePurchaseOtherDetailsMapper.insert(entity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void updateMain(StorePurchaseOther storePurchaseOther, List<StorePurchaseOtherShip> storePurchaseOtherShipList, List<StorePurchaseOtherDetails> storePurchaseOtherDetailsList) {
|
|
|
|
+ storePurchaseOtherMapper.updateById(storePurchaseOther);
|
|
|
|
+
|
|
|
|
+ //1.先删除子表数据
|
|
|
|
+ storePurchaseOtherShipMapper.deleteByMainId(storePurchaseOther.getId());
|
|
|
|
+ storePurchaseOtherDetailsMapper.deleteByMainId(storePurchaseOther.getId());
|
|
|
|
+
|
|
|
|
+ //2.子表数据重新插入
|
|
|
|
+ if (storePurchaseOtherShipList != null && storePurchaseOtherShipList.size() > 0) {
|
|
|
|
+ for (StorePurchaseOtherShip entity : storePurchaseOtherShipList) {
|
|
|
|
+ //外键设置
|
|
|
|
+ entity.setId(null);
|
|
|
|
+ entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
+ storePurchaseOtherShipMapper.insert(entity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (storePurchaseOtherDetailsList != null && storePurchaseOtherDetailsList.size() > 0) {
|
|
|
|
+ for (StorePurchaseOtherDetails entity : storePurchaseOtherDetailsList) {
|
|
|
|
+ //外键设置
|
|
|
|
+ entity.setId(null);
|
|
|
|
+ entity.setHeadId(storePurchaseOther.getId());
|
|
|
|
+ storePurchaseOtherDetailsMapper.insert(entity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void delMain(String id) {
|
|
|
|
+ storePurchaseOtherShipMapper.deleteByMainId(id);
|
|
|
|
+ storePurchaseOtherDetailsMapper.deleteByMainId(id);
|
|
|
|
+ storePurchaseOtherMapper.deleteById(id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void delBatchMain(Collection<? extends Serializable> idList) {
|
|
|
|
+ for (Serializable id : idList) {
|
|
|
|
+ storePurchaseOtherShipMapper.deleteByMainId(id.toString());
|
|
|
|
+ storePurchaseOtherDetailsMapper.deleteByMainId(id.toString());
|
|
|
|
+ storePurchaseOtherMapper.deleteById(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Result<String> submitBatch(String ids) {
|
|
|
|
+
|
|
|
|
+ QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
|
+
|
|
|
|
+ List<StorePurchaseOther> list = this.list(queryWrapper);
|
|
|
|
+ if (list.size() == 0) {
|
|
|
|
+ return Result.error("数据为空!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
|
+ for (StorePurchaseOther o : list) {
|
|
|
|
+ // 1-已提交,0-未提交
|
|
|
|
+ String submit = o.getSubmit();
|
|
|
|
+ String code = o.getBillCode();
|
|
|
|
+
|
|
|
|
+ String getWarehouse = o.getWarehouse();
|
|
|
|
+ String getGoodsAllocation = o.getGoodsAllocation();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isBlank(getWarehouse)) {
|
|
|
|
+ sb.append("单据编码" + code).append("仓库为空,无法入库;");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(getGoodsAllocation)) {
|
|
|
|
+ sb.append("单据编码" + code).append("货位为空,无法入库;");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (submit != null && submit != "" && submit.equals("1")) {
|
|
|
|
+ sb.append("单据编码" + code).append("已提交,请勿再次提交;");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
|
+
|
|
|
|
+ return Result.error(sb.toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //执行入库操作
|
|
|
|
+ String result = actionIn(list,true);
|
|
|
|
+
|
|
|
|
+ if ("true".equals(result)) {
|
|
|
|
+
|
|
|
|
+ StorePurchaseOther ent = new StorePurchaseOther();
|
|
|
|
+ ent.setSubmit("1");
|
|
|
|
+ this.update(ent, queryWrapper);
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ return Result.error(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return Result.OK("提交成功!");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //执行入库操作
|
|
|
|
+ //type true增加库存 false减少库存
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public String actionIn(List<StorePurchaseOther> list,boolean type) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ for (StorePurchaseOther o : list) {
|
|
|
|
+
|
|
|
|
+ List<StorePurchaseOtherDetails> entList = storePurchaseOtherDetailsMapper.selectByMainId(o.getId());
|
|
|
|
|
|
- QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
|
|
|
+ for (StorePurchaseOtherDetails ent : entList) {
|
|
|
|
|
|
- List<StorePurchaseOther> list = this.list(queryWrapper);
|
|
|
|
- if (list.size() == 0) {
|
|
|
|
- return Result.error("数据为空!");
|
|
|
|
- }
|
|
|
|
|
|
+ StoreOnhand storeOnhand = new StoreOnhand();
|
|
|
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
|
- List<String> idList = new ArrayList<>();
|
|
|
|
- for (StorePurchaseOther o : list) {
|
|
|
|
- //提交(1-是 ,0-否)
|
|
|
|
- String submit = o.getSubmit();
|
|
|
|
- String code = o.getBillCode();
|
|
|
|
-
|
|
|
|
- if (submit == null || submit == "" || submit.equals("0")) {
|
|
|
|
- sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
|
-
|
|
|
|
- return Result.error(sb.toString());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- QueryWrapper<StoreOnhand> queryWrapper2 = new QueryWrapper<>();
|
|
|
|
- queryWrapper2.in("source_code", idList);
|
|
|
|
- queryWrapper2.last(" and quantity != initial_quantity ");
|
|
|
|
- List<StoreOnhand> listNum = storeOnhandService.list(queryWrapper2);
|
|
|
|
- if(listNum.size() > 0){
|
|
|
|
- return Result.error("单号" + listNum.get(0).getBatchCode()+"库存已被使用,无法取消提交;");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
|
-
|
|
|
|
- return Result.error(sb.toString());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- StorePurchaseOther ent = new StorePurchaseOther();
|
|
|
|
- ent.setSubmit("0");
|
|
|
|
- this.update(ent, queryWrapper);
|
|
|
|
-
|
|
|
|
- return Result.OK("取消提交成功!");
|
|
|
|
- }
|
|
|
|
|
|
+ storeOnhand.setWarehouse(o.getWarehouse());//仓库
|
|
|
|
+// storeOnhand.setWarehouseName();//仓库名称
|
|
|
|
+ storeOnhand.setGoodsAllocation(o.getGoodsAllocation());//货位
|
|
|
|
+ storeOnhand.setProject(o.getProject());//项目
|
|
|
|
+ storeOnhand.setProjectName(o.getProjectName());//项目
|
|
|
|
+ storeOnhand.setSupplier(o.getSupplier());//供应商
|
|
|
|
+ storeOnhand.setSupplierName(o.getSupplierName());//供应商
|
|
|
|
+ storeOnhand.setProductionClass(o.getProductionClass());//产品分类
|
|
|
|
+ storeOnhand.setProductionClassName(ent.getProductClass());//产品分类
|
|
|
|
+ storeOnhand.setMaker(o.getMaker());//厂家
|
|
|
|
+
|
|
|
|
+ storeOnhand.setProductId(ent.getProductId());//产品
|
|
|
|
+ storeOnhand.setChineseName(ent.getChineseName());//产品
|
|
|
|
+ storeOnhand.setEnglishName(ent.getEnglishName());//产品
|
|
|
|
+ storeOnhand.setSpecifications(ent.getSpecifications());//规格
|
|
|
|
+ storeOnhand.setModel(ent.getModel());//型号
|
|
|
|
+ storeOnhand.setPartno(ent.getPartno());//备件号
|
|
|
|
+ storeOnhand.setDrawingno(ent.getDrawingno());//图号
|
|
|
|
+// storeOnhand.setOrderno(ent.setOrderno());//
|
|
|
|
+ storeOnhand.setFactory(ent.getFactory());//厂家
|
|
|
|
+ storeOnhand.setQualityGrade(ent.getQualityGrade());//质量等级
|
|
|
|
+ storeOnhand.setQuantity(ent.getStockInQuantity());//入库数量
|
|
|
|
+ storeOnhand.setInitialQuantity(ent.getStockInQuantity());//初始数量
|
|
|
|
+ storeOnhand.setSourceId(ent.getId());//记录来源id
|
|
|
|
+ storeOnhand.setSourceCode(o.getBillCode());//记录来源code
|
|
|
|
+ storeOnhand.setStoreDate(o.getBillDate());//记录来源单据入库日期
|
|
|
|
+
|
|
|
|
+ if(type){
|
|
|
|
+
|
|
|
|
+ //增加库存
|
|
|
|
+ storeOnhandService.addStore(storeOnhand, "其他入库");
|
|
|
|
+ }else{
|
|
|
|
+ //减少库存
|
|
|
|
+ storeOnhandService.deleteStore(storeOnhand, "其他入库");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return e.getMessage();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return "true";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Result<String> returnSubmitBatch(String ids) {
|
|
|
|
+
|
|
|
|
+ QueryWrapper<StorePurchaseOther> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.in("id", Arrays.asList(ids.split(",")));
|
|
|
|
+
|
|
|
|
+ List<StorePurchaseOther> list = this.list(queryWrapper);
|
|
|
|
+ if (list.size() == 0) {
|
|
|
|
+ return Result.error("数据为空!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
|
+ List<String> idList = new ArrayList<>();
|
|
|
|
+ for (StorePurchaseOther o : list) {
|
|
|
|
+ //提交(1-是 ,0-否)
|
|
|
|
+ String submit = o.getSubmit();
|
|
|
|
+ String code = o.getBillCode();
|
|
|
|
+
|
|
|
|
+ if (submit == null || submit == "" || submit.equals("0")) {
|
|
|
|
+ sb.append("单号" + code).append("已取消提交,请勿再次取消提交;");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotBlank(sb.toString())) {
|
|
|
|
+
|
|
|
|
+ return Result.error(sb.toString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //执行入库操作
|
|
|
|
+ String result = actionIn(list,false);
|
|
|
|
+
|
|
|
|
+ if ("true".equals(result)) {
|
|
|
|
+
|
|
|
|
+ StorePurchaseOther ent = new StorePurchaseOther();
|
|
|
|
+ ent.setSubmit("0");
|
|
|
|
+ this.update(ent, queryWrapper);
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ return Result.error(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.OK("取消提交成功!");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|