提交说明10/9
This commit is contained in:
+86
-4
@@ -40,7 +40,7 @@ namespace GThinking.N_XLXSBJ
|
||||
txtLBJCLID.DecimalPlaces = XLBJDUtils.BJCLPriceDecimal;
|
||||
|
||||
base.InitPage();
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -79,7 +79,6 @@ namespace GThinking.N_XLXSBJ
|
||||
protected override void SetControlState()
|
||||
{
|
||||
base.SetControlState();
|
||||
|
||||
txtJGBID.Enabled = false;
|
||||
datWHSJ.Enabled = false;
|
||||
txtWHR.Enabled = false;
|
||||
@@ -278,7 +277,7 @@ namespace GThinking.N_XLXSBJ
|
||||
entity.Param.Add("XLXSJGB_JGBID", txtJGBID.Text.Trim());
|
||||
}
|
||||
base.LoadRecord();
|
||||
|
||||
InitJSGS();
|
||||
txtOLDTJYS.Value = cbxTJYS.SelectedValue.Trim().Equals("") ? " " : cbxTJYS.SelectedValue.Trim();
|
||||
txtOLDJGBMC.Value = txtJGBMC.Text.Trim();
|
||||
txtOLDBJLY.Value = cbxBJLY.SelectedValue.Trim();
|
||||
@@ -623,7 +622,7 @@ namespace GThinking.N_XLXSBJ
|
||||
txtOLDJGBMC.Value = txtJGBMC.Text.Trim();
|
||||
txtOLDTJYS.Value = cbxTJYS.SelectedValue.Trim().Equals("") ? " " : cbxTJYS.SelectedValue.Trim();
|
||||
txtOLDBJLY.Value = cbxBJLY.SelectedValue.Trim();
|
||||
|
||||
btnGXGS_Click(null, null);
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
string sJGBID = txtJGBID.Text.Trim();
|
||||
@@ -2092,6 +2091,89 @@ namespace GThinking.N_XLXSBJ
|
||||
OpenDialog(param);
|
||||
}
|
||||
|
||||
private void InitJSGS()
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("select CJGS from dbo.JGBCJGS where JGBID=:JGBID ");
|
||||
SQL.ParamByName("JGBID").Value = txtJGBID.Text.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
txtJGGS.Text = ConvertCodeToName(ds.Tables[0].Rows[0]["CJGS"].ToString().Trim());
|
||||
}
|
||||
|
||||
protected void btnGXGS_Click(object sender, EventArgs e)
|
||||
{
|
||||
string sJGBID = txtJGBID.Text.Trim();
|
||||
string sCodeFormula = ConvertNameToCode(txtJGGS.Text.Trim());
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("delete from dbo.JGBCJGS where JGBID=:JGBID ");
|
||||
SQL.ParamByName("JGBID").Value = sJGBID;
|
||||
dberp.ExecSQL(SQL);
|
||||
|
||||
SQL.Clear();
|
||||
SQL.Add("INSERT INTO dbo.JGBCJGS (JGBID, CJGS) VALUES(:pJGBID,:pJSGS) ");
|
||||
SQL.ParamByName("pJSGS").Value = sCodeFormula;
|
||||
SQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
dberp.ExecSQL(SQL);
|
||||
txtJGGS.Text = ConvertCodeToName(sCodeFormula);
|
||||
//ShowMessage("公式已更新!");
|
||||
}
|
||||
|
||||
private string ConvertCodeToName(string sFormula)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sFormula))
|
||||
return sFormula;
|
||||
string sResult = sFormula.Replace("CLCB", "成本").Replace("WSCB", "无税成本");
|
||||
Dictionary<string, string> dicYZ = GetYZIDNameMap();
|
||||
foreach (KeyValuePair<string, string> kvp in dicYZ)
|
||||
{
|
||||
sResult = sResult.Replace(kvp.Key, kvp.Value);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
private string ConvertNameToCode(string sFormula)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sFormula))
|
||||
return sFormula;
|
||||
string sResult = sFormula.Replace("无税成本", "WSCB").Replace("成本", "CLCB");
|
||||
Dictionary<string, string> dicYZ = GetYZIDNameMap();
|
||||
//按名称长度降序替换,避免短名称被长名称包含时误替换
|
||||
List<KeyValuePair<string, string>> lstYZ = new List<KeyValuePair<string, string>>(dicYZ);
|
||||
lstYZ.Sort(delegate(KeyValuePair<string, string> a, KeyValuePair<string, string> b)
|
||||
{
|
||||
return b.Value.Length.CompareTo(a.Value.Length);
|
||||
});
|
||||
foreach (KeyValuePair<string, string> kvp in lstYZ)
|
||||
{
|
||||
sResult = sResult.Replace(kvp.Value, kvp.Key);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetYZIDNameMap()
|
||||
{
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL SQL = new TSQL(dberp);
|
||||
SQL.Clear();
|
||||
SQL.Add("select XLXSTZYZ_YZID from XLXSTZYZ where XLXSTZYZ_MXBH='JZJ' ");
|
||||
DataSet ds = dberp.OpenDataSet(SQL);
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
string sYZID = ds.Tables[0].Rows[i]["XLXSTZYZ_YZID"].ToString().Trim();
|
||||
TZYZXX yzxx = XLBJDUtils.GetYZXXByYZID(sYZID);
|
||||
string sYZMC = yzxx.XLXSTZYZ_YZMC.Trim();
|
||||
if (!dic.ContainsKey(sYZID))
|
||||
dic.Add(sYZID, sYZMC);
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user