Merge branch 'dev' of http://192.168.50.149:8085/r/aps-backend into dev
| | |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @Builder |
| | | |
| | | public class ApsBom extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @Builder |
| | | public class ApsStandardProcessRouteLine extends BaseEntity |
| | | { |
| | | @Serial |
| | |
| | | public int deleteApsMaterialStorageManagementByIds(String[] ids); |
| | | |
| | | |
| | | int updateMaterialStorageByVersion(BigDecimal remainderStock, Integer version); |
| | | int updateMaterialStorageByVersion(String id, BigDecimal remainderStock, Integer version); |
| | | |
| | | /** |
| | | * 初始化剩余库存数量 |
| | |
| | | Optional<ApsBomHeader> first = bomHeaderMapper.selectApsBomHeaderList(headerParam).stream().findFirst(); |
| | | if (first.isPresent()){ |
| | | ApsBomHeader apsBomHeader = first.get(); |
| | | bomLineList = apsBomMapper.selectApsBomLineList(plant, apsBomHeader.getBomHeaderId()); |
| | | ApsBom build = new ApsBom(); |
| | | build.setBomHeaderId(apsBomHeader.getBomHeaderId()); |
| | | build.setOrgCode(apsBomHeader.getOrgCode()); |
| | | List<ApsBom> apsBoms = apsBomMapper.selectApsBomList(build); |
| | | return apsBoms; |
| | | } |
| | | return bomLineList; |
| | | } |
| | |
| | | @Override |
| | | public void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount,Long requireId){ |
| | | /*更新物料剩余库存*/ |
| | | itemStorageMapper.updateMaterialStorageByVersion(afterStockAmount,itemStorage.getVersion()); |
| | | itemStorageMapper.updateMaterialStorageByVersion(itemStorage.getId(), afterStockAmount,itemStorage.getVersion()); |
| | | /*记录扣减明细*/ |
| | | ApsPlateStandardRequireBomStockDetail bomStockDetail = ApsPlateStandardRequireBomStockDetail.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | |
| | | /*定义工厂为南通 */ |
| | | String plantCode="FORTUNA"; |
| | | /*定义主单类型为钣金主单*/ |
| | | String mainOrderType = "钣金主件"; |
| | | String mainOrderType = "0"; |
| | | /*生成新批次号*/ |
| | | String batchNum= requireBatchService.getNewBatchNumber(); |
| | | /*获取钣金主单信息*/ |
| | |
| | | require.setStartDate(startDay); |
| | | |
| | | /*计算是否有风险*/ |
| | | require.setHasDelayRisk("无风险"); |
| | | require.setHasDelayRisk("0"); |
| | | Date dateZero = getDateZero(DateUtils.getNowDate()); |
| | | if (startDay.before(dateZero)) { |
| | | require.setHasDelayRisk("有风险"); |
| | | require.setHasDelayRisk("1"); |
| | | } |
| | | |
| | | /*生产基地*/ |
| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsPlateStandardRequire; |
| | |
| | | // 物料号 |
| | | String itemNumber=require.getBomLineCode(); |
| | | long routId=0L; |
| | | ApsStandardProcessRouteLine ret=ApsStandardProcessRouteLine.builder() |
| | | .routeId(String.valueOf(routId)) |
| | | .routeTime(BigDecimal.ZERO) |
| | | .build(); |
| | | ApsStandardProcessRouteLine ret=new ApsStandardProcessRouteLine(); |
| | | ret.setRouteId(String.valueOf(routId)); |
| | | ret.setRouteTime(BigDecimal.ZERO); |
| | | |
| | | // 查询标准工艺路线头部信息 |
| | | Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemNumber).stream().findFirst(); |
| | | if (firstProcessRoute.isPresent()) { |
| | | ApsStandardProcessRouteHeader routeHeader = firstProcessRoute.get(); |
| | | // 构建工艺路线行参数对象 |
| | | ApsStandardProcessRouteLine routeLineParam = ApsStandardProcessRouteLine.builder() |
| | | .routeId(routeHeader.getRouteId()) |
| | | .build(); |
| | | ApsStandardProcessRouteLine routeLineParam =new ApsStandardProcessRouteLine(); |
| | | routeLineParam.setRouteId(routeHeader.getRouteId()); |
| | | |
| | | // 查询标准工艺路线行信息 |
| | | List<ApsStandardProcessRouteLine> apsStandardProcessRouteLines = apsStandardProcessRouteLineMapper.selectApsStandardProcessRouteLineList(routeLineParam); |
| | | /*工艺路线Line 总工时*/ |
| | |
| | | |
| | | private void saveRequireError(ApsPlateStandardRequire require,String message) { |
| | | ApsPlateStandardRequireError data = ApsPlateStandardRequireError.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | | .requireId(require.getId()) |
| | | .batchNumber(require.getBatchNumber()) |
| | | .docNum(require.getDocNum()) |
| | |
| | | </delete> |
| | | |
| | | <resultMap type="ApsBom" id="ApsBomLineResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="bomLineId" column="bom_line_id" /> |
| | | <result property="itemCode" column="item_code" /> |
| | | <result property="itemName" column="item_name" /> |
| | | <result property="num" column="num" /> |
| | | </resultMap> |
| | | <sql id="selectApsBomLineVo"> |
| | | select bom_line_id, item_code, item_name, num |
| | | select id, bom_line_id, item_code, item_name, num |
| | | from aps_bom_line |
| | | </sql> |
| | | |
| | | <select id="selectApsBomLineList" parameterType="ApsBom" resultMap="ApsBomLineResult"> |
| | | <include refid="selectApsBomLineVo"/> |
| | | <where> |
| | | <if test="bomHeaderId != null and bomHeaderId != ''"> and bom_header_id = #{bomHeaderId}</if> |
| | | <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> |
| | | and del_flag='0' |
| | | </where> |
| | | order by bom_header_id,bom_line_id |
| | | <select id="selectApsBomLineList" parameterType="String" resultMap="ApsBomLineResult"> |
| | | select id, bom_line_id, item_code, num |
| | | from aps_bom_line where del_flag='0' |
| | | and org_code = #{orgCode} |
| | | and bom_header_id = #{bomHeaderId} |
| | | order by bom_line_id |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <sql id="selectApsMaterialStorageManagementVo"> |
| | | select id, item_number, num, applicable_factories, integration_date, refresh_date, create_by, |
| | | create_time, update_by, update_time ,remainderStock,version |
| | | create_time, update_by, update_time ,remainder_stock,version |
| | | from aps_material_storage_management |
| | | </sql> |
| | | |
| | |
| | | </update> |
| | | |
| | | <select id="selectPlatePlanByPlantMajor" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id |
| | | select id,document_number,plan_end_day, main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id |
| | | from aps_plate_plan |
| | | <where> |
| | | <if test="plant != null "> and plant = #{plant}</if> |
| | |
| | | |
| | | <select id="selectUnMatchPlateSubPlan" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity, |
| | | ,unmatched_quantity |
| | | unmatched_quantity |
| | | from aps_plate_plan |
| | | where del_flag='0' and professional_affiliation !='0' and unmatched_quantity > 0 |
| | | <if test="plant != null and plan !='' "> and plant = #{plant}</if> |
| | |
| | | |
| | | <update id="updatePlanUnMatchQtyByVersion" parameterType="ApsPlatePlan"> |
| | | update aps_plate_plan |
| | | set unmatched_quantity=#{unmatched_quantity},version=version+1 |
| | | set unmatched_quantity=#{unmatchedQuantity},version=version+1 |
| | | where id=#{id} and version=#{version} |
| | | </update> |
| | | <select id="selectPlateRedundantOrderList" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | |
| | | (id, require_track_id,doc_num,batch_number, org_code, bom_line_id, bom_line_code, bom_line_level, bom_use_amount, process_route_id, |
| | | process_route_hours, require_amount, net_requirement, start_date, complete_date, demand_date, |
| | | production_base, match_state, match_mode, unmatched_demand_amount, suggested_completion_date, |
| | | has_delay_risk, batch_number, del_flag, create_time, create_by) |
| | | has_delay_risk, del_flag, create_time, create_by) |
| | | values |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.Id}, |
| | | #{item.id}, |
| | | #{item.requireTrackId}, |
| | | #{item.docNum}, |
| | | #{item.batchNumber}, |
| | |
| | | #{item.unmatchedDemandAmount}, |
| | | #{item.suggestedCompletionDate}, |
| | | #{item.hasDelayRisk}, |
| | | #{item.batchNumber}, |
| | | #{item.delFlag}, |
| | | #{item.createTime}, |
| | | #{item.createBy} |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsStandardProcessRouteLineVo"> |
| | | select id, route_id, route_num, route_name, start_date, end_date, create_time, org_code, shop_code, productivity_model, design_capacity, del_flag, create_by, update_by, update_time from aps_standard_process_route_line |
| | | select id, route_id, route_num, route_name, start_date, end_date, create_time, org_code, |
| | | shop_code, productivity_model, design_capacity, del_flag, create_by, update_by, |
| | | update_time |
| | | from aps_standard_process_route_line |
| | | </sql> |
| | | |
| | | <select id="selectApsStandardProcessRouteLineList" parameterType="ApsStandardProcessRouteLine" resultMap="ApsStandardProcessRouteLineResult"> |