|
|
|
|
@ -58,29 +58,30 @@ namespace XGLFinishPro.Views
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<ChildProcess> listDetail = new List<ChildProcess>();
|
|
|
|
|
if (lstBoxStep.SelectedItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in lstBoxStep.SelectedItems)
|
|
|
|
|
{
|
|
|
|
|
ChildProcess childProcess = new ChildProcess();
|
|
|
|
|
//if (lstBoxStep.SelectedItems.Count > 0)
|
|
|
|
|
//{
|
|
|
|
|
// foreach (var item in lstBoxStep.SelectedItems)
|
|
|
|
|
// {
|
|
|
|
|
// ChildProcess childProcess = new ChildProcess();
|
|
|
|
|
|
|
|
|
|
childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
|
|
|
|
|
childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
|
|
|
|
|
listDetail.Add(childProcess);
|
|
|
|
|
}
|
|
|
|
|
if (lstSelectedStep.Items.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//this.lstSelectedStep.Items.Clear();
|
|
|
|
|
this.lstSelectedStep.ItemsSource = null;
|
|
|
|
|
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
|
|
|
|
|
this.btnSelectStep.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
|
|
|
|
|
this.btnSelectStep.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
|
|
|
|
|
// childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
|
|
|
|
|
// childProcess.attr1 = (item as ChildProcess).attr1;
|
|
|
|
|
// listDetail.Add(childProcess);
|
|
|
|
|
// }
|
|
|
|
|
// if (dgUserInfo1.Items.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// //this.lstSelectedStep.Items.Clear();
|
|
|
|
|
// this.dgUserInfo1.ItemsSource = null;
|
|
|
|
|
// dgUserInfo1.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
|
|
|
|
|
// this.btnSelectStep.IsChecked = false;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// dgUserInfo1.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
|
|
|
|
|
// this.btnSelectStep.IsChecked = false;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
@ -93,11 +94,11 @@ namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
this.msgBox.Text = "";
|
|
|
|
|
List<ChildProcess> listDetail = new List<ChildProcess>();
|
|
|
|
|
if (lstSelectedStep.SelectedItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
_childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
|
|
|
|
|
_childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
|
|
|
|
|
}
|
|
|
|
|
//if (lstSelectedStep.SelectedItems.Count > 0)
|
|
|
|
|
//{
|
|
|
|
|
// _childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
|
|
|
|
|
// _childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
|
|
|
|
|
//}
|
|
|
|
|
// DataTable dt = prodDBService.GetUnitPriceInfo();
|
|
|
|
|
|
|
|
|
|
this.dgUserInfo.ItemsSource = null;
|
|
|
|
|
@ -181,7 +182,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_deviceCode = ds.Tables[0].Rows[0][0].ToString();
|
|
|
|
|
this.lstSelectedStep.ItemsSource = GetStepData();
|
|
|
|
|
this.dgUserInfo1.ItemsSource = GetStepData();
|
|
|
|
|
GetUserData();
|
|
|
|
|
GetData();
|
|
|
|
|
}
|
|
|
|
|
@ -371,6 +372,31 @@ namespace XGLFinishPro.Views
|
|
|
|
|
curRow.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private CheckBox _previousCheckBox = null;
|
|
|
|
|
private void cb_child_Click_1(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CheckBox clickedCheckBox = sender as CheckBox;
|
|
|
|
|
if (clickedCheckBox == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// 如果之前有选中的CheckBox,取消其选中状态
|
|
|
|
|
if (_previousCheckBox != null && _previousCheckBox != clickedCheckBox)
|
|
|
|
|
{
|
|
|
|
|
_previousCheckBox.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 记录当前选中的CheckBox
|
|
|
|
|
_previousCheckBox = clickedCheckBox;
|
|
|
|
|
|
|
|
|
|
// 获取当前选中项的值
|
|
|
|
|
var selectedItem = dgUserInfo1.SelectedItem as ChildProcess; // 替换 YourDataType 为实际的数据类型
|
|
|
|
|
if (selectedItem != null)
|
|
|
|
|
{
|
|
|
|
|
_childprocessCode = selectedItem.childprocess_code;
|
|
|
|
|
_childprocessName = selectedItem.childprocess_name;
|
|
|
|
|
btnQueryUser_Click(null, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnQueryUser_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
@ -408,12 +434,12 @@ namespace XGLFinishPro.Views
|
|
|
|
|
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.Cancel)
|
|
|
|
|
return;
|
|
|
|
|
List<string> CreateUnitPriceSqlList = new List<string>();
|
|
|
|
|
if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
|
|
|
|
|
{
|
|
|
|
|
string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
|
|
|
|
|
CreateUnitPriceSqlList.Add(delSql);
|
|
|
|
|
//prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
|
|
|
|
|
}
|
|
|
|
|
//if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
|
|
|
|
|
//{
|
|
|
|
|
// string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
|
|
|
|
|
// CreateUnitPriceSqlList.Add(delSql);
|
|
|
|
|
// //prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
|
|
|
|
|
//}
|
|
|
|
|
string name = "";
|
|
|
|
|
string Gong = "";
|
|
|
|
|
string sapCode = _deviceCode;//ds.Tables[0].Rows[0][0].ToString();
|
|
|
|
|
@ -421,39 +447,25 @@ namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
if (item.number.IsNullOrEmpty()||item.number=="0")
|
|
|
|
|
{
|
|
|
|
|
if (name.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
name = item.nick_name;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
name = name + "," + item.nick_name;
|
|
|
|
|
}
|
|
|
|
|
item.number = "0";
|
|
|
|
|
}
|
|
|
|
|
if (item.attr2.IsNullOrEmpty() || item.attr2 == "0")
|
|
|
|
|
{
|
|
|
|
|
if (Gong.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
Gong = item.nick_name;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Gong = Gong + "," + item.nick_name;
|
|
|
|
|
}
|
|
|
|
|
item.attr2 = "0";
|
|
|
|
|
}
|
|
|
|
|
string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number,LoginUser.WorkDate,item.attr2);
|
|
|
|
|
CreateUnitPriceSqlList.Add(sql);
|
|
|
|
|
}
|
|
|
|
|
if (!name.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show($"当前选择的人员[{name}][>报工总数<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!Gong.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show($"当前选择的人员[{Gong}][>工时<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//if (!name.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// CustomMessageBox.Show($"当前选择的人员[{name}][>报工总数<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//if (!Gong.IsNullOrEmpty())
|
|
|
|
|
//{
|
|
|
|
|
// CustomMessageBox.Show($"当前选择的人员[{Gong}][>工时<]为空或者为0,请填写数量后再提交!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
//之前如果已经插入了,先删除,
|
|
|
|
|
|
|
|
|
|
//暂时不更新工单状态
|
|
|
|
|
@ -468,7 +480,9 @@ namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
item.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
dgUserInfo.Items.Refresh();
|
|
|
|
|
}
|
|
|
|
|
checkedRowsCache.Clear();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -486,28 +500,29 @@ namespace XGLFinishPro.Views
|
|
|
|
|
|
|
|
|
|
private void btnSelectStep_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<ChildProcess> list = new List<ChildProcess>();
|
|
|
|
|
DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
|
|
|
|
|
//List<ChildProcess> list = new List<ChildProcess>();
|
|
|
|
|
//DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
|
|
|
|
|
|
|
|
|
|
if (dt == null)
|
|
|
|
|
{
|
|
|
|
|
lstBoxStep.ItemsSource = null;
|
|
|
|
|
lstBoxStep.Items.Clear();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow item in dt.Rows)
|
|
|
|
|
{
|
|
|
|
|
list.Add(new ChildProcess()
|
|
|
|
|
{
|
|
|
|
|
childprocess_code = item["childprocess_code"].ToString(),
|
|
|
|
|
childprocess_name = item["childprocess_name"].ToString()
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
lstBoxStep.ItemsSource = null;
|
|
|
|
|
lstBoxStep.Items.Clear();
|
|
|
|
|
lstBoxStep.ItemsSource = list;//dt.DefaultView;
|
|
|
|
|
}
|
|
|
|
|
//if (dt == null)
|
|
|
|
|
//{
|
|
|
|
|
// lstBoxStep.ItemsSource = null;
|
|
|
|
|
// lstBoxStep.Items.Clear();
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// foreach (DataRow item in dt.Rows)
|
|
|
|
|
// {
|
|
|
|
|
// list.Add(new ChildProcess()
|
|
|
|
|
// {
|
|
|
|
|
// childprocess_code = item["childprocess_code"].ToString(),
|
|
|
|
|
// childprocess_name = item["childprocess_name"].ToString(),
|
|
|
|
|
// attr1 = TrimTrailingZeros(item["attr1"].ToString())
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// lstBoxStep.ItemsSource = null;
|
|
|
|
|
// lstBoxStep.Items.Clear();
|
|
|
|
|
// lstBoxStep.ItemsSource = list;//dt.DefaultView;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -520,8 +535,8 @@ namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show("请配置工序数据之后再试!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Question);
|
|
|
|
|
|
|
|
|
|
lstBoxStep.ItemsSource = null;
|
|
|
|
|
lstBoxStep.Items.Clear();
|
|
|
|
|
//lstBoxStep.ItemsSource = null;
|
|
|
|
|
//lstBoxStep.Items.Clear();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -530,18 +545,36 @@ namespace XGLFinishPro.Views
|
|
|
|
|
list.Add(new ChildProcess()
|
|
|
|
|
{
|
|
|
|
|
childprocess_code = item["childprocess_code"].ToString(),
|
|
|
|
|
childprocess_name = item["childprocess_name"].ToString()
|
|
|
|
|
childprocess_name = item["childprocess_name"].ToString(),
|
|
|
|
|
attr1 = TrimTrailingZeros(item["attr1"].ToString())
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
public string TrimTrailingZeros(string input)
|
|
|
|
|
{
|
|
|
|
|
if (input.Contains('.'))
|
|
|
|
|
{
|
|
|
|
|
// 去掉末尾的0
|
|
|
|
|
input = input.TrimEnd('0');
|
|
|
|
|
|
|
|
|
|
// 如果最后一个字符是小数点,去掉小数点
|
|
|
|
|
if (input.EndsWith("."))
|
|
|
|
|
{
|
|
|
|
|
input = input.TrimEnd('.');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class ChildProcess
|
|
|
|
|
{
|
|
|
|
|
public string childprocess_code { get; set; }
|
|
|
|
|
public string childprocess_name { get; set; }
|
|
|
|
|
|
|
|
|
|
public string attr1 { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class remuneration
|
|
|
|
|
|