不发货的逻辑修改
This commit is contained in:
parent
f155882fe2
commit
9466cb078d
|
|
@ -251,6 +251,19 @@ public class PurchaseController {
|
|||
return service.getPurchaseDetails(dto.getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购详情查看
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getPurchaseDetail")
|
||||
@DecryptAndVerify(decryptedClass = OutPlanVo.class)
|
||||
public ServerResponse getPurchaseDetail(EncryptedReq<OutPlanVo> dto) {
|
||||
return service.getPurchaseDetail(dto.getData());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("deleteDetail/{id}")
|
||||
public AjaxResult deleteDetail(@PathVariable Long id) {
|
||||
return service.deleteDetail(id);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.aqgqj.business.backstage.entity;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2026/2/6
|
||||
*/
|
||||
@Data
|
||||
public class OutBatchVo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer applyId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private Date createDate;
|
||||
|
||||
private String cgNum;
|
||||
|
||||
private String lkNum;
|
||||
|
||||
private String modelId;
|
||||
|
||||
private String supId;
|
||||
}
|
||||
|
|
@ -127,4 +127,9 @@ public class OutPlanVo extends ParentVo {
|
|||
* 派车状态 0 为派车 1已派车
|
||||
*/
|
||||
private String outStatus;
|
||||
|
||||
private List<OutPlanVo> outPlanVoList;
|
||||
|
||||
|
||||
private String uuid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class OutPlanVoDetails {
|
|||
|
||||
private String supName;
|
||||
|
||||
|
||||
private String uuid;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,4 +99,6 @@ public class OutPlanVoSupInfo {
|
|||
|
||||
private String status;
|
||||
|
||||
private String uuid;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.aqgqj.business.backstage.mapper;
|
||||
|
||||
import com.bonus.aqgqj.business.backstage.entity.MaTypeVo;
|
||||
import com.bonus.aqgqj.business.backstage.entity.OutBatchVo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -100,4 +101,8 @@ public interface MaTypeMapper {
|
|||
* @param maTypeVo
|
||||
*/
|
||||
void updateMatypeNum(MaTypeVo maTypeVo);
|
||||
}
|
||||
|
||||
int insertOutBatchData(OutBatchVo outBatchVo);
|
||||
|
||||
void updateOutBatchData(OutBatchVo batchVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,4 +252,9 @@ public interface PurchaseMapper {
|
|||
* @return
|
||||
*/
|
||||
int delStPlanOutSupData(String id);
|
||||
|
||||
|
||||
List<OutPlanVo> getOutBatchList(OutPlanVo vo);
|
||||
|
||||
OutPlanVo getPurchaseDetail(OutPlanVo data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,4 +138,6 @@ public interface PurchaseService {
|
|||
* @return
|
||||
*/
|
||||
ServerResponse addPurchaseDataBySupplementAndTemporary(HttpServletRequest request, MultipartFile[] files);
|
||||
|
||||
ServerResponse getPurchaseDetail(OutPlanVo data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,10 +326,11 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
return ServerResponse.createErroe("文件上传失败!");
|
||||
}
|
||||
}
|
||||
|
||||
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
for (OutPlanVoDetails details : detailsList) {
|
||||
details.setOutId(outPlanVo.getId());
|
||||
int num = mapper.insertPurchaseDetailsData(details);
|
||||
|
||||
if (num != 1) {
|
||||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
}
|
||||
|
|
@ -341,10 +342,20 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
info.setSupId("10086");
|
||||
info.setSupName("库存发出");
|
||||
}
|
||||
}
|
||||
int succ = mapper.insertPurchaseDetailsSupData(details, supInfoList);
|
||||
if (succ != supInfoList.size()) {
|
||||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
info.setProId(details.getProId());
|
||||
info.setOutId(details.getOutId());
|
||||
info.setDetailsId(details.getId());
|
||||
mapper.insertStPlanOutSupData(info);
|
||||
OutBatchVo batchVo = new OutBatchVo();
|
||||
batchVo.setApplyId(Integer.valueOf(outPlanVo.getId()));
|
||||
batchVo.setCgNum(details.getCgNum());
|
||||
batchVo.setLkNum(details.getLkNum());
|
||||
batchVo.setCreateDate(new Date());
|
||||
batchVo.setUuid(uuid);
|
||||
batchVo.setModelId(details.getModelId());
|
||||
batchVo.setSupId(info.getId());
|
||||
maTypeMapper.insertOutBatchData(batchVo);
|
||||
|
||||
}
|
||||
//更新需求
|
||||
mapper.updatePlanDetails(details);
|
||||
|
|
@ -375,6 +386,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ServerResponse addUnplannedPurchaseData(HttpServletRequest request, MultipartFile[] files) {
|
||||
try {
|
||||
String params = request.getParameter("params");
|
||||
|
|
@ -492,7 +504,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
for (OutPlanVoDetails details : detailsList) {
|
||||
details.setOutId(outPlanVo.getId());
|
||||
details.setDetailId(String.valueOf(planApplyVo.getId()));
|
||||
|
|
@ -508,10 +520,19 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
info.setSupId("10086");
|
||||
info.setSupName("库存发出");
|
||||
}
|
||||
}
|
||||
int succ = mapper.insertPurchaseDetailsSupData(details, supInfoList);
|
||||
if (succ != supInfoList.size()) {
|
||||
return ServerResponse.createErroe("新增失败数据异常,请稍后重试");
|
||||
info.setProId(details.getProId());
|
||||
info.setOutId(details.getOutId());
|
||||
info.setDetailsId(details.getId());
|
||||
mapper.insertStPlanOutSupData(info);
|
||||
OutBatchVo batchVo = new OutBatchVo();
|
||||
batchVo.setApplyId(planApplyVo.getId());
|
||||
batchVo.setCgNum(details.getCgNum());
|
||||
batchVo.setLkNum(details.getLkNum());
|
||||
batchVo.setCreateDate(new Date());
|
||||
batchVo.setUuid(uuid);
|
||||
batchVo.setModelId(details.getModelId());
|
||||
batchVo.setSupId(info.getId());
|
||||
maTypeMapper.insertOutBatchData(batchVo);
|
||||
}
|
||||
|
||||
//更新库存
|
||||
|
|
@ -524,6 +545,9 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
maTypeVo.setStorageNum("0");
|
||||
}
|
||||
maTypeMapper.updateMatype(maTypeVo);
|
||||
|
||||
|
||||
|
||||
}
|
||||
//跟新计划
|
||||
mapper.updatePlanData(outPlanVo);
|
||||
|
|
@ -688,6 +712,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
return ServerResponse.createErroe("文件上传失败!");
|
||||
}
|
||||
}
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
//
|
||||
for (OutPlanVoDetails details : detailsList) {
|
||||
details.setOutId(outPlanVo.getId());
|
||||
|
|
@ -705,14 +730,26 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
}
|
||||
// 是空的就需要新增
|
||||
if (StringHelper.isEmpty(outSup.getId()) || "undefined".equals(outSup.getId())) {
|
||||
List<OutPlanVoSupInfo> addList = new ArrayList<>();
|
||||
addList.add(outSup);
|
||||
int succ = mapper.insertPurchaseDetailsSupData(details, addList);
|
||||
if (succ != supInfoList.size()) {
|
||||
return ServerResponse.createErroe("新增厂商异常,请稍后重试");
|
||||
}
|
||||
outSup.setProId(details.getProId());
|
||||
outSup.setOutId(details.getOutId());
|
||||
outSup.setId(details.getId());
|
||||
mapper.insertStPlanOutSupData(outSup);
|
||||
OutBatchVo batchVo = new OutBatchVo();
|
||||
batchVo.setApplyId(Integer.valueOf(details.getPlanId()));
|
||||
batchVo.setCgNum(details.getCgNum());
|
||||
batchVo.setLkNum(details.getLkNum());
|
||||
batchVo.setCreateDate(new Date());
|
||||
batchVo.setUuid(uuid);
|
||||
batchVo.setModelId(details.getModelId());
|
||||
batchVo.setSupId(outSup.getSupId());
|
||||
maTypeMapper.insertOutBatchData(batchVo);
|
||||
} else {
|
||||
int succ = mapper.updatePurchaseDetailsSupData(outSup);
|
||||
OutBatchVo batchVo = new OutBatchVo();
|
||||
batchVo.setSupId(outSup.getSupId());
|
||||
batchVo.setCgNum(String.valueOf(outSup.getCgNum()));
|
||||
batchVo.setLkNum(String.valueOf(outSup.getLkNum()));
|
||||
maTypeMapper.updateOutBatchData(batchVo);
|
||||
if (succ != 1) {
|
||||
return ServerResponse.createErroe("修改厂商异常,请稍后重试");
|
||||
}
|
||||
|
|
@ -819,6 +856,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
}
|
||||
String createTime = DateTimeHelper.getNowTime();
|
||||
int delNum = mapper.delStPlanOutSupData(outPlanVo.getId());
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
for (OutPlanVoDetails details : detailsList) {
|
||||
String detailId=details.getId();
|
||||
List<OutPlanVoSupInfo> supInfoList = details.getSupList();
|
||||
|
|
@ -835,6 +873,15 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
outSup.setCreateTime(createTime);
|
||||
outSup.setStatus("1");
|
||||
int succ = mapper.insertStPlanOutSupData(outSup);
|
||||
OutBatchVo batchVo = new OutBatchVo();
|
||||
batchVo.setApplyId(Integer.valueOf(outPlanVo.getPlanId()));
|
||||
batchVo.setCgNum(details.getCgNum());
|
||||
batchVo.setLkNum(details.getLkNum());
|
||||
batchVo.setCreateDate(new Date());
|
||||
batchVo.setUuid(uuid);
|
||||
batchVo.setModelId(details.getModelId());
|
||||
batchVo.setSupId(outSup.getId());
|
||||
maTypeMapper.insertOutBatchData(batchVo);
|
||||
if (succ < 1) {
|
||||
throw new Exception("添加数据失败");
|
||||
}
|
||||
|
|
@ -890,6 +937,7 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
OutPlanVo outPlanVo = mapper.getPurchaseDetails(data);
|
||||
OutPlanVoDetails details = new OutPlanVoDetails();
|
||||
details.setOutId(outPlanVo.getId());
|
||||
details.setUuid(data.getUuid());
|
||||
List<OutPlanVoDetails> detailsList = mapper.getPurchaseDetailsListByBatch(details);
|
||||
details.setBatchList(detailsList);
|
||||
list.add(details);
|
||||
|
|
@ -1000,6 +1048,28 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
return ServerResponse.createErroe("保存失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerResponse getPurchaseDetail(OutPlanVo data) {
|
||||
try {
|
||||
OutPlanVo vo = mapper.getPurchaseDetail(data);
|
||||
OutPlanVo outPlanVo = new OutPlanVo();
|
||||
outPlanVo.setId(vo.getId());
|
||||
String money = mapper.getPlanOutMoney(data);
|
||||
vo.setMoney(money);
|
||||
//文件
|
||||
List<FileUploadVo> flieList = uploadService.getFileList(vo.getId(), "st_plan_out", null);
|
||||
vo.setFileList(flieList);
|
||||
//供应商 统计
|
||||
|
||||
List<SupInfo> supList = mapper.getSupListData(outPlanVo);
|
||||
vo.setSupInfoList(supList);
|
||||
return ServerResponse.createSuccess(vo);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
}
|
||||
return ServerResponse.createErroe("请求失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteDetail(Long id) {
|
||||
try {
|
||||
|
|
@ -1361,6 +1431,8 @@ public class PurchaseServiceImpl implements PurchaseService {
|
|||
try {
|
||||
OutPlanVo vo = mapper.getPurchaseDetails(data);
|
||||
OutPlanVo outPlanVo = new OutPlanVo();
|
||||
List<OutPlanVo> OutPlanVos = mapper.getOutBatchList(vo);
|
||||
vo.setOutPlanVoList(OutPlanVos);
|
||||
|
||||
outPlanVo.setId(vo.getId());
|
||||
String money = mapper.getPlanOutMoney(data);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@
|
|||
)values (#{parentId},#{name},0,#{unitName},0,#{remark},#{level},
|
||||
#{cycle},#{creator},now(),#{updater},now())
|
||||
</insert>
|
||||
<insert id="insertOutBatchData">
|
||||
insert into st_out_batch(
|
||||
apply_id, uuid, create_date,model_id,lk_num, cg_num,sup_id
|
||||
)values (#{applyId},#{uuid},#{createDate},#{modelId},#{lkNum},#{cgNum},#{supId})
|
||||
</insert>
|
||||
<update id="updateStatus">
|
||||
update st_ma_type set is_active=#{isActive},remark=#{remark},updater=#{updater},update_time=now()
|
||||
where id=#{id}
|
||||
|
|
@ -34,6 +39,9 @@
|
|||
<update id="updateMatypeNum">
|
||||
update st_ma_type set storage_num=#{num} ,dbf_num=#{dbfNum} where id=#{id}
|
||||
</update>
|
||||
<update id="updateOutBatchData">
|
||||
update st_out_batch set lk_num=#{lkNum},cg_num=#{cgNum} where sup_id=#{supId}
|
||||
</update>
|
||||
<delete id="deleteData">
|
||||
delete from st_ma_type where id=#{id}
|
||||
</delete>
|
||||
|
|
@ -135,4 +143,4 @@
|
|||
from st_ma_type
|
||||
where id=#{modelId} and level='3'
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -49,17 +49,18 @@
|
|||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertPurchaseDetailsSupData">
|
||||
<insert id="insertPurchaseDetailsSupData" >
|
||||
insert into st_plan_out_sup(
|
||||
contract_id, out_id, pro_id, details_id,
|
||||
sup_id, model_id, cg_num, lk_num, sup_name, cc_day, jy_day, remark
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.contractId},#{param.outId},#{param.proId},#{param.id},#{item.supId},
|
||||
#{item.modelId},#{item.cgNum},#{item.lkNum},#{item.supName},#{item.ccDay},#{item.jyDay},#{item.remark})
|
||||
#{item.modelId},#{item.cgNum},#{item.lkNum},#{item.supName},#{item.ccDay},#{item.jyDay},#{item.remark}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertStPlanOutSupData">
|
||||
<insert id="insertStPlanOutSupData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into st_plan_out_sup(contract_id, out_id, pro_id, details_id,
|
||||
sup_id, model_id, cg_num, lk_num, sup_name, cc_day, jy_day, remark,
|
||||
<if test="status!=null and status!=''">
|
||||
|
|
@ -74,6 +75,7 @@
|
|||
#{createTime})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updatePurchaseDetailsSupData">
|
||||
update st_plan_out_sup set contract_id=#{contractId},sup_id=#{supId},
|
||||
cg_num=#{cgNum},lk_num=#{lkNum},sup_name=#{supName},cc_day=#{ccDay},jy_day=#{jyDay},
|
||||
|
|
@ -297,10 +299,12 @@
|
|||
pos.lk_num lkNum,
|
||||
pos.lk_num historyLkNum,
|
||||
pos.id,
|
||||
pos.sup_id supId
|
||||
pos.sup_id supId,
|
||||
oub.uuid uuid
|
||||
from st_plan_out_sup pos
|
||||
left join st_contract_type sct on pos.sup_id = sct.supplier_id and
|
||||
pos.model_id = sct.model_id and pos.contract_id = sct.contract_id
|
||||
left join st_out_batch oub on pos.id=oub.sup_id
|
||||
where pos.details_id = #{id}
|
||||
and pos.status = '1'
|
||||
</select>
|
||||
|
|
@ -426,12 +430,16 @@
|
|||
FROM
|
||||
st_plan_out_sup spos
|
||||
LEFT JOIN st_plan_out_details spod on spos.details_id=spod.id
|
||||
left join st_out_batch sob on spos.id = sob.sup_id
|
||||
WHERE
|
||||
spos.out_id=#{outId}
|
||||
and spos.status='1'
|
||||
<if test="createTime!=null and createTime!=''">
|
||||
and spos.create_time=#{createTime}
|
||||
</if>
|
||||
<if test="uuid!=null and uuid!=''">
|
||||
and sob.uuid=#{uuid}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getPurchaseSupDetailsListBySupplement"
|
||||
resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVoSupInfo">
|
||||
|
|
@ -457,4 +465,18 @@
|
|||
where pos.details_id = #{id}
|
||||
ORDER BY pos.status
|
||||
</select>
|
||||
<select id="getOutBatchList" resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVo">
|
||||
SELECT sum(lk_num) as lkNum,
|
||||
sum(cg_num) as cgNum,
|
||||
uuid as uuid
|
||||
FROM st_out_batch WHERE apply_id=#{planId} GROUP BY uuid
|
||||
</select>
|
||||
<select id="getPurchaseDetail" resultType="com.bonus.aqgqj.business.backstage.entity.OutPlanVo">
|
||||
select spo.id,spo.apply_id planId,spo.out_time fhDay,spo.manager jbUser,spo.address,spa.`code` planCode ,
|
||||
spo.creator,spo.create_time createTime,spo.pro_id proId,spo.cg_num cgNum,spo.lk_num lkNum,spo.remark
|
||||
from st_plan_out spo
|
||||
LEFT JOIN st_plan_apply spa on spa.id=spo.apply_id
|
||||
left join st_out_batch sob on spo.apply_id=sob.apply_id
|
||||
WHERE spo.apply_id=#{id} and sob.uuid=#{uuid} GROUP BY sob.uuid
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue