📄 mrpcal.h
字号:
this->dgrdProducePlan->Dock = System::Windows::Forms::DockStyle::Fill;
this->dgrdProducePlan->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdProducePlan->Location = System::Drawing::Point(3, 17);
this->dgrdProducePlan->Name = S"dgrdProducePlan";
this->dgrdProducePlan->Size = System::Drawing::Size(738, 129);
this->dgrdProducePlan->TabIndex = 0;
//
// groupBox3
//
this->groupBox3->Controls->Add(this->dgrdMRP);
this->groupBox3->Dock = System::Windows::Forms::DockStyle::Bottom;
this->groupBox3->Location = System::Drawing::Point(0, 253);
this->groupBox3->Name = S"groupBox3";
this->groupBox3->Size = System::Drawing::Size(744, 224);
this->groupBox3->TabIndex = 2;
this->groupBox3->TabStop = false;
this->groupBox3->Text = S"MRP计算结果(物料需求)";
//
// dgrdMRP
//
this->dgrdMRP->DataMember = S"";
this->dgrdMRP->Dock = System::Windows::Forms::DockStyle::Fill;
this->dgrdMRP->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdMRP->Location = System::Drawing::Point(3, 17);
this->dgrdMRP->Name = S"dgrdMRP";
this->dgrdMRP->Size = System::Drawing::Size(738, 204);
this->dgrdMRP->TabIndex = 0;
//
// ProduceAdapter
//
this->ProduceAdapter->SelectCommand = this->sqlSelectCommand1;
System::Data::Common::DataTableMapping* __mcTemp__1[] = new System::Data::Common::DataTableMapping*[1];
System::Data::Common::DataColumnMapping* __mcTemp__2[] = new System::Data::Common::DataColumnMapping*[18];
__mcTemp__2[0] = new System::Data::Common::DataColumnMapping(S"物料名称", S"物料名称");
__mcTemp__2[1] = new System::Data::Common::DataColumnMapping(S"物料编号", S"物料编号");
__mcTemp__2[2] = new System::Data::Common::DataColumnMapping(S"编号", S"编号");
__mcTemp__2[3] = new System::Data::Common::DataColumnMapping(S"年份", S"年份");
__mcTemp__2[4] = new System::Data::Common::DataColumnMapping(S"计划期", S"计划期");
__mcTemp__2[5] = new System::Data::Common::DataColumnMapping(S"开始日期", S"开始日期");
__mcTemp__2[6] = new System::Data::Common::DataColumnMapping(S"结束日期", S"结束日期");
__mcTemp__2[7] = new System::Data::Common::DataColumnMapping(S"期初库存", S"期初库存");
__mcTemp__2[8] = new System::Data::Common::DataColumnMapping(S"需求数量", S"需求数量");
__mcTemp__2[9] = new System::Data::Common::DataColumnMapping(S"MPS数量", S"MPS数量");
__mcTemp__2[10] = new System::Data::Common::DataColumnMapping(S"生产单数量", S"生产单数量");
__mcTemp__2[11] = new System::Data::Common::DataColumnMapping(S"预计库存", S"预计库存");
__mcTemp__2[12] = new System::Data::Common::DataColumnMapping(S"记帐人", S"记帐人");
__mcTemp__2[13] = new System::Data::Common::DataColumnMapping(S"修改日期", S"修改日期");
__mcTemp__2[14] = new System::Data::Common::DataColumnMapping(S"审核人", S"审核人");
__mcTemp__2[15] = new System::Data::Common::DataColumnMapping(S"审核日期", S"审核日期");
__mcTemp__2[16] = new System::Data::Common::DataColumnMapping(S"状态", S"状态");
__mcTemp__2[17] = new System::Data::Common::DataColumnMapping(S"备注", S"备注");
__mcTemp__1[0] = new System::Data::Common::DataTableMapping(S"Table", S"主生产计划", __mcTemp__2);
this->ProduceAdapter->TableMappings->AddRange(__mcTemp__1);
//
// sqlSelectCommand1
//
this->sqlSelectCommand1->CommandText = S"SELECT 物料主文件.物料名称, 主生产计划.物料编号, 主生产计划.编号, 主生产计划.年份, 主生产计划.计划期, 主生产计划.开始日期, 主生产计划.结"
S"束日期, 主生产计划.期初库存, 主生产计划.需求数量, 主生产计划.MPS数量, 主生产计划.生产单数量, 主生产计划.预计库存, 主生产计划.记帐人, 主生"
S"产计划.修改日期, 主生产计划.审核人, 主生产计划.审核日期, 主生产计划.状态, 主生产计划.备注 FROM 主生产计划 INNER JOIN 物料主文件 "
S"ON 主生产计划.物料编号 = 物料主文件.物料编号";
//
// DemandAdapter
//
this->DemandAdapter->SelectCommand = this->sqlSelectCommand2;
System::Data::Common::DataTableMapping* __mcTemp__3[] = new System::Data::Common::DataTableMapping*[1];
System::Data::Common::DataColumnMapping* __mcTemp__4[] = new System::Data::Common::DataColumnMapping*[12];
__mcTemp__4[0] = new System::Data::Common::DataColumnMapping(S"物料名称", S"物料名称");
__mcTemp__4[1] = new System::Data::Common::DataColumnMapping(S"物料编号", S"物料编号");
__mcTemp__4[2] = new System::Data::Common::DataColumnMapping(S"年份", S"年份");
__mcTemp__4[3] = new System::Data::Common::DataColumnMapping(S"计划期", S"计划期");
__mcTemp__4[4] = new System::Data::Common::DataColumnMapping(S"期初库存", S"期初库存");
__mcTemp__4[5] = new System::Data::Common::DataColumnMapping(S"毛需求", S"毛需求");
__mcTemp__4[6] = new System::Data::Common::DataColumnMapping(S"预计入库", S"预计入库");
__mcTemp__4[7] = new System::Data::Common::DataColumnMapping(S"预计出库", S"预计出库");
__mcTemp__4[8] = new System::Data::Common::DataColumnMapping(S"预计库存", S"预计库存");
__mcTemp__4[9] = new System::Data::Common::DataColumnMapping(S"净需求", S"净需求");
__mcTemp__4[10] = new System::Data::Common::DataColumnMapping(S"计划产出", S"计划产出");
__mcTemp__4[11] = new System::Data::Common::DataColumnMapping(S"计划投入", S"计划投入");
__mcTemp__3[0] = new System::Data::Common::DataTableMapping(S"Table", S"mrp物料需求计算", __mcTemp__4);
this->DemandAdapter->TableMappings->AddRange(__mcTemp__3);
//
// sqlSelectCommand2
//
this->sqlSelectCommand2->CommandText = S"SELECT 物料主文件.物料名称, mrp物料需求计算.物料编号, mrp物料需求计算.年份, mrp物料需求计算.计划期, mrp物料需求计算.期初库存, m"
S"rp物料需求计算.毛需求, mrp物料需求计算.预计入库, mrp物料需求计算.预计出库, mrp物料需求计算.预计库存, mrp物料需求计算.净需求, mrp"
S"物料需求计算.计划产出, mrp物料需求计算.计划投入 FROM mrp物料需求计算 INNER JOIN 物料主文件 ON mrp物料需求计算.物料编号 = "
S"物料主文件.物料编号";
//
// MRPCal
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(744, 477);
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox3);
this->Controls->Add(this->groupBox1);
this->Name = S"MRPCal";
this->Text = S"MRP计算";
this->groupBox1->ResumeLayout(false);
this->groupBox2->ResumeLayout(false);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdProducePlan))->EndInit();
this->groupBox3->ResumeLayout(false);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdMRP))->EndInit();
this->ResumeLayout(false);
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStateProducePlan()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"主生产计划"]->TableName;
DataGridTextBoxColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"主生产计划"]->Columns->Count;
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridNoActiveCellColumn();
aTextColumn->ReadOnly = true;
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"主生产计划"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"主生产计划"]->Columns->Item[i]->ColumnName;
aTextColumn->NullText = String::Empty;
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdProducePlan->TableStyles->Add(ts);
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStateDemand()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"物料需求"]->TableName;
DataGridTextBoxColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"物料需求"]->Columns->Count;
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridNoActiveCellColumn();
aTextColumn->ReadOnly = true;
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"物料需求"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"物料需求"]->Columns->Item[i]->ColumnName;
aTextColumn->NullText = String::Empty;
//设为数字格式显示
aTextColumn->Format = S"N";
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdMRP->TableStyles->Add(ts);
}
private: System::Void btnCalculate_Click(System::Object * sender, System::EventArgs * e)
{
if(this->ds->Tables->Item[S"主生产计划"]->Rows->Count <= 0)
{
//如果没有主生产计划,则返回
return;
}
else
{
String* StorageAndOrders = this->chkStorageAndOrders->Checked == true?S"1":S"0";
String* Ahead = this->chkAhead->Checked == true?S"1":S"0";
String* Wastage = this->chkWastage->Checked == true?S"1":S"0";
String* tempSQL = String::Format(S"exec sf_mrp计算 '{0}','{1}',{2}",StorageAndOrders,Ahead,Wastage);
int r = this->MyDataBase->SQLOperate(tempSQL);
if(r != -1)
{
//允许发布MRP计算结果
MessageBox::Show(S"MRP计算成功");
this->btnRelease->Enabled = true;
this->ds->Clear();
//查询主生产计划
this->strSQL = this->ProduceAdapter->SelectCommand->CommandText;
this->strTableName = S"主生产计划";
this->MyDataBase->SelectDataBase(this->ProduceAdapter,this->ds,this->strSQL,this->strTableName);
//查询物料需求
this->strSQL = this->DemandAdapter->SelectCommand->CommandText;
this->strTableName = S"物料需求";
this->MyDataBase->SelectDataBase(this->DemandAdapter,this->ds,this->strSQL,this->strTableName);
}
}
}
private: System::Void btnRelease_Click(System::Object * sender, System::EventArgs * e)
{
String* tempSQL = S"exec sf_mrp结果发布";
int r = this->MyDataBase->SQLOperate(tempSQL);
if(r != -1)
{
this->ds->Clear();
//查询主生产计划
this->strSQL = this->ProduceAdapter->SelectCommand->CommandText;
this->strTableName = S"主生产计划";
this->MyDataBase->SelectDataBase(this->ProduceAdapter,this->ds,this->strSQL,this->strTableName);
//查询物料需求
this->strSQL = this->DemandAdapter->SelectCommand->CommandText;
this->strTableName = S"物料需求";
this->MyDataBase->SelectDataBase(this->DemandAdapter,this->ds,this->strSQL,this->strTableName);
}
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -