|
@@ -16,6 +16,7 @@ FixedWeightPackForm::FixedWeightPackForm(QWidget *parent) :
|
|
|
connect(glo,&GlobalInfo::dbConfigUpdated,this,&FixedWeightPackForm::upconfig);
|
|
connect(glo,&GlobalInfo::dbConfigUpdated,this,&FixedWeightPackForm::upconfig);
|
|
|
connect(glo,&GlobalInfo::dengJiUped,this,&FixedWeightPackForm::upDengjiInfo);
|
|
connect(glo,&GlobalInfo::dengJiUped,this,&FixedWeightPackForm::upDengjiInfo);
|
|
|
connect(glo,&GlobalInfo::doInited,this,&FixedWeightPackForm::changeSpecs);
|
|
connect(glo,&GlobalInfo::doInited,this,&FixedWeightPackForm::changeSpecs);
|
|
|
|
|
+ connect(glo,&GlobalInfo::selectproject,this,&FixedWeightPackForm::changeSpecs);
|
|
|
connect(glo,&GlobalInfo::wareUped,this,&FixedWeightPackForm::upWare);
|
|
connect(glo,&GlobalInfo::wareUped,this,&FixedWeightPackForm::upWare);
|
|
|
connect(glo,&GlobalInfo::boxModelUped,this,&FixedWeightPackForm::upBoxModelList);
|
|
connect(glo,&GlobalInfo::boxModelUped,this,&FixedWeightPackForm::upBoxModelList);
|
|
|
connect(glo,&GlobalInfo::packModelUpde,this,&FixedWeightPackForm::upPackModelList);
|
|
connect(glo,&GlobalInfo::packModelUpde,this,&FixedWeightPackForm::upPackModelList);
|
|
@@ -64,7 +65,7 @@ void FixedWeightPackForm::calcData()
|
|
|
void FixedWeightPackForm::save()
|
|
void FixedWeightPackForm::save()
|
|
|
{
|
|
{
|
|
|
QStringList list;
|
|
QStringList list;
|
|
|
- qDebug()<<ui->taitou->text();
|
|
|
|
|
|
|
+
|
|
|
list << ui->taitou->text() << ui->taiPhone->text();
|
|
list << ui->taitou->text() << ui->taiPhone->text();
|
|
|
PQ::CacheFile::writeFile("dingzhongInfo.cache",list.join("[,]").toUtf8());
|
|
PQ::CacheFile::writeFile("dingzhongInfo.cache",list.join("[,]").toUtf8());
|
|
|
|
|
|
|
@@ -84,9 +85,11 @@ void FixedWeightPackForm::on_addPackList_clicked()
|
|
|
packinfo->customer = ui->taitou->text();
|
|
packinfo->customer = ui->taitou->text();
|
|
|
packinfo->telephone = ui->taiPhone->text();
|
|
packinfo->telephone = ui->taiPhone->text();
|
|
|
}
|
|
}
|
|
|
-// qDebug()<<packinfo->boxes().at(0)->tube_number;
|
|
|
|
|
|
|
|
|
|
- packinfo->autoRuku = ui->ruku->isChecked();
|
|
|
|
|
|
|
+ packinfo->warehouse_id = 0;
|
|
|
|
|
+ if(ui->ruku->isChecked()){
|
|
|
|
|
+ packinfo->warehouse_id = ui->wareBox->currentData().toInt();
|
|
|
|
|
+ }
|
|
|
if(ui->AutoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
|
|
if(ui->AutoSync->isChecked() && !GlobalInfo::this_()->isNoLine())
|
|
|
packServer->send(packinfo);
|
|
packServer->send(packinfo);
|
|
|
Manger->savePackInfo(packinfo);
|
|
Manger->savePackInfo(packinfo);
|
|
@@ -120,7 +123,6 @@ void FixedWeightPackForm::on_addBoxList_clicked()
|
|
|
|
|
|
|
|
if(chengZhongJingDu == 2){
|
|
if(chengZhongJingDu == 2){
|
|
|
if(netNum<=0){
|
|
if(netNum<=0){
|
|
|
- // netNum = 0.00;
|
|
|
|
|
QMessageBox::information(this,tr("注意"),tr("重量异常"));
|
|
QMessageBox::information(this,tr("注意"),tr("重量异常"));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -132,28 +134,26 @@ void FixedWeightPackForm::on_addBoxList_clicked()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
checkPackInfo(); //检查packinfo isNull
|
|
checkPackInfo(); //检查packinfo isNull
|
|
|
//当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
|
|
//当当前箱数大于等于最大箱数是启动on_addPackList_clicked();
|
|
|
if(packinfo->boxes().size() >= ui->comboBox->currentText().toInt()){
|
|
if(packinfo->boxes().size() >= ui->comboBox->currentText().toInt()){
|
|
|
on_addPackList_clicked();
|
|
on_addPackList_clicked();
|
|
|
- checkPackInfo();
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+// return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ checkPackInfo(); //检查packinfo isNull
|
|
|
auto index = packinfo->boxInfoSize();
|
|
auto index = packinfo->boxInfoSize();
|
|
|
auto box = packinfo->addBoxInfo();
|
|
auto box = packinfo->addBoxInfo();
|
|
|
- calcData();
|
|
|
|
|
|
|
+// calcData();
|
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
|
// box->bucket_weight = int((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
|
|
// box->bucket_weight = int((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
|
|
|
box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
|
|
box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
|
|
|
if(chengZhongJingDu == 2){
|
|
if(chengZhongJingDu == 2){
|
|
|
- box->gross_weight = int(gross_weight*1000);
|
|
|
|
|
- box->net_weight = int(netNum*1000);
|
|
|
|
|
|
|
+ box->gross_weight = QString::number(gross_weight*1000).toInt();
|
|
|
|
|
+ box->net_weight = QString::number(netNum*1000).toInt();
|
|
|
}else if(chengZhongJingDu == 1){
|
|
}else if(chengZhongJingDu == 1){
|
|
|
- box->gross_weight = int(f_gross_weight*1000);
|
|
|
|
|
- box->net_weight = int(f_netNum*1000);
|
|
|
|
|
|
|
+ box->gross_weight = QString::number(f_gross_weight*1000).toInt();
|
|
|
|
|
+ box->net_weight = QString::number(f_netNum*1000).toInt();
|
|
|
}
|
|
}
|
|
|
box->Level = ui->dengji->currentText();
|
|
box->Level = ui->dengji->currentText();
|
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
@@ -162,14 +162,12 @@ void FixedWeightPackForm::on_addBoxList_clicked()
|
|
|
// box->remark = ui->beizhu->toPlainText();
|
|
// box->remark = ui->beizhu->toPlainText();
|
|
|
packinfo->level = ui->dengji->currentText();
|
|
packinfo->level = ui->dengji->currentText();
|
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
|
- packinfo->warehouse_id = ui->wareBox->currentData().toInt();
|
|
|
|
|
packinfo->autoRuku = ui->ruku->isChecked();
|
|
packinfo->autoRuku = ui->ruku->isChecked();
|
|
|
addTableWidget(box,index);
|
|
addTableWidget(box,index);
|
|
|
|
|
|
|
|
|
|
|
|
|
// 把box数据添加到packinfo的boxes数据表里;
|
|
// 把box数据添加到packinfo的boxes数据表里;
|
|
|
packinfo->addBoxInfoList(box);
|
|
packinfo->addBoxInfoList(box);
|
|
|
-// qDebug()<<"currentindex"<<ui->xiangdan->currentIndex();
|
|
|
|
|
if(ui->xiangdanPrint->isChecked()){
|
|
if(ui->xiangdanPrint->isChecked()){
|
|
|
if(ui->xiangdan->currentIndex() == 0){
|
|
if(ui->xiangdan->currentIndex() == 0){
|
|
|
GlobalInfo::this_()->printerBox(box);
|
|
GlobalInfo::this_()->printerBox(box);
|
|
@@ -208,13 +206,12 @@ void FixedWeightPackForm::checkPackInfo()
|
|
|
{
|
|
{
|
|
|
if(packinfo.isNull()){
|
|
if(packinfo.isNull()){
|
|
|
packinfo.reset(new PackInfo(_info));
|
|
packinfo.reset(new PackInfo(_info));
|
|
|
- packinfo->operator_id = GlobalInfo::this_()->user().userId;
|
|
|
|
|
|
|
+ packinfo->operator_id = QString::number(GlobalInfo::this_()->user().userId);
|
|
|
packinfo->packing_time = QDate::currentDate().toString("yyyy-MM-dd");
|
|
packinfo->packing_time = QDate::currentDate().toString("yyyy-MM-dd");
|
|
|
packinfo->packing_type = _info->category;
|
|
packinfo->packing_type = _info->category;
|
|
|
packinfo->packType = 0;
|
|
packinfo->packType = 0;
|
|
|
|
|
|
|
|
//
|
|
//
|
|
|
- packinfo->warehouse_id = 0;
|
|
|
|
|
packinfo->batch_no = _info->batch_no;
|
|
packinfo->batch_no = _info->batch_no;
|
|
|
packinfo->quantity = packinfo->boxes().size();
|
|
packinfo->quantity = packinfo->boxes().size();
|
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
@@ -227,6 +224,9 @@ void FixedWeightPackForm::checkPackInfo()
|
|
|
|
|
|
|
|
restTableWidget();
|
|
restTableWidget();
|
|
|
}
|
|
}
|
|
|
|
|
+ if(packinfo->goodsID()<0){
|
|
|
|
|
+ packinfo.clear();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//往tablewidget里添加数据
|
|
//往tablewidget里添加数据
|
|
@@ -279,6 +279,7 @@ void FixedWeightPackForm::init()
|
|
|
Manger = GlobalInfo::this_()->packInfoManger();
|
|
Manger = GlobalInfo::this_()->packInfoManger();
|
|
|
packServer = new PackInfoSeed2Server(Manger,this,true);
|
|
packServer = new PackInfoSeed2Server(Manger,this,true);
|
|
|
}
|
|
}
|
|
|
|
|
+ ui->jitai->setCurrentText(_info->machine_no);
|
|
|
ui->pizhong->setCurrentText(QString(_info->box_weight));
|
|
ui->pizhong->setCurrentText(QString(_info->box_weight));
|
|
|
ui->guanse->setCurrentText(_info->bucket_color);
|
|
ui->guanse->setCurrentText(_info->bucket_color);
|
|
|
ui->zhixiang->setCurrentText(_info->carton_type);
|
|
ui->zhixiang->setCurrentText(_info->carton_type);
|
|
@@ -317,7 +318,8 @@ void FixedWeightPackForm::upconfig()
|
|
|
f_chengZhongJingDuModel_Num = 0.08;
|
|
f_chengZhongJingDuModel_Num = 0.08;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
-// qDebug()<<"称重精度数据"<<chengZhongJingDuModel_Num;
|
|
|
|
|
|
|
+ // 打包及入库
|
|
|
|
|
+ ui->ruku->setChecked(config.daBaoRuku);
|
|
|
// 码数
|
|
// 码数
|
|
|
ui->comboBox->clear();
|
|
ui->comboBox->clear();
|
|
|
for(int i = 0; i < config.mashu.size(); ++i){
|
|
for(int i = 0; i < config.mashu.size(); ++i){
|
|
@@ -371,9 +373,6 @@ void FixedWeightPackForm::upWare()
|
|
|
{
|
|
{
|
|
|
QList<WarehouseConfig> ware = glo->wareList();
|
|
QList<WarehouseConfig> ware = glo->wareList();
|
|
|
for(int i = 0;i<ware.size();i++){
|
|
for(int i = 0;i<ware.size();i++){
|
|
|
-// qDebug()<<ware.at(i).name;
|
|
|
|
|
-// qDebug()<<ware.at(i).factory_name;
|
|
|
|
|
-// qDebug()<<ware.at(i).warehouse_id;
|
|
|
|
|
ui->wareBox->addItem(ware.at(i).name,ware.at(i).warehouse_id);
|
|
ui->wareBox->addItem(ware.at(i).name,ware.at(i).warehouse_id);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -488,7 +487,7 @@ void FixedWeightPackForm::xuanZe_clicked(QString batchno)
|
|
|
void FixedWeightPackForm::del_clicked(int row)
|
|
void FixedWeightPackForm::del_clicked(int row)
|
|
|
{
|
|
{
|
|
|
if(packinfo.isNull()) return;
|
|
if(packinfo.isNull()) return;
|
|
|
- qDebug()<<row;
|
|
|
|
|
|
|
+
|
|
|
packinfo->delBoxInfoAt(row);
|
|
packinfo->delBoxInfoAt(row);
|
|
|
restTableWidget();
|
|
restTableWidget();
|
|
|
}
|
|
}
|
|
@@ -554,19 +553,24 @@ void FixedWeightPackForm::on_pushContinue_clicked()
|
|
|
}
|
|
}
|
|
|
if(list.isEmpty()){
|
|
if(list.isEmpty()){
|
|
|
QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
|
|
QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- qDebug()<<list.size();
|
|
|
|
|
|
|
+ QList<PackSaveInfo>Plist;
|
|
|
for(int i = 0;i<list.size();i++){
|
|
for(int i = 0;i<list.size();i++){
|
|
|
- if(list.at(i).packInfo->batch_no!=_info->batch_no){
|
|
|
|
|
- list.removeAt(i);
|
|
|
|
|
|
|
+ if(list.at(i).packInfo->batch_no==_info->batch_no){
|
|
|
|
|
+ Plist.append(list.at(i));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- std::sort(list.begin(),list.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
|
|
|
|
|
|
|
+ std::sort(Plist.begin(),Plist.end(),[](const PackSaveInfo & item1, const PackSaveInfo & item2){
|
|
|
return item1.packInfo->time() < item2.packInfo->time();
|
|
return item1.packInfo->time() < item2.packInfo->time();
|
|
|
});
|
|
});
|
|
|
|
|
+ if(Plist.isEmpty()){
|
|
|
|
|
+ QMessageBox::warning(this,tr("无可接续码单"),tr("无可接续码单"));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
QSharedPointer<PackInfo> pInfo;
|
|
QSharedPointer<PackInfo> pInfo;
|
|
|
- for (int i = list.size() - 1;i >= 0 ; --i) {
|
|
|
|
|
- auto & v = list.at(i);
|
|
|
|
|
|
|
+ for (int i = Plist.size() - 1;i >= 0 ; --i) {
|
|
|
|
|
+ auto & v = Plist.at(i);
|
|
|
if(v.packInfo->packType != 0) continue;
|
|
if(v.packInfo->packType != 0) continue;
|
|
|
if(v.packInfo->boxInfoSize() < ui->comboBox->currentText().toInt()){
|
|
if(v.packInfo->boxInfoSize() < ui->comboBox->currentText().toInt()){
|
|
|
pInfo = v.packInfo;
|
|
pInfo = v.packInfo;
|
|
@@ -602,9 +606,26 @@ void FixedWeightPackForm::EditBatch()
|
|
|
calcData();
|
|
calcData();
|
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
|
- box->bucket_weight = int((ui->pizhong->currentText().toDouble()*ui->tongshu->text().toDouble())*1000);
|
|
|
|
|
- box->gross_weight = int(gross_weight*1000);
|
|
|
|
|
- box->net_weight = int(netNum*1000);
|
|
|
|
|
|
|
+// box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*ui->tongshu->text().toDouble()+0.005)*100)*10);
|
|
|
|
|
+// if(chengZhongJingDu == 2){
|
|
|
|
|
+// box->gross_weight = QString::number(gross_weight*1000).toInt();
|
|
|
|
|
+// box->net_weight = QString::number(netNum*1000).toInt();
|
|
|
|
|
+//// qDebug()<<"boxNet"<<box->net_weight;
|
|
|
|
|
+//// qDebug()<<"net"<<netNum*1000;
|
|
|
|
|
+// }else if(chengZhongJingDu == 1){
|
|
|
|
|
+// box->gross_weight = QString::number(f_gross_weight*1000).toInt();
|
|
|
|
|
+// box->net_weight = QString::number(f_netNum*1000).toInt();
|
|
|
|
|
+//// qDebug()<<"f_boxNet"<<box->net_weight;
|
|
|
|
|
+//// qDebug()<<"f_net"<<f_netNum*1000;
|
|
|
|
|
+// }
|
|
|
|
|
+ box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
|
|
|
|
|
+ int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
|
|
|
|
|
+ if(chengZhongJingDu==2){
|
|
|
|
|
+ box->net_weight = net;
|
|
|
|
|
+ }else if(chengZhongJingDu == 1){
|
|
|
|
|
+ box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
box->Level = ui->dengji->currentText();
|
|
box->Level = ui->dengji->currentText();
|
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
|
box->bucket_color = ui->guanse->currentText();
|
|
box->bucket_color = ui->guanse->currentText();
|
|
@@ -660,9 +681,14 @@ void FixedWeightPackForm::on_useNewDataButton_clicked()
|
|
|
calcData();
|
|
calcData();
|
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
box->box_weight = int(ui->pizhong->currentText().toDouble()*1000);
|
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
box->tube_number = ui->tongshu->text().toInt();
|
|
|
- box->bucket_weight = int(ui->tongzhong->currentText().toInt()*ui->tongshu->text().toDouble()*1000);
|
|
|
|
|
- box->gross_weight = int(gross_weight*1000);
|
|
|
|
|
- box->net_weight = int(netNum*1000);
|
|
|
|
|
|
|
+ box->bucket_weight = int(floor((ui->tongzhong->currentText().toDouble()*box->tube_number+0.005)*100)*10);
|
|
|
|
|
+ int net = box->gross_weight-(ui->pizhong->currentText().toDouble()+box->tube_number*ui->tongzhong->currentText().toDouble())*1000;
|
|
|
|
|
+ if(chengZhongJingDu==2){
|
|
|
|
|
+ box->net_weight = net;
|
|
|
|
|
+ }else if(chengZhongJingDu == 1){
|
|
|
|
|
+ box->net_weight = floor(((net/1000.00)+0.05)*10)*100;
|
|
|
|
|
+ }
|
|
|
|
|
+// qDebug()<<"单精度"<<floor(((net/1000.00)+0.05)*10)*100;
|
|
|
box->Level = ui->dengji->currentText();
|
|
box->Level = ui->dengji->currentText();
|
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
box->twist_type = ui->nianxiang->currentText();
|
|
|
box->bucket_color = ui->guanse->currentText();
|
|
box->bucket_color = ui->guanse->currentText();
|
|
@@ -673,6 +699,5 @@ void FixedWeightPackForm::on_useNewDataButton_clicked()
|
|
|
packinfo->customer = ui->taitou->text();
|
|
packinfo->customer = ui->taitou->text();
|
|
|
packinfo->telephone = ui->taiPhone->text();
|
|
packinfo->telephone = ui->taiPhone->text();
|
|
|
packinfo->autoRuku = ui->ruku->isChecked();
|
|
packinfo->autoRuku = ui->ruku->isChecked();
|
|
|
- packinfo->warehouse_id = ui->wareBox->currentData().toInt();
|
|
|
|
|
restTableWidget();
|
|
restTableWidget();
|
|
|
}
|
|
}
|