668967bb89
SVN-Revision: r957
183 lines
6.0 KiB
C#
183 lines
6.0 KiB
C#
/******************************
|
|
* 说明:PubSpec 模块
|
|
* 创建人:龚宇超
|
|
* 创建日期:2018-01-02
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Lskj.Util;
|
|
using Lskj.Business;
|
|
using System.Windows.Forms;
|
|
using Lskj.Model;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using System.Data;
|
|
using Lskj.Business.Impl;
|
|
|
|
namespace Lskj.PubBomImport
|
|
{
|
|
/// <summary>
|
|
/// PubSpec 模块
|
|
/// </summary>
|
|
public class DllBaseClass : IForm
|
|
{
|
|
public DllBaseClass()
|
|
{
|
|
|
|
}
|
|
public DllBaseClass(string[] obj)
|
|
{
|
|
try
|
|
{
|
|
FrmMain main = new FrmMain();
|
|
this.SubForm = main;
|
|
main.Model = new DynamicBomImport(obj);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("Lskj.PubSpecialImport.dll--参数错误-->" + obj.ToString(), ex);
|
|
}
|
|
}
|
|
public Form SubForm { get; set; }
|
|
}
|
|
/// <summary>
|
|
/// PubSpecialImport入库参数
|
|
/// </summary>
|
|
public class DynamicBomImport : DynamicModel
|
|
{
|
|
public string PupupMenuId = "";
|
|
public string MenuName = "";
|
|
public string FirstRowIndex = "";
|
|
public string MainFieldDic = "";
|
|
public string SheetName = "";
|
|
/// <summary>
|
|
/// 读取筛选条件
|
|
/// </summary>
|
|
public string ReadTableCond = "";
|
|
/// <summary>
|
|
/// 忽略合并明细列标题行
|
|
/// </summary>
|
|
public bool CustomerServiceApp = false;
|
|
/// <summary>
|
|
/// 显示模式,如果为1则隐藏配置界面
|
|
/// </summary>
|
|
public string ShowType = "";
|
|
/// <summary>
|
|
/// 单据 BillMasterSql
|
|
/// </summary>
|
|
public string BillMasterSql = "";
|
|
/// <summary>
|
|
/// 单据 BillDetailSql
|
|
/// </summary>
|
|
public string BillDetailSql = "";
|
|
/// <summary>
|
|
/// 原始物料名称字段
|
|
/// </summary>
|
|
public string BeforeBomFieldName = "";
|
|
/// <summary>
|
|
/// 修改后物料名称字段
|
|
/// </summary>
|
|
public string AfterBomFieldName = "";
|
|
/// <summary>
|
|
/// 新增后的修改数据sql
|
|
/// </summary>
|
|
public string AfterAddBomSql = "";
|
|
public DynamicBomImport(string[] args)
|
|
: base(args)
|
|
{
|
|
// 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面.
|
|
MenuName = args[0];
|
|
|
|
if (args.Length > 5 && !string.IsNullOrWhiteSpace(args[5]))
|
|
{
|
|
PupupMenuId = args[5] + "";
|
|
}
|
|
if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6]))
|
|
{
|
|
base.ModuleCode = args[6] + "";
|
|
}
|
|
if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7]))
|
|
{
|
|
FirstRowIndex = args[7] + "";
|
|
}
|
|
if (args.Length > 8 && !string.IsNullOrWhiteSpace(args[8]))
|
|
{
|
|
MainFieldDic = args[8] + "";
|
|
}
|
|
if (args.Length > 9 && !string.IsNullOrWhiteSpace(args[9]))
|
|
{
|
|
SheetName = args[9] + "";
|
|
}
|
|
if (args.Length > 10 && !string.IsNullOrWhiteSpace(args[10]))
|
|
{
|
|
ReadTableCond = args[10] + "";
|
|
}
|
|
if (args.Length > 11 && !string.IsNullOrWhiteSpace(args[11]))
|
|
{
|
|
CustomerServiceApp = (args[11] + "").Equals("1");
|
|
}
|
|
if (args.Length > 12 && !string.IsNullOrWhiteSpace(args[12]))
|
|
{
|
|
ShowType = args[12] + "";
|
|
}
|
|
if (args.Length > 13 && !string.IsNullOrWhiteSpace(args[13]))
|
|
{
|
|
BillMasterSql = args[13] + "";
|
|
}
|
|
if (args.Length > 14 && !string.IsNullOrWhiteSpace(args[14]))
|
|
{
|
|
BillDetailSql = args[14] + "";
|
|
}
|
|
if (!string.IsNullOrEmpty(args[args.Length - 1]))
|
|
{
|
|
try
|
|
{
|
|
JObject rowObject = JsonConvert.DeserializeObject<JObject>(args[args.Length - 1]);
|
|
JArray jArray = new JArray();
|
|
jArray.Add(rowObject);
|
|
DataTable dataTable = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(jArray));
|
|
this.MaintabFocusedRow = dataTable.Rows[0];
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
if (BaseImpl.HasExistsTable("p_systemPopupPmsTab"))
|
|
{
|
|
DataTable pmsTable = BaseImpl.GetDataTableResult($"select * from p_systemPopupPmsTab where unionId='{PupupMenuId}'");
|
|
EnumerableRowCollection<DataRow> dataRows = pmsTable.AsEnumerable();
|
|
DataRow pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("BeforeBomFieldName")).FirstOrDefault();
|
|
if (pmsRow != null)
|
|
{
|
|
BeforeBomFieldName = pmsRow["pmsValue"] + "";
|
|
}
|
|
pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("AfterBomFieldName")).FirstOrDefault();
|
|
if (pmsRow != null)
|
|
{
|
|
AfterBomFieldName = pmsRow["pmsValue"] + "";
|
|
}
|
|
pmsRow = dataRows.Where(n => (n["pmsName"] + "").Equals("AfterAddBomSql")).FirstOrDefault();
|
|
if (pmsRow != null)
|
|
{
|
|
AfterAddBomSql = pmsRow["pmsValue"] + "";
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 设置模块编号
|
|
/// </summary>
|
|
/// <param name="moduleCode"></param>
|
|
public void ChangeModuleCode(string moduleCode)
|
|
{
|
|
base.ModuleCode = moduleCode;
|
|
}
|
|
}
|
|
}
|