jindie:同步字段完善
tdengine:增加drop table方法
mes:五楼下发柜体给工位时,校验下发工位的派工信息
master
xins 7 months ago
parent 7d6da1d87c
commit 1ea8d90839

@ -71,4 +71,6 @@ public interface RemoteTdEngineService {
@PostMapping("/tdengine/alterTableTags")
public R<?> alterTableTags(@Validated @RequestBody List<AlterTagVo> alterTagVos, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/tdengine/dropTable")
R<?> dropTable(@Validated @RequestBody TdTableDropVo tdTableDropVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -0,0 +1,27 @@
package com.hw.tdengine.api.domain;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* @Description: drop
* @ClassName: TdTableDropVo
* @Author : xins
* @Date :2024-04-20 11:09
* @Version :1.0
*/
@Data
public class TdTableDropVo {
//数据库名称
@NotEmpty(message="databaseName cannot be empty")
private String databaseName;
//子表名称
@NotEmpty(message="tableName cannot be empty")
private String tableName;
}

@ -113,6 +113,11 @@ public class RemoteTdEngineFallbackFactory implements FallbackFactory<RemoteTdEn
return R.fail("批量修改子表tag值失败:" + throwable.getMessage());
}
@Override
public R<?> dropTable(TdTableDropVo tdTableDropVo, String source) {
return R.fail("drop子表失败:" + throwable.getMessage());
}
};
}
}

@ -44,7 +44,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
String orderString = "";
int topRowCount = 0;
int startRow = 0;
int limit = 2000;
int limit = 100;
queryJson.put("FormId", formId);
queryJson.put("FieldKeys", fieldKeys);
queryJson.put("OrderString", orderString);
@ -77,13 +77,13 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
JSONObject queryJson = new JSONObject();
String formId = "BD_Material";
String fieldKeys = "FMaterialId,FNumber,FName,FBaseUnitId,FSpecification,FNETWEIGHT,FGROSSWEIGHT," +
"FCreateDate,FModifyDate,FApproveDate,FCreateOrgId,FUseOrgId";
"FCreateDate,FModifyDate,FApproveDate,FCreateOrgId,FUseOrgId,FPurchasePriceUnitId";
// String filterString = "FNumber='98010102'";
String filterString = "";
String orderString = "";
int topRowCount = 0;
int startRow = 0;
int limit = 23;
int limit = 99;
queryJson.put("FormId", formId);
queryJson.put("FieldKeys", fieldKeys);
queryJson.put("FilterString", filterString);
@ -179,12 +179,15 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
JSONObject queryJson = new JSONObject();
String formId = "SAL_SaleOrder";
String fieldKeys = "FID,FBillNo,FApproveDate,FSaleOrderEntry_FEntryID,FMaterialId.FNumber,FMaterialName,FQty,FModifyDate,FMinPlanDeliveryDate";
String fieldKeys = "FID,FBillNo,FApproveDate,FSaleOrderEntry_FEntryID,FMaterialId.FNumber,FMaterialName," +
"FQty,FModifyDate,FMinPlanDeliveryDate,FAuxPropId,FStockId,FOwnerId,FSaleDeptId,FPrice,FStockOrgId";
//
String filterString = "FNumber='98010102'";
filterString = "";
String orderString = "";
int topRowCount = 0;
int startRow = 0;
int limit = 2000;
int limit = 10;
queryJson.put("FormId", formId);
queryJson.put("FieldKeys", fieldKeys);
queryJson.put("FilterString", filterString);
@ -246,7 +249,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
JSONObject queryJson = new JSONObject();
String formId = "PUR_PurchaseOrder";
String fieldKeys = "FID,FBillNo,FApproveDate,FDocumentStatus,FPOOrderEntry_FEntryID,FMaterialId.FNumber,FMaterialId.FName,FQty,FDeliveryDate";
String fieldKeys = "FID,FBillNo,FApproveDate,FDocumentStatus,FPOOrderEntry_FEntryID,FMaterialId.FNumber,FMaterialId.FName," +
"FQty,FDeliveryDate,FUnitId,FStockUnitID,FPriceUnitID,FAuxPropId,FSrcBillNo,FPurchaseOrgId,F_TOND_Base,FSupplierId";
String filterString = "";
String orderString = "";
int topRowCount = 0;
@ -272,7 +276,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
// syncSupplierInfoFromErp();
// syncMaterialInfoFromErp();
// syncSaleOrderFromErp();
// syncPurchaseOrderFromErp();
syncPurchaseOrderFromErp();
// syncProjectInfoFromErp();
}

@ -94,4 +94,14 @@ public interface MesProductPlanMapper
* @return
*/
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan);
/**
*
*
* @param planCode ()
* @return
*/
public MesProductPlan selectOnlyMesProductPlanByPlanCode(String planCode);
}

@ -397,8 +397,30 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
throw new ServiceException("此物料条码已经下发,无需重复下发");
}
//下发工位判断有没有派工和完成情况
String planCode = mesBaseBarcodeInfo.getPlanCode();
MesProductPlan mesProductPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(planCode);
Long stationId = mesAssignTaskVo.getStationId();
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setProductOrderId(mesProductPlan.getProductOrderId());
queryProductPlan.setStationId(stationId);
List<MesProductPlan> mesProductPlanList = mesProductPlanMapper.selectMesProductPlanList(queryProductPlan);
if (mesProductPlanList == null || mesProductPlanList.isEmpty()) {
throw new ServiceException("此工位没有派工");
}
BigDecimal totalPlanAmount = mesProductPlanList.stream().map(MesProductPlan::getPlanAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
MesMaterialAssignInfo queryMaterialAssignInfo = new MesMaterialAssignInfo();
queryMaterialAssignInfo.setStationId(stationId);
List<MesMaterialAssignInfo> mesMaterialAssignInfoList = mesMaterialAssignInfoMapper.selectMesMaterialAssignInfoList(queryMesMaterialAssignInfo);
BigDecimal assignedAmount = mesMaterialAssignInfoList == null ? BigDecimal.ZERO : BigDecimal.valueOf(mesMaterialAssignInfoList.size());
if (assignedAmount.add(BigDecimal.ONE).compareTo(totalPlanAmount) > 0) {
throw new ServiceException("此工位已经分配数量" + assignedAmount + ",计划数量" + totalPlanAmount + ",不能再分配");
}
Date currentDate = new Date();
MesMaterialAssignInfo mesMaterialAssignInfo = new MesMaterialAssignInfo();
mesMaterialAssignInfo.setMaterialBarcode(materialBarcode);
@ -408,13 +430,13 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
mesMaterialAssignInfoMapper.insertMesMaterialAssignInfo(mesMaterialAssignInfo);
Long stationNo = stationId % 10;
Long stationNo = stationId % 10;//第几个工位取个位数
JSONObject assignTaskMessageJson = new JSONObject();
assignTaskMessageJson.put("stationNo", stationNo);
assignTaskMessageJson.put("time", currentDate.getTime());
assignTaskMessageJson.put("materialBarcode", materialBarcode);
//2、订阅者读取此条信息后会给出反馈直接写入redis如果在10s内返回则成功如果10s内失败则失败
//如果在10s内返回则成功如果10s内失败则失败
String returnMsg = SocketUtils.
sendAndReceive(mesConfig.getSocketServerHost(), mesConfig.getSocketServerPort(), mesConfig.getSocketServerReadTimeOut(), assignTaskMessageJson.toString());
if (StringUtils.isEmpty(returnMsg)) {
@ -434,17 +456,18 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
/**
*
*
* @param hashMap (installType=1,installType=2)
* @return
*/
@Override
public List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap) {
List<HashMap<String, Object>> result = new ArrayList<>();
if (hashMap.containsKey("installType") && hashMap.get("installType").equals("1")){
if (hashMap.containsKey("installType") && hashMap.get("installType").equals("1")) {
result = mesMaterialCheckResultMapper.selectMaterialInstallationCircumstance(hashMap);
}
if (hashMap.containsKey("installType") && hashMap.get("installType").equals("2")
&& hashMap.containsKey("planDetailId") && hashMap.containsKey("materialBomId")){
&& hashMap.containsKey("planDetailId") && hashMap.containsKey("materialBomId")) {
result = mesMaterialCheckResultMapper.selectMaterialUnInstallationCircumstance(hashMap);
}
return result;

@ -332,4 +332,38 @@
</where>
</select>
<select id="selectOnlyMesProductPlanByPlanCode" parameterType="String" resultMap="MesProductPlanMesProductPlanDetailResult">
select a.plan_id,
a.product_order_id,
a.plan_code,
a.dispatch_code,
a.material_id,
a.material_bom_id,
a.process_id,
a.process_order,
a.last_process_id,
a.station_id,
a.user_id,
a.production_time,
a.plan_amount,
a.complete_amount,
a.plan_begin_time,
a.plan_end_time,
a.real_begin_time,
a.real_end_time,
a.attach_id,
a.sop_id,
a.plan_status,
a.is_flag,
a.remark,
a.create_by,
a.create_time,
a.update_by,
a.update_time
from mes_product_plan a
where a.plan_code = #{planCode}
</select>
</mapper>

@ -538,4 +538,33 @@ public class TdEngineController {
}
/**
* @return R<?>
* @param: tableDto
* @description
* @author xins
* @date 2023-08-28 16:17
*/
@InnerAuth
@PostMapping("/dropTable")
public R<?> dropTable(@Validated @RequestBody TdTableDropVo tdTableDropVo) {
try {
String databaseName = tdTableDropVo.getDatabaseName();
String tableName = tdTableDropVo.getTableName();
this.tdEngineService.dropTable(databaseName, tableName);
log.info("successfully droped table " + tableName);
return R.ok("successfully droped table " + tableName);
} catch (Exception e) {
String message = e.getCause().getMessage();
try {
message = message.substring(message.lastIndexOf("invalid operation"));
} catch (Exception ex) {
log.error(ex.getMessage());
}
log.error(message);
return R.fail(message);
}
}
}

@ -166,6 +166,14 @@ public interface TdEngineMapper {
int getCountOfSuperTableHistoryData(TdSuperTableEmsSelectVo tdSuperTableEmsSelectVo);
/**
* drop
*
* @param databaseName
* @param tableName
*/
void dropTable(@Param("databaseName") String databaseName,
@Param("tableName") String tableName);
// /**
// * 检查表是否存在

@ -158,6 +158,18 @@ public interface ITdEngineService {
* @param alterTagVos
*/
public void alterTableTags(List<AlterTagVo> alterTagVos);
/**
* @param: databaseName
* @param: tableName
* @description drop
* @author xins
* @date 2024-04-20 11:08
*/
public void dropTable(String databaseName, String tableName) throws Exception;
// void initSTableFrame(String msg) throws Exception;
// List<Map<String, Object>> getRealtimeData(SelectVisualDto selectVisualDto);

@ -282,6 +282,19 @@ public class TdEngineServiceImpl implements ITdEngineService {
}
/**
* @param: databaseName
* @param: tableName
* @description drop
* @author xins
* @date 2024-04-20 11:08
*/
@Override
public void dropTable(String databaseName, String tableName) throws Exception {
this.tdEngineMapper.dropTable(databaseName, tableName);
}
//
// /**
// * 检查数据库表是否存在

@ -361,6 +361,10 @@
</select>
<update id="dropTable">
drop table #{databaseName}.#{tableName}
</update>
<!--
<select id="checkTableExists" resultType="java.lang.Integer">

Loading…
Cancel
Save