You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.3 KiB
36 lines
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.TRACING.DAInterface;
|
|
|
|
namespace QMAPP.FJC.TRACING.StateActions
|
|
{
|
|
|
|
public class ChangeProcessCode : IStateAction
|
|
{
|
|
public void Execute(DAObject data)
|
|
{
|
|
string newprocesscode = (from da in data.WorkLocState.DataCache
|
|
where string.Equals(da.ISPROCESSCODE, "1")
|
|
select da.DA_VALUE).FirstOrDefault();
|
|
if (string.IsNullOrEmpty(newprocesscode))//是否包含过程码采集项
|
|
{
|
|
return;
|
|
}
|
|
|
|
string[] codeOfParts = (from da in data.WorkLocState.DataCache
|
|
where !string.Equals(da.ISPROCESSCODE, "1")
|
|
&& string.Equals(da.DATA_TYPE, "SN")
|
|
select da.DA_VALUE).ToArray();
|
|
if (codeOfParts.Length == 0)
|
|
{
|
|
return;
|
|
}
|
|
string sql = "UPDATE T_QT_PRODUCT_STRUCTURE SET PROCESS_CODE='" + newprocesscode + "' "
|
|
+ "WHERE PROCESS_CODE IN ('" + string.Join("','", codeOfParts) + "')";
|
|
data.SQLCommands.Add(new SQLCommand(sql));
|
|
|
|
}
|
|
}
|
|
}
|
|
|