新增药液管理
parent
1895ebc6d2
commit
61b66b1980
@ -0,0 +1,75 @@
|
|||||||
|
package com.op.plan.controller;
|
||||||
|
|
||||||
|
import com.op.common.core.domain.R;
|
||||||
|
import com.op.common.core.web.controller.BaseController;
|
||||||
|
import com.op.common.core.web.domain.AjaxResult;
|
||||||
|
import com.op.common.core.web.page.TableDataInfo;
|
||||||
|
import com.op.common.security.utils.SecurityUtils;
|
||||||
|
import com.op.plan.domain.MedicationDetailPo;
|
||||||
|
import com.op.plan.domain.MedicationPo;
|
||||||
|
import com.op.plan.domain.MedicationQuery;
|
||||||
|
import com.op.plan.service.IProMedicationService;
|
||||||
|
import com.op.system.api.model.SapProOrder;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/medication")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ProMedicationController extends BaseController {
|
||||||
|
|
||||||
|
private final IProMedicationService proMedicationService;
|
||||||
|
|
||||||
|
|
||||||
|
//同步药液订单
|
||||||
|
@PostMapping("/syncOrder")
|
||||||
|
public AjaxResult syncMedicationOrder(@RequestBody MedicationQuery query){
|
||||||
|
proMedicationService.syncMedicationOrder(query);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改药液订单
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult updateMedication(@RequestBody MedicationPo params){
|
||||||
|
params.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
proMedicationService.updateMedication(params);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo selectMedicationList(MedicationQuery query){
|
||||||
|
startPage();
|
||||||
|
List<MedicationPo> list = proMedicationService.selectMedicationList(query);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail/list")
|
||||||
|
public AjaxResult selectMedicationDetailList(MedicationQuery query){
|
||||||
|
List<MedicationDetailPo> list = proMedicationService.selectMedicationDetailList(query);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/detail/list")
|
||||||
|
public AjaxResult updateMedicationDetailList(@RequestBody List<MedicationDetailPo> list){
|
||||||
|
proMedicationService.updateMedicationDetailList(list);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/reportSapMedication")
|
||||||
|
public AjaxResult reportSapMedication(@RequestBody List<MedicationPo> params){
|
||||||
|
proMedicationService.reportSapMedication(params);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.op.plan.domain;
|
||||||
|
|
||||||
|
import com.op.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MedicationDetailPo extends BaseEntity {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
private String itemCode;
|
||||||
|
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
private String productionDate;
|
||||||
|
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
private String inputAmount;
|
||||||
|
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
private String backFlag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package com.op.plan.domain;
|
||||||
|
|
||||||
|
import com.op.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MedicationPo extends BaseEntity {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
private String workOrderCode;
|
||||||
|
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
private String reportAmount;
|
||||||
|
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String productionDate;
|
||||||
|
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
private Date sapTime;
|
||||||
|
|
||||||
|
private String sapRemark;
|
||||||
|
|
||||||
|
private String realAmount;
|
||||||
|
|
||||||
|
private String workTime;
|
||||||
|
|
||||||
|
private String useNum;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.op.plan.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MedicationQuery {
|
||||||
|
|
||||||
|
|
||||||
|
//订单号
|
||||||
|
private String workOrderCode;
|
||||||
|
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
//开始时间
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
//结束时间
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
//生产日期
|
||||||
|
private String proDate;
|
||||||
|
|
||||||
|
//物料编码
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
//工厂
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.op.plan.mapper;
|
||||||
|
|
||||||
|
import com.op.plan.domain.MedicationDetailPo;
|
||||||
|
import com.op.plan.domain.MedicationQuery;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
public interface ProMedicationDetailMapper {
|
||||||
|
|
||||||
|
void batchInsertMedicationDetail(List<MedicationDetailPo> po);
|
||||||
|
|
||||||
|
List<MedicationDetailPo> selectMedicationDetailList(MedicationQuery query);
|
||||||
|
|
||||||
|
void batchUpdateMedicationDetail( @Param("list") List<MedicationDetailPo> list, @Param("updateBy") String updateBy);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.op.plan.mapper;
|
||||||
|
|
||||||
|
import com.op.plan.domain.MedicationPo;
|
||||||
|
import com.op.plan.domain.MedicationQuery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
public interface ProMedicationMapper {
|
||||||
|
|
||||||
|
void insertMedication(MedicationPo po);
|
||||||
|
|
||||||
|
void updateMedication(MedicationPo po);
|
||||||
|
|
||||||
|
List<MedicationPo> selectMedicationList(MedicationQuery po);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.op.plan.service;
|
||||||
|
|
||||||
|
import com.op.plan.domain.MedicationDetailPo;
|
||||||
|
import com.op.plan.domain.MedicationPo;
|
||||||
|
import com.op.plan.domain.MedicationQuery;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remark
|
||||||
|
*
|
||||||
|
* @author 019117
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
public interface IProMedicationService {
|
||||||
|
|
||||||
|
void syncMedicationOrder(MedicationQuery query);
|
||||||
|
|
||||||
|
void updateMedication(MedicationPo params);
|
||||||
|
|
||||||
|
List<MedicationPo> selectMedicationList(MedicationQuery query);
|
||||||
|
|
||||||
|
List<MedicationDetailPo> selectMedicationDetailList(MedicationQuery query);
|
||||||
|
|
||||||
|
void updateMedicationDetailList(List<MedicationDetailPo> list);
|
||||||
|
|
||||||
|
void reportSapMedication(List<MedicationPo> params);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.op.plan.mapper.ProMedicationDetailMapper">
|
||||||
|
|
||||||
|
<insert id="batchInsertMedicationDetail" parameterType="com.op.plan.domain.MedicationDetailPo">
|
||||||
|
insert into pro_medication_order_detail (order_code, item_code, material_code, material_name, factory, location, production_date, amount, input_amount, unit, back_flag, create_by, create_time)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
|
(#{item.orderCode}, #{item.itemCode}, #{item.materialCode}, #{item.materialName},
|
||||||
|
#{item.factory}, #{item.location}, #{item.productionDate}, #{item.amount}, #{item.inputAmount},
|
||||||
|
#{item.unit}, #{item.backFlag}, #{item.createBy}, GETDATE())
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectMedicationDetailList" parameterType="com.op.plan.domain.MedicationQuery" resultType="com.op.plan.domain.MedicationDetailPo">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
order_code as orderCode,
|
||||||
|
item_code as itemCode,
|
||||||
|
material_code as materialCode,
|
||||||
|
material_name as materialName,
|
||||||
|
factory,
|
||||||
|
location,
|
||||||
|
production_date as productionDate,
|
||||||
|
amount,
|
||||||
|
input_amount as inputAmount,
|
||||||
|
unit,
|
||||||
|
back_flag as backFlag
|
||||||
|
from pro_medication_order_detail
|
||||||
|
<where>
|
||||||
|
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
|
||||||
|
<if test="materialCode != null and materialCode != ''">and material_code like concat('%', #{materialCode}, '%')</if>
|
||||||
|
</where>
|
||||||
|
order by item_code
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="batchUpdateMedicationDetail" parameterType="com.op.plan.domain.MedicationDetailPo">
|
||||||
|
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||||
|
update pro_medication_order_detail
|
||||||
|
<set>
|
||||||
|
<if test="item.inputAmount != null">input_amount = #{item.inputAmount},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
update_time = GETDATE()
|
||||||
|
</set>
|
||||||
|
where id = #{item.id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.op.plan.mapper.ProMedicationMapper">
|
||||||
|
|
||||||
|
<insert id="insertMedication" parameterType="com.op.plan.domain.MedicationPo">
|
||||||
|
INSERT INTO pro_medication_order
|
||||||
|
(work_order_code , order_code, factory, material_code , material_name , amount , report_amount , unit , status , production_date , create_by , create_time)
|
||||||
|
VALUES
|
||||||
|
(#{workOrderCode}, #{orderCode}, #{factory}, #{materialCode}, #{materialName}, #{amount}, #{reportAmount}, #{unit}, #{status}, #{productionDate}, #{createBy}, GETDATE())
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateMedication" parameterType="com.op.plan.domain.MedicationPo">
|
||||||
|
UPDATE pro_medication_order
|
||||||
|
SET
|
||||||
|
<if test="amount != null and amount != ''">
|
||||||
|
amount = #{amount},
|
||||||
|
</if>
|
||||||
|
<if test="reportAmount != null and reportAmount != ''">
|
||||||
|
report_amount = #{reportAmount},
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
status = #{status},
|
||||||
|
</if>
|
||||||
|
<if test="sapTime != null">
|
||||||
|
sap_time = #{sapTime},
|
||||||
|
</if>
|
||||||
|
<if test="sapRemark != null and sapRemark != ''">
|
||||||
|
sap_remark = #{sapRemark},
|
||||||
|
</if>
|
||||||
|
<if test="realAmount != null and realAmount != ''">
|
||||||
|
real_amount = #{realAmount},
|
||||||
|
</if>
|
||||||
|
<if test="workTime != null and workTime != ''">
|
||||||
|
work_time = #{workTime},
|
||||||
|
</if>
|
||||||
|
<if test="useNum != null and useNum != ''">
|
||||||
|
use_num = #{useNum},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
update_by = #{updateBy},
|
||||||
|
</if>
|
||||||
|
update_time = GETDATE()
|
||||||
|
WHERE id = #{id}
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectMedicationList" parameterType="com.op.plan.domain.MedicationQuery" resultType="com.op.plan.domain.MedicationPo">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
work_order_code workOrderCode,
|
||||||
|
order_code orderCode,
|
||||||
|
material_code materialCode,
|
||||||
|
material_name materialName,
|
||||||
|
amount ,
|
||||||
|
report_amount reportAmount,
|
||||||
|
unit ,
|
||||||
|
status ,
|
||||||
|
production_date productionDate,
|
||||||
|
sap_time sapTime,
|
||||||
|
sap_remark sapRemark,
|
||||||
|
work_time workTime,
|
||||||
|
use_num useNum,
|
||||||
|
real_amount realAmount
|
||||||
|
FROM pro_medication_order
|
||||||
|
<where>
|
||||||
|
<if test="workOrderCode != null and workOrderCode != ''">
|
||||||
|
AND work_order_code like CONCAT('%', #{workOrderCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="materialCode != null and materialCode != ''">
|
||||||
|
AND material_code like CONCAT('%', #{materialCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="orderCode != null and orderCode != ''">
|
||||||
|
AND order_code like CONCAT('%', #{orderCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="proDate != null and proDate != ''">
|
||||||
|
AND production_date = #{proDate}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by production_date desc
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue