hwh
2024-08-29 1427584584848e1a8c7997d84945c0d19488d698
Merge branch 'hwh'
5个文件已修改
95 ■■■■■ 已修改文件
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/api/wcs/wcsDevice.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsDevice/index.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -4,6 +4,9 @@
namespace WCS.Application;
public static class PLCTaskAction
{
    //服务运行状态
    public static bool boRunningState = false;
    private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
    private static List<WcsPlc> listPlc;
@@ -48,6 +51,7 @@
            listPlcUtil.Add(plc);
        }
        cts = new CancellationTokenSource();
        boRunningState = true;
        StartRead();
    }
    /// <summary>
@@ -127,5 +131,6 @@
    public static void Stop()
    {
        cts.Cancel();
        boRunningState = false;
    }
}
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
@@ -210,3 +210,16 @@
{
}
public class GeneratePosInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [Required(ErrorMessage = "主键Id不能为空")]
    public long Id { get; set; }
    /// <summary>
    /// 起始点位
    /// </summary>
    [Required(ErrorMessage = "起始点位不能为空")]
    public int Pos { get; set; }
}
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
@@ -150,7 +150,54 @@
                ).ToListAsync();
    }
    /// <summary>
    /// 生成点位
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    [ApiDescriptionSettings(Name = "GeneratePos")]
    [DisplayName("生成点位")]
    public async Task GeneratePos(GeneratePosInput input)
    {
        var modDevice = await _wcsDeviceRep.GetByIdAsync(input.Id);
        var listPosition = new List<WcsPosition>();
        listPosition.Add(new WcsPosition()
        {
            DeviceId = modDevice.Id,
            StationNum = modDevice.StationNum,
            PlcPos = input.Pos.ToString(),
            PosType = PLCDataTypeEnum.String,
            Text = "TaskNo"
        });
        listPosition.Add(new WcsPosition()
        {
            DeviceId = modDevice.Id,
            StationNum = modDevice.StationNum,
            PlcPos = (input.Pos + 4).ToString(),
            PosType = PLCDataTypeEnum.UShort,
            Text = "TaskType"
        });
        listPosition.Add(new WcsPosition()
        {
            DeviceId = modDevice.Id,
            StationNum = modDevice.StationNum,
            PlcPos = (input.Pos + 6).ToString(),
            PosType = PLCDataTypeEnum.UShort,
            Text = "StartLocatNo"
        });
        listPosition.Add(new WcsPosition()
        {
            DeviceId = modDevice.Id,
            StationNum = modDevice.StationNum,
            PlcPos = (input.Pos + 8).ToString(),
            PosType = PLCDataTypeEnum.UShort,
            Text = "EndLocatNo"
        });
        await _wcsDeviceRep.Context.Insertable(listPosition).ExecuteCommandAsync();
    }
}
Web/src/api/wcs/wcsDevice.ts
@@ -6,6 +6,7 @@
  PageWcsDevice = '/api/wcsDevice/page',
  DetailWcsDevice = '/api/wcsDevice/detail',
  GetWcsPlcPlcIdDropdown = '/api/wcsDevice/WcsPlcPlcIdDropdown',
  GeneratePos = '/api/wcsDevice/GeneratePos',
}
// 增加设备信息
@@ -54,3 +55,10 @@
        method: 'get'
        });
export const generatePos = (params?: any) =>
    request({
    url: Api.GeneratePos,
    method: 'post',
    data: params
    });
Web/src/views/wcs/wcsDevice/index.vue
@@ -37,7 +37,6 @@
                  style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsDevice"
                  v-auth="'wcsDevice:add'"> 新增 </el-button>
              </el-button-group>
            </el-form-item>
@@ -79,13 +78,15 @@
            <ModifyRecord :data="scope.row" />
          </template>
        </el-table-column>
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip=""
        <el-table-column label="操作" width="220" align="center" fixed="right" show-overflow-tooltip=""
          v-if="auth('wcsDevice:update') || auth('wcsDevice:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsDevice(scope.row)"
              v-auth="'wcsDevice:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsDevice(scope.row)"
              v-auth="'wcsDevice:delete'"> 删除 </el-button>
            <el-button icon="ele-Plus" size="small" text="" type="primary" @click="generateDevicePos(scope.row)"
              v-auth="'wcsDevice:generate'"> 生成点位 </el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -112,7 +113,7 @@
import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
import editDialog from '/@/views/wcs/wcsDevice/component/editDialog.vue'
import { pageWcsDevice, deleteWcsDevice } from '/@/api/wcs/wcsDevice';
import { pageWcsDevice, deleteWcsDevice, generatePos } from '/@/api/wcs/wcsDevice';
import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice';
const showAdvanceQueryUI = ref(false);
@@ -167,7 +168,20 @@
  editWcsDeviceTitle.value = '编辑设备信息';
  editDialogRef.value.openDialog(row);
};
//生成点位
const generateDevicePos = (row: any) => {
  ElMessageBox.prompt('请输入起始点位', '生成点位', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
  })
    .then(async ({ value }) => {
      await generatePos({ id: row.id, pos: value });
      ElMessage({
        type: 'success',
        message: `生成点位成功`,
      })
    })
}
// 删除
const delWcsDevice = (row: any) => {
  ElMessageBox.confirm(`确定要删除吗?`, "提示", {